comparison OrthancServer/OrthancInitialization.h @ 2940:4767d36679ed

refactoring access to Orthanc configuration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Nov 2018 11:47:00 +0100
parents 4a38d7d4f0e0
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2939:577786f59252 2940:4767d36679ed
31 **/ 31 **/
32 32
33 33
34 #pragma once 34 #pragma once
35 35
36 #include <string>
37 #include <set>
38 #include <json/json.h>
39 #include <stdint.h>
40
41 #include "../Core/FileStorage/IStorageArea.h" 36 #include "../Core/FileStorage/IStorageArea.h"
42 #include "../Core/HttpServer/MongooseServer.h"
43 #include "../Core/Images/FontRegistry.h"
44 #include "../Core/WebServiceParameters.h"
45 #include "../Core/DicomNetworking/RemoteModalityParameters.h"
46
47 #include "IDatabaseWrapper.h" 37 #include "IDatabaseWrapper.h"
48 #include "ServerEnumerations.h"
49
50 38
51 namespace Orthanc 39 namespace Orthanc
52 { 40 {
53 class ServerContext;
54
55 void OrthancInitialize(const char* configurationFile = NULL); 41 void OrthancInitialize(const char* configurationFile = NULL);
56 42
57 void OrthancFinalize(); 43 void OrthancFinalize();
58 44
59 class Configuration 45 IDatabaseWrapper* CreateDatabaseWrapper();
60 {
61 private:
62 Configuration(); // Forbidden, this is a static class
63 46
64 public: 47 IStorageArea* CreateStorageArea();
65 static std::string GetGlobalStringParameter(const std::string& parameter,
66 const std::string& defaultValue);
67
68 static int GetGlobalIntegerParameter(const std::string& parameter,
69 int defaultValue);
70
71 static unsigned int GetGlobalUnsignedIntegerParameter(const std::string& parameter,
72 unsigned int defaultValue);
73
74 static bool GetGlobalBoolParameter(const std::string& parameter,
75 bool defaultValue);
76
77 static void GetDicomModalityUsingSymbolicName(RemoteModalityParameters& modality,
78 const std::string& name);
79
80 static bool LookupDicomModalityUsingAETitle(RemoteModalityParameters& modality,
81 const std::string& aet);
82
83 static bool GetOrthancPeer(WebServiceParameters& peer,
84 const std::string& name);
85
86 static void GetListOfDicomModalities(std::set<std::string>& target);
87
88 static void GetListOfOrthancPeers(std::set<std::string>& target);
89
90 static void SetupRegisteredUsers(MongooseServer& httpServer);
91
92 static std::string InterpretStringParameterAsPath(const std::string& parameter);
93
94 static void GetGlobalListOfStringsParameter(std::list<std::string>& target,
95 const std::string& key);
96
97 static bool IsKnownAETitle(const std::string& aet,
98 const std::string& ip);
99
100 static bool IsSameAETitle(const std::string& aet1,
101 const std::string& aet2);
102
103 static RemoteModalityParameters GetModalityUsingSymbolicName(const std::string& name);
104
105 static RemoteModalityParameters GetModalityUsingAet(const std::string& aet);
106
107 static void UpdateModality(ServerContext& context,
108 const std::string& symbolicName,
109 const RemoteModalityParameters& modality);
110
111 static void RemoveModality(ServerContext& context,
112 const std::string& symbolicName);
113
114 static void UpdatePeer(ServerContext& context,
115 const std::string& symbolicName,
116 const WebServiceParameters& peer);
117
118 static void RemovePeer(ServerContext& context,
119 const std::string& symbolicName);
120
121 static const std::string& GetConfigurationAbsolutePath();
122
123 static IDatabaseWrapper* CreateDatabaseWrapper();
124
125 static IStorageArea* CreateStorageArea();
126
127 static void GetConfiguration(Json::Value& result);
128
129 static void FormatConfiguration(std::string& result);
130
131 static const FontRegistry& GetFontRegistry();
132
133 static void SetDefaultEncoding(Encoding encoding);
134
135 static bool HasConfigurationChanged();
136 };
137 } 48 }