annotate Framework/Oracle/GetOrthancWebViewerJpegCommand.h @ 1145:4f99c7905f8d broker

mingw qt
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 Nov 2019 18:28:46 +0100
parents a0a33e5ea5bb
children 0ca50d275b9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
24 #include "../Messages/IMessageEmitter.h"
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
25 #include "OracleCommandBase.h"
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <Core/Images/ImageAccessor.h>
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <map>
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace OrthancStone
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
33 class GetOrthancWebViewerJpegCommand : public OracleCommandBase
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 public:
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 typedef std::map<std::string, std::string> HttpHeaders;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
38 class SuccessMessage : public OriginMessage<GetOrthancWebViewerJpegCommand>
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 private:
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
43 const Orthanc::ImageAccessor& image_;
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 public:
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
46 SuccessMessage(const GetOrthancWebViewerJpegCommand& command,
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
47 const Orthanc::ImageAccessor& image) :
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
48 OriginMessage(command),
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
49 image_(image)
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
50 {
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
51 }
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 const Orthanc::ImageAccessor& GetImage() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
55 return image_;
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 };
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 private:
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 std::string instanceId_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 unsigned int frame_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 unsigned int quality_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 HttpHeaders headers_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 unsigned int timeout_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 Orthanc::PixelFormat expectedFormat_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
67 GetOrthancWebViewerJpegCommand(const GetOrthancWebViewerJpegCommand& other) :
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
68 instanceId_(other.instanceId_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
69 frame_(other.frame_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
70 quality_(other.quality_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
71 headers_(other.headers_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
72 timeout_(other.timeout_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
73 expectedFormat_(other.expectedFormat_)
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
74 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
75 }
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
76
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 public:
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 GetOrthancWebViewerJpegCommand();
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 virtual Type GetType() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 return Type_GetOrthancWebViewerJpeg;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
85 virtual IOracleCommand* Clone() const
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
86 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
87 return new GetOrthancWebViewerJpegCommand(*this);
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
88 }
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
89
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 void SetExpectedPixelFormat(Orthanc::PixelFormat format)
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 expectedFormat_ = format;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 void SetInstance(const std::string& instanceId)
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 instanceId_ = instanceId;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 void SetFrame(unsigned int frame)
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 frame_ = frame;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 void SetQuality(unsigned int quality);
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 void SetHttpHeader(const std::string& key,
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 const std::string& value)
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 headers_[key] = value;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 Orthanc::PixelFormat GetExpectedPixelFormat() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 return expectedFormat_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 const std::string& GetInstanceId() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 return instanceId_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 unsigned int GetFrame() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 return frame_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 unsigned int GetQuality() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 return quality_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 const HttpHeaders& GetHttpHeaders() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 return headers_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 void SetTimeout(unsigned int seconds)
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 timeout_ = seconds;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 unsigned int GetTimeout() const
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 {
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 return timeout_;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 }
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 std::string GetUri() const;
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
150 void ProcessHttpAnswer(boost::weak_ptr<IObserver> receiver,
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
151 IMessageEmitter& emitter,
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
152 const std::string& answer) const;
746
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 };
d716bfb3e07c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 }