Mercurial > hg > orthanc
comparison Core/SystemToolbox.h @ 3991:5d2348b39392
turning toolbox namespaces into classes to control visibility in shared libraries
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 29 May 2020 21:23:57 +0200 |
parents | 94f4a18a79cc |
children | f9863630ec7f |
comparison
equal
deleted
inserted
replaced
3990:226ab94a33cd | 3991:5d2348b39392 |
---|---|
40 #if ORTHANC_SANDBOXED == 1 | 40 #if ORTHANC_SANDBOXED == 1 |
41 # error The namespace SystemToolbox cannot be used in sandboxed environments | 41 # error The namespace SystemToolbox cannot be used in sandboxed environments |
42 #endif | 42 #endif |
43 | 43 |
44 #include "Enumerations.h" | 44 #include "Enumerations.h" |
45 #include "Exports.h" | |
45 | 46 |
46 #include <map> | 47 #include <map> |
47 #include <vector> | 48 #include <vector> |
48 #include <string> | 49 #include <string> |
49 #include <stdint.h> | 50 #include <stdint.h> |
50 | 51 |
51 namespace Orthanc | 52 namespace Orthanc |
52 { | 53 { |
53 namespace SystemToolbox | 54 class ORTHANC_PUBLIC SystemToolbox |
54 { | 55 { |
55 void USleep(uint64_t microSeconds); | 56 public: |
57 static void USleep(uint64_t microSeconds); | |
56 | 58 |
57 ServerBarrierEvent ServerBarrier(const bool& stopFlag); | 59 static ServerBarrierEvent ServerBarrier(const bool& stopFlag); |
58 | 60 |
59 ServerBarrierEvent ServerBarrier(); | 61 static ServerBarrierEvent ServerBarrier(); |
60 | 62 |
61 void ReadFile(std::string& content, | 63 static void ReadFile(std::string& content, |
62 const std::string& path, | 64 const std::string& path, |
63 bool log = true); | 65 bool log = true); |
64 | 66 |
65 bool ReadHeader(std::string& header, | 67 static bool ReadHeader(std::string& header, |
66 const std::string& path, | 68 const std::string& path, |
67 size_t headerSize); | 69 size_t headerSize); |
68 | 70 |
69 void WriteFile(const void* content, | 71 static void WriteFile(const void* content, |
70 size_t size, | 72 size_t size, |
71 const std::string& path); | 73 const std::string& path); |
72 | 74 |
73 void WriteFile(const std::string& content, | 75 static void WriteFile(const std::string& content, |
74 const std::string& path); | 76 const std::string& path); |
75 | 77 |
76 void RemoveFile(const std::string& path); | 78 static void RemoveFile(const std::string& path); |
77 | 79 |
78 uint64_t GetFileSize(const std::string& path); | 80 static uint64_t GetFileSize(const std::string& path); |
79 | 81 |
80 void MakeDirectory(const std::string& path); | 82 static void MakeDirectory(const std::string& path); |
81 | 83 |
82 bool IsExistingFile(const std::string& path); | 84 static bool IsExistingFile(const std::string& path); |
83 | 85 |
84 std::string GetPathToExecutable(); | 86 static std::string GetPathToExecutable(); |
85 | 87 |
86 std::string GetDirectoryOfExecutable(); | 88 static std::string GetDirectoryOfExecutable(); |
87 | 89 |
88 void ExecuteSystemCommand(const std::string& command, | 90 static void ExecuteSystemCommand(const std::string& command, |
89 const std::vector<std::string>& arguments); | 91 const std::vector<std::string>& arguments); |
90 | 92 |
91 int GetProcessId(); | 93 static int GetProcessId(); |
92 | 94 |
93 bool IsRegularFile(const std::string& path); | 95 static bool IsRegularFile(const std::string& path); |
94 | 96 |
95 FILE* OpenFile(const std::string& path, | 97 static FILE* OpenFile(const std::string& path, |
96 FileMode mode); | 98 FileMode mode); |
97 | 99 |
98 std::string GetNowIsoString(bool utc); | 100 static std::string GetNowIsoString(bool utc); |
99 | 101 |
100 void GetNowDicom(std::string& date, | 102 static void GetNowDicom(std::string& date, |
101 std::string& time, | 103 std::string& time, |
102 bool utc); | 104 bool utc); |
103 | 105 |
104 unsigned int GetHardwareConcurrency(); | 106 static unsigned int GetHardwareConcurrency(); |
105 | 107 |
106 MimeType AutodetectMimeType(const std::string& path); | 108 static MimeType AutodetectMimeType(const std::string& path); |
107 | 109 |
108 void GetEnvironmentVariables(std::map<std::string, std::string>& env); | 110 static void GetEnvironmentVariables(std::map<std::string, std::string>& env); |
109 | 111 |
110 std::string InterpretRelativePath(const std::string& baseDirectory, | 112 static std::string InterpretRelativePath(const std::string& baseDirectory, |
111 const std::string& relativePath); | 113 const std::string& relativePath); |
112 } | 114 }; |
113 } | 115 } |