annotate Resources/Orthanc/Core/SystemToolbox.h @ 54:01aa453d4d5b wasm

IWidget::HasRenderMouseOver
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Apr 2017 17:49:29 +0200
parents 7207a407bcd8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
40
7207a407bcd8 shared copyright with osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 39
diff changeset
5 * Copyright (C) 2017 Osimis, Belgium
15
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #if !defined(ORTHANC_SANDBOXED)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 # error The macro ORTHANC_SANDBOXED must be defined
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #if ORTHANC_SANDBOXED == 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 # error The namespace SystemToolbox cannot be used in sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 #include "Enumerations.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 #include <vector>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 #include <string>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 #include <stdint.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 namespace Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
39
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 22
diff changeset
54 void USleep(uint64_t microSeconds);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 22
diff changeset
55
15
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 ServerBarrierEvent ServerBarrier(const bool& stopFlag);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 ServerBarrierEvent ServerBarrier();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 void ReadFile(std::string& content,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 bool ReadHeader(std::string& header,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 const std::string& path,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 size_t headerSize);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 void WriteFile(const void* content,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 size_t size,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 void WriteFile(const std::string& content,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 void RemoveFile(const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 uint64_t GetFileSize(const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 void MakeDirectory(const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 bool IsExistingFile(const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 std::string GetPathToExecutable();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 std::string GetDirectoryOfExecutable();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 void ExecuteSystemCommand(const std::string& command,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 const std::vector<std::string>& arguments);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 int GetProcessId();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 bool IsRegularFile(const std::string& path);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 FILE* OpenFile(const std::string& path,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 FileMode mode);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
22
b01d46e5a2b3 support for sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 16
diff changeset
96 std::string GenerateUuid();
b01d46e5a2b3 support for sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 16
diff changeset
97
15
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 #if BOOST_HAS_DATE_TIME == 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 std::string GetNowIsoString();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 void GetNowDicom(std::string& date,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 std::string& time);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }