Mercurial > hg > orthanc-stone
comparison Resources/Graveyard/Deprecated/Applications/StoneApplicationContext.h @ 1503:553084468225
moving /Deprecated/ to /Resources/Graveyard/Deprecated/
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Jun 2020 11:38:13 +0200 |
parents | Deprecated/Applications/StoneApplicationContext.h@ff8d2e46ac63 |
children |
comparison
equal
deleted
inserted
replaced
1502:e5729dab3f67 | 1503:553084468225 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "../Framework/Deprecated/Toolbox/IWebService.h" | |
25 #include "../Framework/Deprecated/Toolbox/IDelayedCallExecutor.h" | |
26 #include "../Framework/Deprecated/Toolbox/OrthancApiClient.h" | |
27 #include "../Framework/Deprecated/Viewport/WidgetViewport.h" | |
28 | |
29 | |
30 #ifdef _MSC_VER | |
31 #if _MSC_VER > 1910 | |
32 #define orthanc_override override | |
33 #else | |
34 #define orthanc_override | |
35 #endif | |
36 #elif defined __GNUC__ | |
37 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) | |
38 /* Test for GCC > 3.2.0 */ | |
39 #if GCC_VERSION > 40900 | |
40 #define orthanc_override override | |
41 #else | |
42 #define orthanc_override | |
43 #endif | |
44 #else | |
45 #define orthanc_override | |
46 #endif | |
47 | |
48 #include <list> | |
49 | |
50 namespace OrthancStone | |
51 { | |
52 // a StoneApplicationContext contains the services that a StoneApplication | |
53 // uses and that depends on the environment in which the Application executes. | |
54 // I.e, the StoneApplicationContext provides a WebService interface such that | |
55 // the StoneApplication can perform HTTP requests. In a WASM environment, | |
56 // the WebService is provided by the browser while, in a native environment, | |
57 // the WebService is provided by the OracleWebService (a C++ Http client) | |
58 | |
59 class StoneApplicationContext : public boost::noncopyable | |
60 { | |
61 private: | |
62 boost::shared_ptr<Deprecated::IWebService> webService_; | |
63 Deprecated::IDelayedCallExecutor* delayedCallExecutor_; // TODO => shared_ptr ?? | |
64 boost::shared_ptr<Deprecated::OrthancApiClient> orthanc_; | |
65 std::string orthancBaseUrl_; | |
66 | |
67 void InitializeOrthanc(); | |
68 | |
69 public: | |
70 StoneApplicationContext() : | |
71 delayedCallExecutor_(NULL) | |
72 { | |
73 } | |
74 | |
75 virtual ~StoneApplicationContext() | |
76 { | |
77 } | |
78 | |
79 boost::shared_ptr<Deprecated::IWebService> GetWebService(); | |
80 | |
81 boost::shared_ptr<Deprecated::OrthancApiClient> GetOrthancApiClient(); | |
82 | |
83 void SetWebService(boost::shared_ptr<Deprecated::IWebService> webService); | |
84 | |
85 void SetOrthancBaseUrl(const std::string& baseUrl); | |
86 | |
87 void SetDelayedCallExecutor(Deprecated::IDelayedCallExecutor& delayedCallExecutor) | |
88 { | |
89 delayedCallExecutor_ = &delayedCallExecutor; | |
90 } | |
91 | |
92 Deprecated::IDelayedCallExecutor& GetDelayedCallExecutor() | |
93 { | |
94 return *delayedCallExecutor_; | |
95 } | |
96 }; | |
97 } |