annotate OrthancServer/OrthancConfiguration.h @ 3777:4e680e0e46c4

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Mar 2020 11:14:59 +0100
parents 1f4910999fe7
children c205f670098e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
3640
94f4a18a79cc upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3536
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
4a38d7d4f0e0 new class: OrthancConfiguration
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
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "../Core/Images/FontRegistry.h"
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../Core/WebServiceParameters.h"
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include "../Core/DicomNetworking/RemoteModalityParameters.h"
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include <EmbeddedResources.h>
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 #include <boost/filesystem.hpp>
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 #include <boost/thread/shared_mutex.hpp>
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2933
diff changeset
44 #include <boost/thread/lock_types.hpp>
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace Orthanc
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
3138
ab46e537f92e renamed class MongooseServer as HttpServer, CivetWeb made default HTTP server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
48 class HttpServer;
2941
e292798f9980 OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
49 class ServerIndex;
3181
6fd38327e777 Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3138
diff changeset
50 class TemporaryFile;
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 class OrthancConfiguration : public boost::noncopyable
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 private:
2944
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
55 typedef std::map<std::string, RemoteModalityParameters> Modalities;
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
56 typedef std::map<std::string, WebServiceParameters> Peers;
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
57
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 boost::shared_mutex mutex_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 Json::Value json_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 boost::filesystem::path defaultDirectory_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 std::string configurationAbsolutePath_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 FontRegistry fontRegistry_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 const char* configurationFileArg_;
2944
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
64 Modalities modalities_;
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
65 Peers peers_;
2941
e292798f9980 OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
66 ServerIndex* serverIndex_;
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 OrthancConfiguration() :
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 configurationFileArg_(NULL)
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
2944
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
73 void LoadModalitiesFromJson(const Json::Value& source);
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
74
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
75 void LoadPeersFromJson(const Json::Value& source);
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
2946
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
77 void LoadModalities();
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
78
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
79 void LoadPeers();
2944
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
80
2946
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
81 void SaveModalitiesToJson(Json::Value& target);
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
82
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
83 void SavePeersToJson(Json::Value& target);
2944
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
84
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
85 void SaveModalities();
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
86
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
87 void SavePeers();
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
88
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 static OrthancConfiguration& GetInstance();
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 public:
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2933
diff changeset
92 class ReaderLock : public boost::noncopyable
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 private:
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 OrthancConfiguration& configuration_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 boost::shared_lock<boost::shared_mutex> lock_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 public:
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2933
diff changeset
99 ReaderLock() :
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 configuration_(GetInstance()),
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 lock_(configuration_.mutex_)
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 const OrthancConfiguration& GetConfiguration() const
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 return configuration_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 const Json::Value& GetJson() const
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 return configuration_.json_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 };
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2933
diff changeset
117 class WriterLock : public boost::noncopyable
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 private:
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 OrthancConfiguration& configuration_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 boost::unique_lock<boost::shared_mutex> lock_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 public:
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2933
diff changeset
124 WriterLock() :
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 configuration_(GetInstance()),
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 lock_(configuration_.mutex_)
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 OrthancConfiguration& GetConfiguration()
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 return configuration_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 const OrthancConfiguration& GetConfiguration() const
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 return configuration_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 const Json::Value& GetJson() const
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 return configuration_.json_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 };
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 const std::string& GetConfigurationAbsolutePath() const
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 return configurationAbsolutePath_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 const FontRegistry& GetFontRegistry() const
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 return fontRegistry_;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 void Read(const char* configurationFile);
2946
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
158
2e751f615e03 new configuration options: DicomModalitiesInDatabase and OrthancPeersInDatabase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2944
diff changeset
159 void LoadModalitiesAndPeers();
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 void RegisterFont(EmbeddedResources::FileResourceId resource)
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 fontRegistry_.AddFromResource(resource);
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 std::string GetStringParameter(const std::string& parameter,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 const std::string& defaultValue) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 int GetIntegerParameter(const std::string& parameter,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 int defaultValue) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 unsigned int GetUnsignedIntegerParameter(const std::string& parameter,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 unsigned int defaultValue) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
3506
d2b9981017c4 better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3500
diff changeset
175 bool LookupBooleanParameter(bool& target,
d2b9981017c4 better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3500
diff changeset
176 const std::string& parameter) const;
d2b9981017c4 better handling of HTTP security
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3500
diff changeset
177
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 bool GetBooleanParameter(const std::string& parameter,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 bool defaultValue) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 void GetDicomModalityUsingSymbolicName(RemoteModalityParameters& modality,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 const std::string& name) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
2944
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
184 bool LookupOrthancPeer(WebServiceParameters& peer,
f395460af74d simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2941
diff changeset
185 const std::string& name) const;
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 void GetListOfDicomModalities(std::set<std::string>& target) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 void GetListOfOrthancPeers(std::set<std::string>& target) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
3500
0d248cc63ded Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3181
diff changeset
191 // Returns "true" iff. at least one user is registered
0d248cc63ded Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3181
diff changeset
192 bool SetupRegisteredUsers(HttpServer& httpServer) const;
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 std::string InterpretStringParameterAsPath(const std::string& parameter) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2933
diff changeset
196 void GetListOfStringsParameter(std::list<std::string>& target,
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2933
diff changeset
197 const std::string& key) const;
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 bool IsSameAETitle(const std::string& aet1,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 const std::string& aet2) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 bool LookupDicomModalityUsingAETitle(RemoteModalityParameters& modality,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 const std::string& aet) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 bool IsKnownAETitle(const std::string& aet,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 const std::string& ip) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 RemoteModalityParameters GetModalityUsingSymbolicName(const std::string& name) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 RemoteModalityParameters GetModalityUsingAet(const std::string& aet) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 void UpdateModality(const std::string& symbolicName,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 const RemoteModalityParameters& modality);
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 void RemoveModality(const std::string& symbolicName);
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 void UpdatePeer(const std::string& symbolicName,
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 const WebServiceParameters& peer);
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 void RemovePeer(const std::string& symbolicName);
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 void Format(std::string& result) const;
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 void SetDefaultEncoding(Encoding encoding);
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 bool HasConfigurationChanged() const;
2941
e292798f9980 OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
228
e292798f9980 OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
229 void SetServerIndex(ServerIndex& index);
e292798f9980 OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
230
e292798f9980 OrthancConfiguration::SetServerIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
231 void ResetServerIndex();
3181
6fd38327e777 Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3138
diff changeset
232
6fd38327e777 Fix issue #130 (Orthanc failed to start when /tmp partition was full)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3138
diff changeset
233 TemporaryFile* CreateTemporaryFile() const;
3709
1f4910999fe7 Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
234
1f4910999fe7 Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
235 std::string GetDefaultPrivateCreator() const;
2933
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 };
4a38d7d4f0e0 new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 }