annotate OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 4991:3cdda1cec537

fix
author Alain Mazy <am@osimis.io>
date Sun, 01 May 2022 12:38:52 +0200
parents 501411a67f10
children 8c9a1cce076e
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
4870
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * 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
9 * 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
10 * 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
11 * License, or (at your option) any later version.
4122
4bb7522a63e0 do not enforce openssl exception in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 *
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * 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
16 * General Public License for more details.
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * 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
19 * 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
20 **/
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
2234
a78d15509a1c cleaner separation of PluginException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2231
diff changeset
25 #include "OrthancPluginException.h"
a78d15509a1c cleaner separation of PluginException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2231
diff changeset
26
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <orthanc/OrthancCPlugin.h>
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <boost/noncopyable.hpp>
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <boost/lexical_cast.hpp>
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
30 #include <boost/date_time/posix_time/posix_time.hpp>
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <json/value.h>
3026
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
32 #include <vector>
2263
b9775db0fd9b OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
33 #include <list>
2266
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
34 #include <set>
2803
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
35 #include <map>
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
2269
8e53a2acdf21 convenience macro ORTHANC_PLUGINS_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2268
diff changeset
38
3914
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3796
diff changeset
39 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3796
diff changeset
40 * The definition of ORTHANC_PLUGINS_VERSION_IS_ABOVE below is for
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3796
diff changeset
41 * backward compatibility with Orthanc SDK <= 1.3.0.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3796
diff changeset
42 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3796
diff changeset
43 * $ hg diff -r Orthanc-1.3.0:Orthanc-1.3.1 ../../../Plugins/Include/orthanc/OrthancCPlugin.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3796
diff changeset
44 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3796
diff changeset
45 **/
2424
7ef9207f31d4 New pixel formats exposed in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2269
diff changeset
46 #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
47 #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
48 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
49 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
50 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
51 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
52 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
53 #endif
7ef9207f31d4 New pixel formats exposed in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2269
diff changeset
54
2269
8e53a2acdf21 convenience macro ORTHANC_PLUGINS_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2268
diff changeset
55
4019
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
56 #if !defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE)
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
57 #define ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(major, minor, revision) \
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
58 (ORTHANC_VERSION_MAJOR > major || \
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
59 (ORTHANC_VERSION_MAJOR == major && \
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
60 (ORTHANC_VERSION_MINOR > minor || \
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
61 (ORTHANC_VERSION_MINOR == minor && \
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
62 ORTHANC_VERSION_REVISION >= revision))))
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
63 #endif
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
64
bf35c4628777 macro ORTHANC_FRAMEWORK_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
65
2269
8e53a2acdf21 convenience macro ORTHANC_PLUGINS_VERSION_IS_ABOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2268
diff changeset
66 #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
67 // 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
68 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 1
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
69 #else
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
70 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 0
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
71 #endif
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
72
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
73
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
74 #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
75 # define HAS_ORTHANC_PLUGIN_PEERS 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
76 # define HAS_ORTHANC_PLUGIN_JOB 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
77 #else
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
78 # define HAS_ORTHANC_PLUGIN_PEERS 0
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
79 # define HAS_ORTHANC_PLUGIN_JOB 0
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
80 #endif
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
81
2988
9cc3d40e389b Orthanc 1.4.3 is now known as 1.5.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2985
diff changeset
82 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
2959
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
83 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
84 #else
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
85 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
86 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
87
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
88 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4)
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
89 # define HAS_ORTHANC_PLUGIN_METRICS 1
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
90 #else
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
91 # define HAS_ORTHANC_PLUGIN_METRICS 0
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
92 #endif
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
93
3388
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
94 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 1, 0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
95 # define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
96 #else
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
97 # define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
98 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
99
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
100 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7)
3413
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3410
diff changeset
101 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 1
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
102 #else
3413
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3410
diff changeset
103 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 0
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
104 #endif
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
105
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
106 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7)
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
107 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER 1
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
108 #else
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
109 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER 0
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
110 #endif
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
111
3664
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
112 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 0)
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
113 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 1
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
114 #else
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
115 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 0
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
116 #endif
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
117
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
118 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 10, 1)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
119 # define HAS_ORTHANC_PLUGIN_WEBDAV 1
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
120 #else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
121 # define HAS_ORTHANC_PLUGIN_WEBDAV 0
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
122 #endif
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
123
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
124
2231
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
125
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 namespace OrthancPlugins
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 typedef void (*RestCallback) (OrthancPluginRestOutput* output,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 const char* url,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 const OrthancPluginHttpRequest* request);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
132 void SetGlobalContext(OrthancPluginContext* context);
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
133
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
134 bool HasGlobalContext();
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
135
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
136 OrthancPluginContext* GetGlobalContext();
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
137
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
138
2849
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
139 class OrthancImage;
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
140
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
141
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 class MemoryBuffer : public boost::noncopyable
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 private:
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 OrthancPluginMemoryBuffer buffer_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
2062
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
147 void Check(OrthancPluginErrorCode code);
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
148
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
149 bool CheckHttp(OrthancPluginErrorCode code);
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
150
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
152 MemoryBuffer();
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
3934
0b59e2706366 guard on SDK version in OrthancPlugins::MemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3930
diff changeset
154 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
0b59e2706366 guard on SDK version in OrthancPlugins::MemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3930
diff changeset
155 // This constructor makes a copy of the given buffer in the memory
0b59e2706366 guard on SDK version in OrthancPlugins::MemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3930
diff changeset
156 // handled by the Orthanc core
3930
b99acc213937 transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3919
diff changeset
157 MemoryBuffer(const void* buffer,
b99acc213937 transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3919
diff changeset
158 size_t size);
3934
0b59e2706366 guard on SDK version in OrthancPlugins::MemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3930
diff changeset
159 #endif
3930
b99acc213937 transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3919
diff changeset
160
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 ~MemoryBuffer()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 OrthancPluginMemoryBuffer* operator*()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 return &buffer_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
2792
57e2d65d37ce OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
171 // This transfers ownership from "other" to "this"
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 void Assign(OrthancPluginMemoryBuffer& other);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
3320
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3236
diff changeset
174 void Swap(MemoryBuffer& other);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3236
diff changeset
175
2792
57e2d65d37ce OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
176 OrthancPluginMemoryBuffer Release();
57e2d65d37ce OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
177
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 const char* GetData() const
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 if (buffer_.size > 0)
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 return reinterpret_cast<const char*>(buffer_.data);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 else
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 NULL;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 size_t GetSize() const
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 return buffer_.size;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194
2973
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
195 bool IsEmpty() const
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
196 {
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
197 return GetSize() == 0 || GetData() == NULL;
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
198 }
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
199
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 void Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 void ToString(std::string& target) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 void ToJson(Json::Value& target) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 bool RestApiGet(const std::string& uri,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 bool applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208
3026
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
209 bool RestApiGet(const std::string& uri,
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
210 const std::map<std::string, std::string>& httpHeaders,
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
211 bool applyPlugins);
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
212
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 bool RestApiPost(const std::string& uri,
3400
0faae6f6e3c5 fixed some inconsistencies with pointer types in the plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3399
diff changeset
214 const void* body,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 size_t bodySize,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 bool applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 bool RestApiPut(const std::string& uri,
3400
0faae6f6e3c5 fixed some inconsistencies with pointer types in the plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3399
diff changeset
219 const void* body,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 size_t bodySize,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 bool applyPlugins);
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 bool RestApiPost(const std::string& uri,
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
224 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
225 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
226
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
227 bool RestApiPut(const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
228 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
229 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
230
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
231 bool RestApiPost(const std::string& uri,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 const std::string& body,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 bool applyPlugins)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 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
236 }
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 bool RestApiPut(const std::string& uri,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 const std::string& body,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 bool applyPlugins)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 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
243 }
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2058
diff changeset
244
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2058
diff changeset
245 void CreateDicom(const Json::Value& tags,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2058
diff changeset
246 OrthancPluginCreateDicomFlags flags);
2062
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
247
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
248 void CreateDicom(const Json::Value& tags,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
249 const OrthancImage& pixelData,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
250 OrthancPluginCreateDicomFlags flags);
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
251
2062
40ffd0e8676a generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2060
diff changeset
252 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
253
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
254 void GetDicomQuery(const OrthancPluginWorklistQuery* query);
2206
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
255
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
256 void DicomToJson(Json::Value& target,
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
257 OrthancPluginDicomToJsonFormat format,
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
258 OrthancPluginDicomToJsonFlags flags,
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
259 uint32_t maxStringLength);
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
260
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
261 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
262 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
263 const std::string& password);
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
264
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
265 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
266 const std::string& body,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
267 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
268 const std::string& password);
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
269
2264
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
270 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
271 const std::string& body,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
272 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
273 const std::string& password);
2796
4df3c64402ba MemoryBuffer::GetDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2792
diff changeset
274
4df3c64402ba MemoryBuffer::GetDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2792
diff changeset
275 void GetDicomInstance(const std::string& instanceId);
2047
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
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 class OrthancString : public boost::noncopyable
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 private:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
282 char* str_;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283
2205
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
284 void Clear();
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
285
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
287 OrthancString() :
2205
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
288 str_(NULL)
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
289 {
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
290 }
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 ~OrthancString()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296
2206
27106f7e3759 more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2205
diff changeset
297 // 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
298 // allocated by the Orthanc core
2205
395522e46b2b refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2183
diff changeset
299 void Assign(char* str);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 const char* GetContent() 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 return str_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
306 bool IsNullOrEmpty() const
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
307 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
308 return str_ == NULL || str_[0] == 0;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
309 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
310
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 void ToString(std::string& target) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 void ToJson(Json::Value& target) const;
4925
8785d8442f90 skip json comments when loading config
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
314
8785d8442f90 skip json comments when loading config
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
315 void ToJsonWithoutComments(Json::Value& target) const;
8785d8442f90 skip json comments when loading config
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
316 };
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
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 class OrthancConfiguration : public boost::noncopyable
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:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
322 Json::Value configuration_; // Necessarily a Json::objectValue
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
323 std::string path_;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 std::string GetPath(const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326
3421
decbede6e3ad OrthancPlugins::OrthancConfiguration(bool)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3420
diff changeset
327 void LoadConfiguration();
decbede6e3ad OrthancPlugins::OrthancConfiguration(bool)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3420
diff changeset
328
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
330 OrthancConfiguration();
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
3796
daa1bc6700bf cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3668
diff changeset
332 explicit OrthancConfiguration(bool load);
3421
decbede6e3ad OrthancPlugins::OrthancConfiguration(bool)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3420
diff changeset
333
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 const Json::Value& GetJson() const
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 return configuration_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338
2167
aa2915963531 "Folders" sub-configuration in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2109
diff changeset
339 bool IsSection(const std::string& key) const;
aa2915963531 "Folders" sub-configuration in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2109
diff changeset
340
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 void GetSection(OrthancConfiguration& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 bool LookupStringValue(std::string& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 bool LookupIntegerValue(int& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 bool LookupUnsignedIntegerValue(unsigned int& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 bool LookupBooleanValue(bool& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 bool LookupFloatValue(float& target,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 const std::string& key) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358
2263
b9775db0fd9b OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
359 bool LookupListOfStrings(std::list<std::string>& target,
2265
e46b0ee6c19d allowSingleString in OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2264
diff changeset
360 const std::string& key,
e46b0ee6c19d allowSingleString in OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2264
diff changeset
361 bool allowSingleString) const;
2263
b9775db0fd9b OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
362
2266
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
363 bool LookupSetOfStrings(std::set<std::string>& target,
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
364 const std::string& key,
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
365 bool allowSingleString) const;
a344e47e9c9a OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2265
diff changeset
366
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 std::string GetStringValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 const std::string& defaultValue) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 int GetIntegerValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 int defaultValue) const;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 unsigned int GetUnsignedIntegerValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 unsigned int defaultValue) const;
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 bool GetBooleanValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 bool defaultValue) const;
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 float GetFloatValue(const std::string& key,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 float defaultValue) const;
2803
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
381
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
382 void GetDictionary(std::map<std::string, std::string>& target,
579acc5e5412 OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2796
diff changeset
383 const std::string& key) const;
2047
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
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
386 class OrthancImage : public boost::noncopyable
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 private:
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 OrthancPluginImage* image_;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 void Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
393 void CheckImageAvailable() const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
396 OrthancImage();
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397
3796
daa1bc6700bf cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3668
diff changeset
398 explicit OrthancImage(OrthancPluginImage* image);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
400 OrthancImage(OrthancPluginPixelFormat format,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 uint32_t width,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 uint32_t height);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
404 OrthancImage(OrthancPluginPixelFormat format,
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
405 uint32_t width,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
406 uint32_t height,
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
407 uint32_t pitch,
3916
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
408 void* buffer);
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
409
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 ~OrthancImage()
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 Clear();
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 void UncompressPngImage(const void* data,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 size_t size);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 void UncompressJpegImage(const void* data,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 size_t size);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 void DecodeDicomImage(const void* data,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 size_t size,
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 unsigned int frame);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
425 OrthancPluginPixelFormat GetPixelFormat() const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
427 unsigned int GetWidth() const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
429 unsigned int GetHeight() const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
431 unsigned int GetPitch() const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432
3915
7e33516965f8 merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3914
diff changeset
433 void* GetBuffer() const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434
2849
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
435 const OrthancPluginImage* GetObject() const
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
436 {
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
437 return image_;
c67b5d80b758 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2848
diff changeset
438 }
2848
dd3914a44b87 added accessors in C++ wrappers
am@osimis.io
parents: 2823
diff changeset
439
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
440 void CompressPngImage(MemoryBuffer& target) const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 void CompressJpegImage(MemoryBuffer& target,
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
443 uint8_t quality) const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
445 void AnswerPngImage(OrthancPluginRestOutput* output) const;
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 void AnswerJpegImage(OrthancPluginRestOutput* output,
3236
872efde28e58 more constness
Alain Mazy <alain@mazy.be>
parents: 3179
diff changeset
448 uint8_t quality) const;
3915
7e33516965f8 merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3914
diff changeset
449
7e33516965f8 merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3914
diff changeset
450 void* GetWriteableBuffer();
7e33516965f8 merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3914
diff changeset
451
7e33516965f8 merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3914
diff changeset
452 OrthancPluginImage* Release();
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 };
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455
2231
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
456 #if HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
457 class FindMatcher : public boost::noncopyable
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
458 {
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
459 private:
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
460 OrthancPluginFindMatcher* matcher_;
2213
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
461 const OrthancPluginWorklistQuery* worklist_;
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
462
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
463 void SetupDicom(const void* query,
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
464 uint32_t size);
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
465
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
466 public:
3796
daa1bc6700bf cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3668
diff changeset
467 explicit FindMatcher(const OrthancPluginWorklistQuery* worklist);
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
468
3796
daa1bc6700bf cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3668
diff changeset
469 FindMatcher(const void* query,
daa1bc6700bf cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3668
diff changeset
470 uint32_t size)
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
471 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
472 SetupDicom(query, size);
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
473 }
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
474
3796
daa1bc6700bf cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3668
diff changeset
475 explicit FindMatcher(const MemoryBuffer& dicom)
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
476 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
477 SetupDicom(dicom.GetData(), dicom.GetSize());
2215
028214a95194 refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2214
diff changeset
478 }
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
479
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
480 ~FindMatcher();
2213
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
481
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
482 bool IsMatch(const void* dicom,
95d1d758abb7 FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2212
diff changeset
483 uint32_t size) const;
2214
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
484
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
485 bool IsMatch(const MemoryBuffer& dicom) const
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
486 {
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
487 return IsMatch(dicom.GetData(), dicom.GetSize());
b1d93286b315 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2213
diff changeset
488 }
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
489 };
2231
61e0564d03bb backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2215
diff changeset
490 #endif
2212
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
491
c02f6ec404d8 OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2206
diff changeset
492
4394
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
493 bool ReadJson(Json::Value& target,
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
494 const std::string& source);
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
495
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
496 bool ReadJson(Json::Value& target,
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
497 const void* buffer,
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
498 size_t size);
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
499
4444
11ea0a05115b new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
500 bool ReadJsonWithoutComments(Json::Value& target,
11ea0a05115b new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
501 const std::string& source);
11ea0a05115b new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
502
11ea0a05115b new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
503 bool ReadJsonWithoutComments(Json::Value& target,
11ea0a05115b new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
504 const void* buffer,
11ea0a05115b new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
505 size_t size);
11ea0a05115b new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
506
4394
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
507 void WriteFastJson(std::string& target,
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
508 const Json::Value& source);
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
509
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
510 void WriteStyledJson(std::string& target,
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
511 const Json::Value& source);
f7104e9d044c functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4256
diff changeset
512
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
513 bool RestApiGet(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
514 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
515 bool applyPlugins);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
517 bool RestApiGetString(std::string& result,
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
518 const std::string& uri,
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
519 bool applyPlugins);
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
520
3026
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
521 bool RestApiGetString(std::string& result,
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
522 const std::string& uri,
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
523 const std::map<std::string, std::string>& httpHeaders,
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
524 bool applyPlugins);
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
525
3478
f93a9c6c00c5 added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents: 3443
diff changeset
526 bool RestApiPost(std::string& result,
f93a9c6c00c5 added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents: 3443
diff changeset
527 const std::string& uri,
f93a9c6c00c5 added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents: 3443
diff changeset
528 const void* body,
f93a9c6c00c5 added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents: 3443
diff changeset
529 size_t bodySize,
f93a9c6c00c5 added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents: 3443
diff changeset
530 bool applyPlugins);
f93a9c6c00c5 added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents: 3443
diff changeset
531
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
532 bool RestApiPost(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
533 const std::string& uri,
3400
0faae6f6e3c5 fixed some inconsistencies with pointer types in the plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3399
diff changeset
534 const void* body,
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
535 size_t bodySize,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
536 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
537
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
538 bool RestApiPost(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
539 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
540 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
541 bool applyPlugins);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
543 inline bool RestApiPost(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
544 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
545 const std::string& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
546 bool applyPlugins)
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
547 {
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
548 return RestApiPost(result, uri, body.empty() ? NULL : body.c_str(),
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
549 body.size(), applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
550 }
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551
2973
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
552 inline bool RestApiPost(Json::Value& result,
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
553 const std::string& uri,
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
554 const MemoryBuffer& body,
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
555 bool applyPlugins)
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
556 {
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
557 return RestApiPost(result, uri, body.GetData(),
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
558 body.GetSize(), applyPlugins);
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
559 }
9b734c3e1095 more defensive parsing of responses
am@osimis.io
parents: 2968
diff changeset
560
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
561 bool RestApiPut(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
562 const std::string& uri,
3400
0faae6f6e3c5 fixed some inconsistencies with pointer types in the plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3399
diff changeset
563 const void* body,
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
564 size_t bodySize,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
565 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
566
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
567 bool RestApiPut(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
568 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
569 const Json::Value& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
570 bool applyPlugins);
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
571
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
572 inline bool RestApiPut(Json::Value& result,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
573 const std::string& uri,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
574 const std::string& body,
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
575 bool applyPlugins)
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 {
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
577 return RestApiPut(result, uri, body.empty() ? NULL : body.c_str(),
2058
43cd2ab060c7 cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2057
diff changeset
578 body.size(), applyPlugins);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
581 bool RestApiDelete(const std::string& uri,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 bool applyPlugins);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
584 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
585 const std::string& username,
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
586 const std::string& password);
8e5e0de75839 primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2263
diff changeset
587
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
588 void AnswerJson(const Json::Value& value,
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
589 OrthancPluginRestOutput* output);
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
590
3026
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
591 void AnswerString(const std::string& answer,
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
592 const char* mimeType,
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
593 OrthancPluginRestOutput* output);
c358bdb37c13 more plugin helpers
amazy
parents: 2988
diff changeset
594
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
595 void AnswerHttpError(uint16_t httpError,
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
596 OrthancPluginRestOutput* output);
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
597
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
598 void AnswerMethodNotAllowed(OrthancPluginRestOutput* output, const char* allowedMethods);
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
599
2988
9cc3d40e389b Orthanc 1.4.3 is now known as 1.5.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2985
diff changeset
600 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
2984
db8f360fcb41 OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2979
diff changeset
601 const char* AutodetectMimeType(const std::string& path);
2985
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2984
diff changeset
602 #endif
2968
e361df74639f added few plugin helpers
am@osimis.io
parents: 2961
diff changeset
603
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
604 void LogError(const std::string& message);
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
605
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
606 void LogWarning(const std::string& message);
2057
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2056
diff changeset
607
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
608 void LogInfo(const std::string& message);
2057
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2056
diff changeset
609
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
610 void ReportMinimalOrthancVersion(unsigned int major,
2268
ce5c13b95dac New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2266
diff changeset
611 unsigned int minor,
ce5c13b95dac New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2266
diff changeset
612 unsigned int revision);
ce5c13b95dac New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2266
diff changeset
613
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
614 bool CheckMinimalOrthancVersion(unsigned int major,
2109
d5c29fd74ffa OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2062
diff changeset
615 unsigned int minor,
d5c29fd74ffa OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2062
diff changeset
616 unsigned int revision);
d5c29fd74ffa OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2062
diff changeset
617
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
618 bool CheckMinimalVersion(const char* version,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
619 unsigned int major,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
620 unsigned int minor,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4925
diff changeset
621 unsigned int revision);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 namespace Internals
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 template <RestCallback Callback>
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
626 static OrthancPluginErrorCode Protect(OrthancPluginRestOutput* output,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
627 const char* url,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
628 const OrthancPluginHttpRequest* request)
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 try
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 Callback(output, url, request);
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 return OrthancPluginErrorCode_Success;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 }
2239
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2234
diff changeset
635 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 {
2959
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2958
diff changeset
637 #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
638 if (HasGlobalContext() &&
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
639 e.HasDetails())
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
640 {
2961
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
641 // The "false" instructs Orthanc not to log the detailed
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
642 // error message. This is to avoid duplicating the details,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
643 // because "OrthancException" already does it on construction.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2959
diff changeset
644 OrthancPluginSetHttpErrorDetails
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
645 (GetGlobalContext(), output, e.GetDetails(), false);
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
646 }
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
647 #endif
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
648
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 }
2056
e166a902b3c4 removal of warnings in msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2047
diff changeset
651 catch (boost::bad_lexical_cast&)
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 return OrthancPluginErrorCode_BadFileFormat;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 catch (...)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 return OrthancPluginErrorCode_Plugin;
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 template <RestCallback Callback>
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
664 void RegisterRestCallback(const std::string& uri,
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 bool isThreadSafe)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 {
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 if (isThreadSafe)
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
669 OrthancPluginRegisterRestCallbackNoLock
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
670 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 else
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 {
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
674 OrthancPluginRegisterRestCallback
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
675 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>);
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 }
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 }
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
678
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
679
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
680 #if HAS_ORTHANC_PLUGIN_PEERS == 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
681 class OrthancPeers : public boost::noncopyable
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
682 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
683 private:
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
684 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
685
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
686 OrthancPluginPeers *peers_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
687 Index index_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
688 uint32_t timeout_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
689
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
690 size_t GetPeerIndex(const std::string& name) const;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
691
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
692 public:
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
693 OrthancPeers();
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
694
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
695 ~OrthancPeers();
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 uint32_t GetTimeout() const
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 return timeout_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
700 }
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 SetTimeout(uint32_t timeout)
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 timeout_ = timeout;
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
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
707 bool LookupName(size_t& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
708 const std::string& name) const;
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 std::string GetPeerName(size_t index) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
711
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
712 std::string GetPeerUrl(size_t index) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
713
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
714 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
715
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
716 size_t GetPeersCount() const
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
717 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
718 return index_.size();
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
719 }
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
720
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
721 bool LookupUserProperty(std::string& value,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
722 size_t index,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
723 const std::string& key) const;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
724
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
725 bool LookupUserProperty(std::string& value,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
726 const std::string& peer,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
727 const std::string& key) const;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2817
diff changeset
728
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
729 bool DoGet(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
730 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
731 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
732
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
733 bool DoGet(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
734 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
735 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
736
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
737 bool DoGet(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
738 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
739 const std::string& uri) const;
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
740
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
741 bool DoGet(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
742 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
743 const std::string& uri) const;
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
744
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
745 bool DoPost(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
746 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
747 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
748 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
749
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
750 bool DoPost(MemoryBuffer& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
751 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
752 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
753 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
754
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
755 bool DoPost(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
756 size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
757 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
758 const std::string& body) const;
2979
5947aeedf41f added C++ plugin helpers
am@osimis.io
parents: 2973
diff changeset
759
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
760 bool DoPost(Json::Value& target,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
761 const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
762 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
763 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
764
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
765 bool DoPut(size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
766 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
767 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
768
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
769 bool DoPut(const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
770 const std::string& uri,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
771 const std::string& body) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
772
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
773 bool DoDelete(size_t index,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
774 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
775
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
776 bool DoDelete(const std::string& name,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
777 const std::string& uri) const;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
778 };
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
779 #endif
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
780
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
781
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
782
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
783 #if HAS_ORTHANC_PLUGIN_JOB == 1
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
784 class OrthancJob : public boost::noncopyable
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
785 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
786 private:
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
787 std::string jobType_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
788 std::string content_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
789 bool hasSerialized_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
790 std::string serialized_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
791 float progress_;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
792
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
793 static void CallbackFinalize(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
794
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
795 static float CallbackGetProgress(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
796
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
797 static const char* CallbackGetContent(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
798
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
799 static const char* CallbackGetSerialized(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
800
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
801 static OrthancPluginJobStepStatus CallbackStep(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
802
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
803 static OrthancPluginErrorCode CallbackStop(void* job,
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
804 OrthancPluginJobStopReason reason);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
805
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
806 static OrthancPluginErrorCode CallbackReset(void* job);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
807
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
808 protected:
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
809 void ClearContent();
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
810
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
811 void UpdateContent(const Json::Value& content);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
812
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
813 void ClearSerialized();
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
814
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
815 void UpdateSerialized(const Json::Value& serialized);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
816
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
817 void UpdateProgress(float progress);
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
818
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
819 public:
4256
cbce4f43884a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4133
diff changeset
820 explicit OrthancJob(const std::string& jobType);
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
821
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
822 virtual ~OrthancJob()
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
823 {
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
824 }
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
825
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
826 virtual OrthancPluginJobStepStatus Step() = 0;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
827
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
828 virtual void Stop(OrthancPluginJobStopReason reason) = 0;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
829
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
830 virtual void Reset() = 0;
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
831
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
832 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
833
2958
bb7a66efbeb1 OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2851
diff changeset
834 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
835 int priority);
3437
dbaf439c8888 OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3434
diff changeset
836
dbaf439c8888 OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3434
diff changeset
837 static void SubmitAndWait(Json::Value& result,
dbaf439c8888 OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3434
diff changeset
838 OrthancJob* job /* takes ownership */,
dbaf439c8888 OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3434
diff changeset
839 int priority);
3667
c8d8c3b5f47c OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
840
c8d8c3b5f47c OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
841 // Submit a job from a POST on the REST API with the same
c8d8c3b5f47c OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
842 // conventions as in the Orthanc core (according to the
c8d8c3b5f47c OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
843 // "Synchronous" and "Priority" options)
c8d8c3b5f47c OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
844 static void SubmitFromRestApiPost(OrthancPluginRestOutput* output,
c8d8c3b5f47c OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
845 const Json::Value& body,
c8d8c3b5f47c OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
846 OrthancJob* job);
2817
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
847 };
473bf302d629 C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2803
diff changeset
848 #endif
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
849
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
850
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
851 #if HAS_ORTHANC_PLUGIN_METRICS == 1
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
852 inline void SetMetricsValue(char* name,
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
853 float value)
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
854 {
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
855 OrthancPluginSetMetricsValue(GetGlobalContext(), name,
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
856 value, OrthancPluginMetricsType_Default);
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
857 }
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
858
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
859 class MetricsTimer : public boost::noncopyable
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
860 {
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
861 private:
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
862 std::string name_;
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
863 boost::posix_time::ptime start_;
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
864
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
865 public:
3796
daa1bc6700bf cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3668
diff changeset
866 explicit MetricsTimer(const char* name);
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
867
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
868 ~MetricsTimer();
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
869 };
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
870 #endif
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
871
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
872
3388
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
873 #if HAS_ORTHANC_PLUGIN_HTTP_CLIENT == 1
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
874 class HttpClient : public boost::noncopyable
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
875 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
876 public:
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
877 typedef std::map<std::string, std::string> HttpHeaders;
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
878
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
879 class IRequestBody : public boost::noncopyable
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
880 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
881 public:
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
882 virtual ~IRequestBody()
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
883 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
884 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
885
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
886 virtual bool ReadNextChunk(std::string& chunk) = 0;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
887 };
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
888
3438
d97ef941d521 compatibility mode for OrthancPlugins::HttpClient::IAnswer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3437
diff changeset
889
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
890 class IAnswer : public boost::noncopyable
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
891 {
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
892 public:
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
893 virtual ~IAnswer()
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
894 {
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
895 }
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
896
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
897 virtual void AddHeader(const std::string& key,
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
898 const std::string& value) = 0;
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
899
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
900 virtual void AddChunk(const void* data,
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
901 size_t size) = 0;
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
902 };
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
903
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
904
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
905 private:
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
906 class RequestBodyWrapper;
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
907
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
908 uint16_t httpStatus_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
909 OrthancPluginHttpMethod method_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
910 std::string url_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
911 HttpHeaders headers_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
912 std::string username_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
913 std::string password_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
914 uint32_t timeout_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
915 std::string certificateFile_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
916 std::string certificateKeyFile_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
917 std::string certificateKeyPassword_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
918 bool pkcs11_;
3413
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3410
diff changeset
919 std::string fullBody_;
3443
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
920 IRequestBody* chunkedBody_;
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
921 bool allowChunkedTransfers_;
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
922
3413
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3410
diff changeset
923 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
924 void ExecuteWithStream(uint16_t& httpStatus, // out
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
925 IAnswer& answer, // out
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
926 IRequestBody& body) const;
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
927 #endif
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
928
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
929 void ExecuteWithoutStream(uint16_t& httpStatus, // out
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
930 HttpHeaders& answerHeaders, // out
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
931 std::string& answerBody, // out
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
932 const std::string& body) const;
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
933
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
934 public:
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
935 HttpClient();
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
936
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
937 uint16_t GetHttpStatus() const
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
938 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
939 return httpStatus_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
940 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
941
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
942 void SetMethod(OrthancPluginHttpMethod method)
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
943 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
944 method_ = method;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
945 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
946
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
947 const std::string& GetUrl() const
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
948 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
949 return url_;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
950 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
951
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
952 void SetUrl(const std::string& url)
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
953 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
954 url_ = url;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
955 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
956
3424
07c3b6044e9d OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3421
diff changeset
957 void SetHeaders(const HttpHeaders& headers)
07c3b6044e9d OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3421
diff changeset
958 {
07c3b6044e9d OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3421
diff changeset
959 headers_ = headers;
07c3b6044e9d OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3421
diff changeset
960 }
07c3b6044e9d OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3421
diff changeset
961
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
962 void AddHeader(const std::string& key,
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
963 const std::string& value)
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
964 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
965 headers_[key] = value;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
966 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
967
3426
00737cd21f40 OrthancPlugins::HttpClient::AddHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3424
diff changeset
968 void AddHeaders(const HttpHeaders& headers);
00737cd21f40 OrthancPlugins::HttpClient::AddHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3424
diff changeset
969
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
970 void SetCredentials(const std::string& username,
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
971 const std::string& password);
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
972
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
973 void ClearCredentials();
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
974
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
975 void SetTimeout(unsigned int timeout) // 0 for default timeout
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
976 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
977 timeout_ = timeout;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
978 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
979
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
980 void SetCertificate(const std::string& certificateFile,
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
981 const std::string& keyFile,
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
982 const std::string& keyPassword);
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
983
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
984 void ClearCertificate();
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
985
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
986 void SetPkcs11(bool pkcs11)
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
987 {
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
988 pkcs11_ = pkcs11;
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
989 }
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
990
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
991 void ClearBody();
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
992
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
993 void SwapBody(std::string& body);
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
994
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
995 void SetBody(const std::string& body);
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
996
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
997 void SetBody(IRequestBody& body);
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
998
3443
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
999 // This function can be used to disable chunked transfers if the
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1000 // remote server is Orthanc with a version <= 1.5.6.
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1001 void SetChunkedTransfersAllowed(bool allow)
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1002 {
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1003 allowChunkedTransfers_ = allow;
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1004 }
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1005
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1006 bool IsChunkedTransfersAllowed() const
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1007 {
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1008 return allowChunkedTransfers_;
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1009 }
0371b65d5f76 OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3438
diff changeset
1010
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
1011 void Execute(IAnswer& answer);
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
1012
3393
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
1013 void Execute(HttpHeaders& answerHeaders /* out */,
2cd0369a156f support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3392
diff changeset
1014 std::string& answerBody /* out */);
3420
0a0e7eca95ae fix encoding in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3419
diff changeset
1015
0a0e7eca95ae fix encoding in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3419
diff changeset
1016 void Execute(HttpHeaders& answerHeaders /* out */,
0a0e7eca95ae fix encoding in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3419
diff changeset
1017 Json::Value& answerBody /* out */);
3434
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3433
diff changeset
1018
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3433
diff changeset
1019 void Execute();
3387
a48d652f1500 new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3320
diff changeset
1020 };
3388
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3387
diff changeset
1021 #endif
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1022
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1023
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1024
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1025 class IChunkedRequestReader : public boost::noncopyable
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1026 {
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1027 public:
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1028 virtual ~IChunkedRequestReader()
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1029 {
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1030 }
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1031
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1032 virtual void AddChunk(const void* data,
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1033 size_t size) = 0;
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1034
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1035 virtual void Execute(OrthancPluginRestOutput* output) = 0;
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1036 };
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1037
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1038
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1039 typedef IChunkedRequestReader* (*ChunkedRestCallback) (const char* url,
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1040 const OrthancPluginHttpRequest* request);
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1041
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1042
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1043 namespace Internals
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1044 {
3416
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1045 void NullRestCallback(OrthancPluginRestOutput* output,
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1046 const char* url,
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1047 const OrthancPluginHttpRequest* request);
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1048
3416
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1049 IChunkedRequestReader *NullChunkedRestCallback(const char* url,
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1050 const OrthancPluginHttpRequest* request);
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1051
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1052
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1053 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1054 template <ChunkedRestCallback Callback>
3418
e2b032584a83 fix for msvc 2008
s.jodogne@gmail.com
parents: 3417
diff changeset
1055 static OrthancPluginErrorCode ChunkedProtect(OrthancPluginServerChunkedRequestReader** reader,
e2b032584a83 fix for msvc 2008
s.jodogne@gmail.com
parents: 3417
diff changeset
1056 const char* url,
e2b032584a83 fix for msvc 2008
s.jodogne@gmail.com
parents: 3417
diff changeset
1057 const OrthancPluginHttpRequest* request)
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1058 {
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1059 try
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1060 {
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1061 if (reader == NULL)
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1062 {
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1063 return OrthancPluginErrorCode_InternalError;
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1064 }
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1065 else
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1066 {
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1067 *reader = reinterpret_cast<OrthancPluginServerChunkedRequestReader*>(Callback(url, request));
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1068 if (*reader == NULL)
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1069 {
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1070 return OrthancPluginErrorCode_Plugin;
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1071 }
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1072 else
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1073 {
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1074 return OrthancPluginErrorCode_Success;
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1075 }
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1076 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1077 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1078 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1079 {
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1080 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1081 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1082 catch (boost::bad_lexical_cast&)
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1083 {
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1084 return OrthancPluginErrorCode_BadFileFormat;
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1085 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1086 catch (...)
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1087 {
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1088 return OrthancPluginErrorCode_Plugin;
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1089 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1090 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1091
3416
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1092 OrthancPluginErrorCode ChunkedRequestReaderAddChunk(
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1093 OrthancPluginServerChunkedRequestReader* reader,
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1094 const void* data,
3416
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1095 uint32_t size);
3397
9019279dbfd7 new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3393
diff changeset
1096
3416
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1097 OrthancPluginErrorCode ChunkedRequestReaderExecute(
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1098 OrthancPluginServerChunkedRequestReader* reader,
3416
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1099 OrthancPluginRestOutput* output);
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1100
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1101 void ChunkedRequestReaderFinalize(
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1102 OrthancPluginServerChunkedRequestReader* reader);
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1103
3416
541c787e2230 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3415
diff changeset
1104 #else
3433
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1105
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1106 OrthancPluginErrorCode ChunkedRestCompatibility(OrthancPluginRestOutput* output,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1107 const char* url,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1108 const OrthancPluginHttpRequest* request,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1109 RestCallback GetHandler,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1110 ChunkedRestCallback PostHandler,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1111 RestCallback DeleteHandler,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1112 ChunkedRestCallback PutHandler);
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1113
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1114 template<
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1115 RestCallback GetHandler,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1116 ChunkedRestCallback PostHandler,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1117 RestCallback DeleteHandler,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1118 ChunkedRestCallback PutHandler
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1119 >
3433
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1120 inline OrthancPluginErrorCode ChunkedRestCompatibility(OrthancPluginRestOutput* output,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1121 const char* url,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1122 const OrthancPluginHttpRequest* request)
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1123 {
3433
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1124 return ChunkedRestCompatibility(output, url, request, GetHandler,
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1125 PostHandler, DeleteHandler, PutHandler);
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1126 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1127 #endif
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1128 }
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1129
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1130
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1131
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1132 // NB: We use a templated class instead of a templated function, because
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1133 // default values are only available in functions since C++11
3415
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1134 template<
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1135 RestCallback GetHandler = Internals::NullRestCallback,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1136 ChunkedRestCallback PostHandler = Internals::NullChunkedRestCallback,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1137 RestCallback DeleteHandler = Internals::NullRestCallback,
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1138 ChunkedRestCallback PutHandler = Internals::NullChunkedRestCallback
2a821deece64 refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3414
diff changeset
1139 >
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1140 class ChunkedRestRegistration : public boost::noncopyable
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1141 {
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1142 public:
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1143 static void Apply(const std::string& uri)
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1144 {
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1145 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1146 OrthancPluginRegisterChunkedRestCallback(
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1147 GetGlobalContext(), uri.c_str(),
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1148 GetHandler == Internals::NullRestCallback ? NULL : Internals::Protect<GetHandler>,
3418
e2b032584a83 fix for msvc 2008
s.jodogne@gmail.com
parents: 3417
diff changeset
1149 PostHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PostHandler>,
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1150 DeleteHandler == Internals::NullRestCallback ? NULL : Internals::Protect<DeleteHandler>,
3418
e2b032584a83 fix for msvc 2008
s.jodogne@gmail.com
parents: 3417
diff changeset
1151 PutHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PutHandler>,
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1152 Internals::ChunkedRequestReaderAddChunk,
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1153 Internals::ChunkedRequestReaderExecute,
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1154 Internals::ChunkedRequestReaderFinalize);
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1155 #else
3433
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1156 OrthancPluginRegisterRestCallbackNoLock(
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1157 GetGlobalContext(), uri.c_str(),
3433
caa526bb65cc fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3426
diff changeset
1158 Internals::ChunkedRestCompatibility<GetHandler, PostHandler, DeleteHandler, PutHandler>);
3414
b9cba6a91780 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3413
diff changeset
1159 #endif
3417
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1160 }
ad263225187c fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3416
diff changeset
1161 };
3664
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1162
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1163
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1164
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1165 #if HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP == 1
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1166 class IStorageCommitmentScpHandler : public boost::noncopyable
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1167 {
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1168 public:
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1169 virtual ~IStorageCommitmentScpHandler()
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1170 {
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1171 }
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1172
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1173 virtual OrthancPluginStorageCommitmentFailureReason Lookup(const std::string& sopClassUid,
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1174 const std::string& sopInstanceUid) = 0;
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1175
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1176 static OrthancPluginErrorCode Lookup(OrthancPluginStorageCommitmentFailureReason* target,
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1177 void* rawHandler,
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1178 const char* sopClassUid,
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1179 const char* sopInstanceUid);
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1180
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1181 static void Destructor(void* rawHandler);
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1182 };
85acfcc15829 sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1183 #endif
3916
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1184
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1185
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1186 class DicomInstance : public boost::noncopyable
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1187 {
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1188 private:
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1189 bool toFree_;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1190
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1191 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1192 const OrthancPluginDicomInstance* instance_;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1193 #else
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1194 OrthancPluginDicomInstance* instance_;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1195 #endif
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1196
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1197 public:
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1198 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
4133
36c30a95bc3f cppcheck on OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4122
diff changeset
1199 explicit DicomInstance(const OrthancPluginDicomInstance* instance);
3916
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1200 #else
4133
36c30a95bc3f cppcheck on OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4122
diff changeset
1201 explicit DicomInstance(OrthancPluginDicomInstance* instance);
3916
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1202 #endif
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1203
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1204 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1205 DicomInstance(const void* buffer,
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1206 size_t size);
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1207 #endif
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1208
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1209 ~DicomInstance();
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1210
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1211 std::string GetRemoteAet() const;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1212
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1213 const void* GetBuffer() const
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1214 {
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1215 return OrthancPluginGetInstanceData(GetGlobalContext(), instance_);
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1216 }
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1217
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1218 size_t GetSize() const
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1219 {
3963
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3934
diff changeset
1220 return static_cast<size_t>(OrthancPluginGetInstanceSize(GetGlobalContext(), instance_));
3916
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1221 }
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1222
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1223 void GetJson(Json::Value& target) const;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1224
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1225 void GetSimplifiedJson(Json::Value& target) const;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1226
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1227 OrthancPluginInstanceOrigin GetOrigin() const
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1228 {
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1229 return OrthancPluginGetInstanceOrigin(GetGlobalContext(), instance_);
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1230 }
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1231
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1232 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1233 std::string GetTransferSyntaxUid() const;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1234 #endif
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1235
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1236 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1237 bool HasPixelData() const;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1238 #endif
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1239
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1240 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1241 unsigned int GetFramesCount() const
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1242 {
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1243 return OrthancPluginGetInstanceFramesCount(GetGlobalContext(), instance_);
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1244 }
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1245 #endif
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1246
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1247 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1248 void GetRawFrame(std::string& target,
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1249 unsigned int frameIndex) const;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1250 #endif
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1251
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1252 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1253 OrthancImage* GetDecodedFrame(unsigned int frameIndex) const;
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1254 #endif
3919
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1255
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1256 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1257 void Serialize(std::string& target) const;
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1258 #endif
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1259
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1260 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1261 static DicomInstance* Transcode(const void* buffer,
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1262 size_t size,
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1263 const std::string& transferSyntax);
6f11b3233a06 OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3916
diff changeset
1264 #endif
3916
0e3849268a55 new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3915
diff changeset
1265 };
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1266
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1267
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1268
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1269 #if HAS_ORTHANC_PLUGIN_WEBDAV == 1
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1270 class IWebDavCollection : public boost::noncopyable
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1271 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1272 public:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1273 class FileInfo
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1274 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1275 private:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1276 std::string name_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1277 uint64_t contentSize_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1278 std::string mime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1279 std::string dateTime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1280
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1281 public:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1282 FileInfo(const std::string& name,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1283 uint64_t contentSize,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1284 const std::string& dateTime) :
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1285 name_(name),
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1286 contentSize_(contentSize),
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1287 dateTime_(dateTime)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1288 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1289 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1290
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1291 const std::string& GetName() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1292 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1293 return name_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1294 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1295
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1296 uint64_t GetContentSize() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1297 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1298 return contentSize_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1299 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1300
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1301 void SetMimeType(const std::string& mime)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1302 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1303 mime_ = mime;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1304 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1305
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1306 const std::string& GetMimeType() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1307 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1308 return mime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1309 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1310
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1311 const std::string& GetDateTime() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1312 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1313 return dateTime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1314 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1315 };
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1316
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1317 class FolderInfo
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1318 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1319 private:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1320 std::string name_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1321 std::string dateTime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1322
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1323 public:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1324 FolderInfo(const std::string& name,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1325 const std::string& dateTime) :
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1326 name_(name),
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1327 dateTime_(dateTime)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1328 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1329 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1330
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1331 const std::string& GetName() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1332 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1333 return name_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1334 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1335
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1336 const std::string& GetDateTime() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1337 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1338 return dateTime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1339 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1340 };
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1341
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1342 virtual ~IWebDavCollection()
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1343 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1344 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1345
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1346 virtual bool IsExistingFolder(const std::vector<std::string>& path) = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1347
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1348 virtual bool ListFolder(std::list<FileInfo>& files,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1349 std::list<FolderInfo>& subfolders,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1350 const std::vector<std::string>& path) = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1351
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1352 virtual bool GetFile(std::string& content /* out */,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1353 std::string& mime /* out */,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1354 std::string& dateTime /* out */,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1355 const std::vector<std::string>& path) = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1356
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1357 virtual bool StoreFile(const std::vector<std::string>& path,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1358 const void* data,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1359 size_t size) = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1360
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1361 virtual bool CreateFolder(const std::vector<std::string>& path) = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1362
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1363 virtual bool DeleteItem(const std::vector<std::string>& path) = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1364
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1365 static void Register(const std::string& uri,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1366 IWebDavCollection& collection);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1367 };
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4925
diff changeset
1368 #endif
2047
438f86ee19fc toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1369 }