annotate Framework/Oracle/WebAssemblyOracle.h @ 1213:86a8266b8888 broker

moving the scene from IViewport to ViewportController
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Dec 2019 17:54:10 +0100
parents 008dbc4ceb62
children b9f2a111c5b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
825
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #if !defined(ORTHANC_ENABLE_WASM)
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 # error The macro ORTHANC_ENABLE_WASM must be defined
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #endif
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #if ORTHANC_ENABLE_WASM != 1
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 # error This file can only compiled for WebAssembly
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #endif
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include "../Messages/IObservable.h"
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include "GetOrthancImageCommand.h"
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "GetOrthancWebViewerJpegCommand.h"
992
a9f5d0742e22 implementation of HttpCommand in WebAssemblyOracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
35 #include "HttpCommand.h"
825
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "IOracle.h"
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "OrthancRestApiCommand.h"
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace OrthancStone
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 class WebAssemblyOracle :
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 public IOracle,
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 public IObservable
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 private:
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 typedef std::map<std::string, std::string> HttpHeaders;
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 class TimeoutContext;
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 class Emitter;
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 class FetchContext;
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 class FetchCommand;
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 void Execute(const IObserver& receiver,
992
a9f5d0742e22 implementation of HttpCommand in WebAssemblyOracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
55 HttpCommand* command);
a9f5d0742e22 implementation of HttpCommand in WebAssemblyOracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
56
a9f5d0742e22 implementation of HttpCommand in WebAssemblyOracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
57 void Execute(const IObserver& receiver,
825
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 OrthancRestApiCommand* command);
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 void Execute(const IObserver& receiver,
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 GetOrthancImageCommand* command);
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 void Execute(const IObserver& receiver,
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 GetOrthancWebViewerJpegCommand* command);
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
831
d71cf8504159 handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 825
diff changeset
66 std::string orthancRoot_;
d71cf8504159 handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 825
diff changeset
67
825
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 public:
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 WebAssemblyOracle(MessageBroker& broker) :
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 IObservable(broker)
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
831
d71cf8504159 handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 825
diff changeset
73
d71cf8504159 handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 825
diff changeset
74 void SetOrthancRoot(const std::string& root)
d71cf8504159 handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 825
diff changeset
75 {
d71cf8504159 handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 825
diff changeset
76 orthancRoot_ = root;
d71cf8504159 handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 825
diff changeset
77 }
825
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
1076
008dbc4ceb62 removed LambdaCallable
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 992
diff changeset
79 virtual void Schedule(boost::shared_ptr<IObserver>& receiver,
008dbc4ceb62 removed LambdaCallable
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 992
diff changeset
80 IOracleCommand* command) ORTHANC_OVERRIDE;
825
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 };
9a6c7a5dcb76 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }