annotate Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 2988:9cc3d40e389b

Orthanc 1.4.3 is now known as 1.5.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Dec 2018 11:15:31 +0100
parents 32ec5078e32b
children c358bdb37c13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
2447
878b59270859 upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2424
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
23 *
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
2234
a78d15509a1c cleaner separation of PluginException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2231
diff changeset
36 #include "OrthancPluginException.h"
a78d15509a1c cleaner separation of PluginException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2231
diff changeset
37
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include <orthanc/OrthancCPlugin.h>
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include <boost/noncopyable.hpp>
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include <boost/lexical_cast.hpp>
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 #include <json/value.h>
2263
b9775db0fd9b OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
42 #include <list>
2266
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
43 #include <set>
2803
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
44 #include <map>
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
2269
8e53a2acdf21 convenience macro ORTHANC_PLUGINS_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2268
diff changeset
47
2424
7ef9207f31d4 New pixel formats exposed in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2269
diff changeset
48 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
49 #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
50 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
51 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
52 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
53 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
54 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
2424
7ef9207f31d4 New pixel formats exposed in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2269
diff changeset
55 #endif
7ef9207f31d4 New pixel formats exposed in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2269
diff changeset
56
2269
8e53a2acdf21 convenience macro ORTHANC_PLUGINS_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2268
diff changeset
57
8e53a2acdf21 convenience macro ORTHANC_PLUGINS_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2268
diff changeset
58 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0)
2231
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
59 // The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
60 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 1
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
61 #else
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
62 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 0
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
63 #endif
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
64
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
65
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
66 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 4, 2)
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
67 # define HAS_ORTHANC_PLUGIN_PEERS 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
68 # define HAS_ORTHANC_PLUGIN_JOB 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
69 #else
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
70 # define HAS_ORTHANC_PLUGIN_PEERS 0
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
71 # define HAS_ORTHANC_PLUGIN_JOB 0
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
72 #endif
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
73
2988
9cc3d40e389b Orthanc 1.4.3 is now known as 1.5.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2985
diff changeset
74 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
2959
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
75 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
76 #else
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
77 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
78 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
79
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
80
2231
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
81
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 namespace OrthancPlugins
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 typedef void (*RestCallback) (OrthancPluginRestOutput* output,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 const char* url,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 const OrthancPluginHttpRequest* request);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
88
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
89 void SetGlobalContext(OrthancPluginContext* context);
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
90
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
91 bool HasGlobalContext();
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
92
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
93 OrthancPluginContext* GetGlobalContext();
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
94
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
95
2849
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
96 class OrthancImage;
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
97
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
98
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 class MemoryBuffer : public boost::noncopyable
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 private:
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 OrthancPluginMemoryBuffer buffer_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
2062
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
104 void Check(OrthancPluginErrorCode code);
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
105
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
106 bool CheckHttp(OrthancPluginErrorCode code);
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
107
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
109 MemoryBuffer();
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 ~MemoryBuffer()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 OrthancPluginMemoryBuffer* operator*()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 return &buffer_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
2792
57e2d65d37ce OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
121 // This transfers ownership from "other" to "this"
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 void Assign(OrthancPluginMemoryBuffer& other);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
2792
57e2d65d37ce OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
124 OrthancPluginMemoryBuffer Release();
57e2d65d37ce OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
125
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 const char* GetData() const
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 if (buffer_.size > 0)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 return reinterpret_cast<const char*>(buffer_.data);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 else
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 return NULL;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 size_t GetSize() const
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 return buffer_.size;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
2973
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
143 bool IsEmpty() const
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
144 {
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
145 return GetSize() == 0 || GetData() == NULL;
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
146 }
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
147
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 void Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 void ToString(std::string& target) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 void ToJson(Json::Value& target) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 bool RestApiGet(const std::string& uri,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 bool applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 bool RestApiPost(const std::string& uri,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 const char* body,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 size_t bodySize,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 bool applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 bool RestApiPut(const std::string& uri,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 const char* body,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 size_t bodySize,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 bool applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 bool RestApiPost(const std::string& uri,
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
168 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
169 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
170
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
171 bool RestApiPut(const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
172 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
173 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
174
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
175 bool RestApiPost(const std::string& uri,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 const std::string& body,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 bool applyPlugins)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 return RestApiPost(uri, body.empty() ? NULL : body.c_str(), body.size(), applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 bool RestApiPut(const std::string& uri,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 const std::string& body,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 bool applyPlugins)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 return RestApiPut(uri, body.empty() ? NULL : body.c_str(), body.size(), applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 }
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2058
diff changeset
188
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2058
diff changeset
189 void CreateDicom(const Json::Value& tags,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2058
diff changeset
190 OrthancPluginCreateDicomFlags flags);
2062
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
191
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
192 void CreateDicom(const Json::Value& tags,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
193 const OrthancImage& pixelData,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
194 OrthancPluginCreateDicomFlags flags);
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
195
2062
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
196 void ReadFile(const std::string& path);
2205
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
197
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
198 void GetDicomQuery(const OrthancPluginWorklistQuery* query);
2206
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
199
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
200 void DicomToJson(Json::Value& target,
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
201 OrthancPluginDicomToJsonFormat format,
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
202 OrthancPluginDicomToJsonFlags flags,
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
203 uint32_t maxStringLength);
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
204
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
205 bool HttpGet(const std::string& url,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
206 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
207 const std::string& password);
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
208
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
209 bool HttpPost(const std::string& url,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
210 const std::string& body,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
211 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
212 const std::string& password);
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
213
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
214 bool HttpPut(const std::string& url,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
215 const std::string& body,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
216 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
217 const std::string& password);
2796
4df3c64402ba MemoryBuffer::GetDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2792
diff changeset
218
4df3c64402ba MemoryBuffer::GetDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2792
diff changeset
219 void GetDicomInstance(const std::string& instanceId);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 };
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 class OrthancString : public boost::noncopyable
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 private:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
226 char* str_;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227
2205
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
228 void Clear();
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
229
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
231 OrthancString() :
2205
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
232 str_(NULL)
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
233 {
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
234 }
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 ~OrthancString()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
2206
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
241 // This transfers ownership, warning: The string must have been
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
242 // allocated by the Orthanc core
2205
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
243 void Assign(char* str);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 const char* GetContent() const
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 return str_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 void ToString(std::string& target) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 void ToJson(Json::Value& target) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 };
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 class OrthancConfiguration : public boost::noncopyable
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 private:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
259 Json::Value configuration_; // Necessarily a Json::objectValue
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
260 std::string path_;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 std::string GetPath(const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
265 OrthancConfiguration();
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 const Json::Value& GetJson() const
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 return configuration_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271
2167
aa2915963531 "Folders" sub-configuration in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2109
diff changeset
272 bool IsSection(const std::string& key) const;
aa2915963531 "Folders" sub-configuration in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2109
diff changeset
273
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 void GetSection(OrthancConfiguration& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 bool LookupStringValue(std::string& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 bool LookupIntegerValue(int& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 bool LookupUnsignedIntegerValue(unsigned int& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 bool LookupBooleanValue(bool& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 bool LookupFloatValue(float& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
2263
b9775db0fd9b OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
292 bool LookupListOfStrings(std::list<std::string>& target,
2265
e46b0ee6c19d allowSingleString in OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2264
diff changeset
293 const std::string& key,
e46b0ee6c19d allowSingleString in OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2264
diff changeset
294 bool allowSingleString) const;
2263
b9775db0fd9b OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
295
2266
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
296 bool LookupSetOfStrings(std::set<std::string>& target,
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
297 const std::string& key,
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
298 bool allowSingleString) const;
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
299
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 std::string GetStringValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 const std::string& defaultValue) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 int GetIntegerValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 int defaultValue) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 unsigned int GetUnsignedIntegerValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 unsigned int defaultValue) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 bool GetBooleanValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 bool defaultValue) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 float GetFloatValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 float defaultValue) const;
2803
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
314
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
315 void GetDictionary(std::map<std::string, std::string>& target,
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
316 const std::string& key) const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 };
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
319 class OrthancImage : public boost::noncopyable
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 private:
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 OrthancPluginImage* image_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 void Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 void CheckImageAvailable();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
329 OrthancImage();
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
331 OrthancImage(OrthancPluginImage* image);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
333 OrthancImage(OrthancPluginPixelFormat format,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 uint32_t width,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 uint32_t height);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
337 OrthancImage(OrthancPluginPixelFormat format,
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
338 uint32_t width,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
339 uint32_t height,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
340 uint32_t pitch,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
341 void* buffer
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
342 );
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
343
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 ~OrthancImage()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 void UncompressPngImage(const void* data,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 size_t size);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 void UncompressJpegImage(const void* data,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 size_t size);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 void DecodeDicomImage(const void* data,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 size_t size,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 unsigned int frame);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 OrthancPluginPixelFormat GetPixelFormat();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 unsigned int GetWidth();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 unsigned int GetHeight();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 unsigned int GetPitch();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 const void* GetBuffer();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368
2849
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
369 const OrthancPluginImage* GetObject() const
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
370 {
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
371 return image_;
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
372 }
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
373
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 void CompressPngImage(MemoryBuffer& target);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 void CompressJpegImage(MemoryBuffer& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 uint8_t quality);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 void AnswerPngImage(OrthancPluginRestOutput* output);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 void AnswerJpegImage(OrthancPluginRestOutput* output,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 uint8_t quality);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 };
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385
2231
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
386 #if HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
387 class FindMatcher : public boost::noncopyable
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
388 {
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
389 private:
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
390 OrthancPluginFindMatcher* matcher_;
2213
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
391 const OrthancPluginWorklistQuery* worklist_;
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
392
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
393 void SetupDicom(const void* query,
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
394 uint32_t size);
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
395
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
396 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
397 FindMatcher(const OrthancPluginWorklistQuery* worklist);
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
398
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
399 FindMatcher(const void* query,
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
400 uint32_t size)
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
401 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
402 SetupDicom(query, size);
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
403 }
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
404
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
405 FindMatcher(const MemoryBuffer& dicom)
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
406 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
407 SetupDicom(dicom.GetData(), dicom.GetSize());
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
408 }
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
409
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
410 ~FindMatcher();
2213
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
411
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
412 bool IsMatch(const void* dicom,
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
413 uint32_t size) const;
2214
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
414
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
415 bool IsMatch(const MemoryBuffer& dicom) const
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
416 {
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
417 return IsMatch(dicom.GetData(), dicom.GetSize());
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
418 }
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
419 };
2231
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
420 #endif
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
421
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
422
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
423 bool RestApiGet(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
424 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
425 bool applyPlugins);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
427 bool RestApiGetString(std::string& result,
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
428 const std::string& uri,
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
429 bool applyPlugins);
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
430
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
431 bool RestApiPost(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
432 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
433 const char* body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
434 size_t bodySize,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
435 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
436
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
437 bool RestApiPost(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
438 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
439 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
440 bool applyPlugins);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
442 inline bool RestApiPost(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
443 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
444 const std::string& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
445 bool applyPlugins)
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
446 {
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
447 return RestApiPost(result, uri, body.empty() ? NULL : body.c_str(),
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
448 body.size(), applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
449 }
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450
2973
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
451 inline bool RestApiPost(Json::Value& result,
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
452 const std::string& uri,
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
453 const MemoryBuffer& body,
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
454 bool applyPlugins)
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
455 {
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
456 return RestApiPost(result, uri, body.GetData(),
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
457 body.GetSize(), applyPlugins);
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
458 }
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
459
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
460 bool RestApiPut(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
461 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
462 const char* body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
463 size_t bodySize,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
464 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
465
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
466 bool RestApiPut(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
467 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
468 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
469 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
470
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
471 inline bool RestApiPut(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
472 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
473 const std::string& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
474 bool applyPlugins)
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 {
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
476 return RestApiPut(result, uri, body.empty() ? NULL : body.c_str(),
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
477 body.size(), applyPlugins);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
480 bool RestApiDelete(const std::string& uri,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 bool applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
483 bool HttpDelete(const std::string& url,
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
484 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
485 const std::string& password);
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
486
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
487 void AnswerJson(const Json::Value& value,
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
488 OrthancPluginRestOutput* output);
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
489
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
490 void AnswerHttpError(uint16_t httpError,
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
491 OrthancPluginRestOutput* output);
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
492
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
493 void AnswerMethodNotAllowed(OrthancPluginRestOutput* output, const char* allowedMethods);
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
494
2988
9cc3d40e389b Orthanc 1.4.3 is now known as 1.5.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2985
diff changeset
495 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
2984
db8f360fcb41 OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2979
diff changeset
496 const char* AutodetectMimeType(const std::string& path);
2985
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2984
diff changeset
497 #endif
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
498
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
499 void LogError(const std::string& message);
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
500
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
501 void LogWarning(const std::string& message);
2057
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2056
diff changeset
502
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
503 void LogInfo(const std::string& message);
2057
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2056
diff changeset
504
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
505 void ReportMinimalOrthancVersion(unsigned int major,
2268
ce5c13b95dac New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2266
diff changeset
506 unsigned int minor,
ce5c13b95dac New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2266
diff changeset
507 unsigned int revision);
ce5c13b95dac New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2266
diff changeset
508
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
509 bool CheckMinimalOrthancVersion(unsigned int major,
2109
d5c29fd74ffa OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2062
diff changeset
510 unsigned int minor,
d5c29fd74ffa OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2062
diff changeset
511 unsigned int revision);
d5c29fd74ffa OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2062
diff changeset
512
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 namespace Internals
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516 template <RestCallback Callback>
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 OrthancPluginErrorCode Protect(OrthancPluginRestOutput* output,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 const char* url,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 const OrthancPluginHttpRequest* request)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 try
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 Callback(output, url, request);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 return OrthancPluginErrorCode_Success;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 }
2239
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2234
diff changeset
526 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 {
2959
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
528 #if HAS_ORTHANC_EXCEPTION == 1 && HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS == 1
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
529 if (HasGlobalContext() &&
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
530 e.HasDetails())
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
531 {
2961
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
532 // The "false" instructs Orthanc not to log the detailed
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
533 // error message. This is to avoid duplicating the details,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
534 // because "OrthancException" already does it on construction.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
535 OrthancPluginSetHttpErrorDetails
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
536 (GetGlobalContext(), output, e.GetDetails(), false);
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
537 }
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
538 #endif
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
539
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 }
2056
e166a902b3c4 removal of warnings in msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2047
diff changeset
542 catch (boost::bad_lexical_cast&)
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 return OrthancPluginErrorCode_BadFileFormat;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 catch (...)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 return OrthancPluginErrorCode_Plugin;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 template <RestCallback Callback>
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
555 void RegisterRestCallback(const std::string& uri,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 bool isThreadSafe)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 if (isThreadSafe)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
560 OrthancPluginRegisterRestCallbackNoLock
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
561 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 else
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
565 OrthancPluginRegisterRestCallback
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
566 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 }
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
569
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
570
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
571 #if HAS_ORTHANC_PLUGIN_PEERS == 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
572 class OrthancPeers : public boost::noncopyable
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
573 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
574 private:
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
575 typedef std::map<std::string, uint32_t> Index;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
576
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
577 OrthancPluginPeers *peers_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
578 Index index_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
579 uint32_t timeout_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
580
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
581 size_t GetPeerIndex(const std::string& name) const;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
582
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
583 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
584 OrthancPeers();
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
585
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
586 ~OrthancPeers();
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
587
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
588 uint32_t GetTimeout() const
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
589 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
590 return timeout_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
591 }
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
592
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
593 void SetTimeout(uint32_t timeout)
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
594 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
595 timeout_ = timeout;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
596 }
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
597
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
598 bool LookupName(size_t& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
599 const std::string& name) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
600
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
601 std::string GetPeerName(size_t index) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
602
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
603 std::string GetPeerUrl(size_t index) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
604
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
605 std::string GetPeerUrl(const std::string& name) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
606
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
607 size_t GetPeersCount() const
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
608 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
609 return index_.size();
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
610 }
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
611
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
612 bool LookupUserProperty(std::string& value,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
613 size_t index,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
614 const std::string& key) const;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
615
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
616 bool LookupUserProperty(std::string& value,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
617 const std::string& peer,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
618 const std::string& key) const;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
619
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
620 bool DoGet(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
621 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
622 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
623
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
624 bool DoGet(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
625 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
626 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
627
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
628 bool DoGet(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
629 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
630 const std::string& uri) const;
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
631
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
632 bool DoGet(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
633 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
634 const std::string& uri) const;
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
635
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
636 bool DoPost(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
637 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
638 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
639 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
640
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
641 bool DoPost(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
642 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
643 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
644 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
645
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
646 bool DoPost(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
647 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
648 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
649 const std::string& body) const;
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
650
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
651 bool DoPost(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
652 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
653 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
654 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
655
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
656 bool DoPut(size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
657 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
658 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
659
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
660 bool DoPut(const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
661 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
662 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
663
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
664 bool DoDelete(size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
665 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
666
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
667 bool DoDelete(const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
668 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
669 };
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
670 #endif
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
671
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
672
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
673
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
674 #if HAS_ORTHANC_PLUGIN_JOB == 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
675 class OrthancJob : public boost::noncopyable
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
676 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
677 private:
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
678 std::string jobType_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
679 std::string content_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
680 bool hasSerialized_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
681 std::string serialized_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
682 float progress_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
683
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
684 static void CallbackFinalize(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
685
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
686 static float CallbackGetProgress(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
687
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
688 static const char* CallbackGetContent(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
689
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
690 static const char* CallbackGetSerialized(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
691
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
692 static OrthancPluginJobStepStatus CallbackStep(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
693
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
694 static OrthancPluginErrorCode CallbackStop(void* job,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
695 OrthancPluginJobStopReason reason);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
696
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
697 static OrthancPluginErrorCode CallbackReset(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
698
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
699 protected:
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
700 void ClearContent();
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
701
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
702 void UpdateContent(const Json::Value& content);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
703
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
704 void ClearSerialized();
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
705
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
706 void UpdateSerialized(const Json::Value& serialized);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
707
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
708 void UpdateProgress(float progress);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
709
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
710 public:
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
711 OrthancJob(const std::string& jobType);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
712
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
713 virtual ~OrthancJob()
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
714 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
715 }
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
716
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
717 virtual OrthancPluginJobStepStatus Step() = 0;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
718
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
719 virtual void Stop(OrthancPluginJobStopReason reason) = 0;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
720
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
721 virtual void Reset() = 0;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
722
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
723 static OrthancPluginJob* Create(OrthancJob* job /* takes ownership */);
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
724
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
725 static std::string Submit(OrthancJob* job /* takes ownership */,
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
726 int priority);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
727 };
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
728 #endif
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 }