Mercurial > hg > orthanc-stone
annotate Platforms/Generic/OracleWebService.h @ 277:a38465cc909f am-2
Qt: refresh ok + mouse interaction ok
author | am@osimis.io |
---|---|
date | Mon, 27 Aug 2018 14:41:49 +0200 |
parents | dc1beee33134 |
children | 8c8da145fefa |
rev | line source |
---|---|
80 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
80
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
80 | 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/Toolbox/IWebService.h" | |
25 #include "Oracle.h" | |
26 #include "WebServiceGetCommand.h" | |
27 #include "WebServicePostCommand.h" | |
274
dc1beee33134
split SdlApplication into NativeApplication and SdlApplication
am@osimis.io
parents:
271
diff
changeset
|
28 #include "../../Applications/Generic/BasicNativeApplicationContext.h" |
80 | 29 |
30 namespace OrthancStone | |
31 { | |
32 class OracleWebService : public IWebService | |
33 { | |
34 private: | |
35 Oracle& oracle_; | |
274
dc1beee33134
split SdlApplication into NativeApplication and SdlApplication
am@osimis.io
parents:
271
diff
changeset
|
36 BasicNativeApplicationContext& context_; |
80 | 37 Orthanc::WebServiceParameters parameters_; |
38 | |
39 public: | |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
244
diff
changeset
|
40 OracleWebService(MessageBroker& broker, |
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
244
diff
changeset
|
41 Oracle& oracle, |
271
46c5296d867e
OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents:
257
diff
changeset
|
42 const Orthanc::WebServiceParameters& parameters, |
274
dc1beee33134
split SdlApplication into NativeApplication and SdlApplication
am@osimis.io
parents:
271
diff
changeset
|
43 BasicNativeApplicationContext& context) : |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
244
diff
changeset
|
44 IWebService(broker), |
80 | 45 oracle_(oracle), |
271
46c5296d867e
OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents:
257
diff
changeset
|
46 context_(context), |
80 | 47 parameters_(parameters) |
48 { | |
49 } | |
50 | |
51 virtual void ScheduleGetRequest(ICallback& callback, | |
52 const std::string& uri, | |
257 | 53 const Headers& headers, |
80 | 54 Orthanc::IDynamicObject* payload) |
55 { | |
271
46c5296d867e
OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents:
257
diff
changeset
|
56 oracle_.Submit(new WebServiceGetCommand(broker_, callback, parameters_, uri, headers, payload, context_)); |
80 | 57 } |
58 | |
59 virtual void SchedulePostRequest(ICallback& callback, | |
60 const std::string& uri, | |
257 | 61 const Headers& headers, |
80 | 62 const std::string& body, |
63 Orthanc::IDynamicObject* payload) | |
64 { | |
271
46c5296d867e
OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents:
257
diff
changeset
|
65 oracle_.Submit(new WebServicePostCommand(broker_, callback, parameters_, uri, headers, body, payload, context_)); |
80 | 66 } |
242 | 67 |
68 void Start() | |
69 { | |
70 oracle_.Start(); | |
71 } | |
72 | |
73 void Stop() | |
74 { | |
244 | 75 oracle_.Stop(); |
242 | 76 } |
80 | 77 }; |
78 } |