comparison Core/Toolbox.h @ 2143:fd5875662670

creation of namespace SystemToolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 16:54:23 +0100
parents a260a8ad83f1
children 84d1d392a9ab
comparison
equal deleted inserted replaced
2142:5a8840920121 2143:fd5875662670
54 54
55 #if !defined(BOOST_HAS_REGEX) 55 #if !defined(BOOST_HAS_REGEX)
56 # error The macro BOOST_HAS_REGEX must be defined 56 # error The macro BOOST_HAS_REGEX must be defined
57 #endif 57 #endif
58 58
59 #if !defined(ORTHANC_SANDBOXED)
60 # define ORTHANC_SANDBOXED 0
61 #endif
62
63 59
64 /** 60 /**
65 * NOTE: GUID vs. UUID 61 * NOTE: GUID vs. UUID
66 * The simple answer is: no difference, they are the same thing. Treat 62 * The simple answer is: no difference, they are the same thing. Treat
67 * them as a 16 byte (128 bits) value that is used as a unique 63 * them as a 16 byte (128 bits) value that is used as a unique
212 208
213 bool IsUuid(const std::string& str); 209 bool IsUuid(const std::string& str);
214 210
215 bool StartsWithUuid(const std::string& str); 211 bool StartsWithUuid(const std::string& str);
216 } 212 }
217
218
219 #if ORTHANC_SANDBOXED == 0
220 namespace SystemToolbox
221 {
222 ServerBarrierEvent ServerBarrier(const bool& stopFlag);
223
224 ServerBarrierEvent ServerBarrier();
225
226 void ReadFile(std::string& content,
227 const std::string& path);
228
229 bool ReadHeader(std::string& header,
230 const std::string& path,
231 size_t headerSize);
232
233 void WriteFile(const void* content,
234 size_t size,
235 const std::string& path);
236
237 void WriteFile(const std::string& content,
238 const std::string& path);
239
240 void RemoveFile(const std::string& path);
241
242 uint64_t GetFileSize(const std::string& path);
243
244 void MakeDirectory(const std::string& path);
245
246 bool IsExistingFile(const std::string& path);
247
248 std::string GetPathToExecutable();
249
250 std::string GetDirectoryOfExecutable();
251
252 void ExecuteSystemCommand(const std::string& command,
253 const std::vector<std::string>& arguments);
254
255 int GetProcessId();
256
257 bool IsRegularFile(const std::string& path);
258
259 FILE* OpenFile(const std::string& path,
260 FileMode mode);
261
262 #if BOOST_HAS_DATE_TIME == 1
263 std::string GetNowIsoString();
264
265 void GetNowDicom(std::string& date,
266 std::string& time);
267 #endif
268 }
269 #endif /* ORTHANC_SANDBOXED */
270 } 213 }