Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 4925:8785d8442f90
skip json comments when loading config
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 24 Feb 2022 17:36:20 +0100 |
parents | 43e613a7756b |
children | 47d734fa30f6 1b76853e1797 |
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 | 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 | 39 /** |
40 * The definition of ORTHANC_PLUGINS_VERSION_IS_ABOVE below is for | |
41 * backward compatibility with Orthanc SDK <= 1.3.0. | |
42 * | |
43 * $ hg diff -r Orthanc-1.3.0:Orthanc-1.3.1 ../../../Plugins/Include/orthanc/OrthancCPlugin.h | |
44 * | |
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 | 83 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 1 |
84 #else | |
85 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 0 | |
86 #endif | |
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 | 94 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 1, 0) |
95 # define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 1 | |
96 #else | |
97 # define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 0 | |
98 #endif | |
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 | 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 | 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 | 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 | 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 |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
118 |
2231
61e0564d03bb
backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2215
diff
changeset
|
119 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 namespace OrthancPlugins |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 typedef void (*RestCallback) (OrthancPluginRestOutput* output, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 const char* url, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 const OrthancPluginHttpRequest* request); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
126 void SetGlobalContext(OrthancPluginContext* context); |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
127 |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
128 bool HasGlobalContext(); |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
129 |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
130 OrthancPluginContext* GetGlobalContext(); |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
131 |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
132 |
2849 | 133 class OrthancImage; |
2848 | 134 |
135 | |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 class MemoryBuffer : public boost::noncopyable |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 private: |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 OrthancPluginMemoryBuffer buffer_; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 |
2062
40ffd0e8676a
generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2060
diff
changeset
|
141 void Check(OrthancPluginErrorCode code); |
40ffd0e8676a
generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2060
diff
changeset
|
142 |
2264
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
143 bool CheckHttp(OrthancPluginErrorCode code); |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
144 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 public: |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
146 MemoryBuffer(); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 |
3934
0b59e2706366
guard on SDK version in OrthancPlugins::MemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
148 #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
|
149 // 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
|
150 // handled by the Orthanc core |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
151 MemoryBuffer(const void* buffer, |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
152 size_t size); |
3934
0b59e2706366
guard on SDK version in OrthancPlugins::MemoryBuffer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
153 #endif |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
154 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 ~MemoryBuffer() |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 Clear(); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 OrthancPluginMemoryBuffer* operator*() |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 return &buffer_; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 |
2792
57e2d65d37ce
OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
165 // This transfers ownership from "other" to "this" |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 void Assign(OrthancPluginMemoryBuffer& other); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 |
3320 | 168 void Swap(MemoryBuffer& other); |
169 | |
2792
57e2d65d37ce
OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
170 OrthancPluginMemoryBuffer Release(); |
57e2d65d37ce
OrthancPlugins::MemoryBuffer::Release(), fixing openssl link
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
171 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 const char* GetData() const |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 if (buffer_.size > 0) |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 return reinterpret_cast<const char*>(buffer_.data); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 else |
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 return NULL; |
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 } |
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 size_t GetSize() const |
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 buffer_.size; |
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 |
2973 | 189 bool IsEmpty() const |
190 { | |
191 return GetSize() == 0 || GetData() == NULL; | |
192 } | |
193 | |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 void Clear(); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 void ToString(std::string& target) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 void ToJson(Json::Value& target) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 bool RestApiGet(const std::string& uri, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 bool applyPlugins); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 |
3026 | 203 bool RestApiGet(const std::string& uri, |
204 const std::map<std::string, std::string>& httpHeaders, | |
205 bool applyPlugins); | |
206 | |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 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
|
208 const void* body, |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 size_t bodySize, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 bool applyPlugins); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 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
|
213 const void* body, |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 size_t bodySize, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 bool applyPlugins); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 bool RestApiPost(const std::string& uri, |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
218 const Json::Value& body, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
219 bool applyPlugins); |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
220 |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
221 bool RestApiPut(const std::string& uri, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
222 const Json::Value& body, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
223 bool applyPlugins); |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
224 |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
225 bool RestApiPost(const std::string& uri, |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 const std::string& body, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 bool applyPlugins) |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 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
|
230 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 bool RestApiPut(const std::string& uri, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 const std::string& body, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 bool applyPlugins) |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 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
|
237 } |
2059 | 238 |
239 void CreateDicom(const Json::Value& tags, | |
240 OrthancPluginCreateDicomFlags flags); | |
2062
40ffd0e8676a
generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2060
diff
changeset
|
241 |
2848 | 242 void CreateDicom(const Json::Value& tags, |
243 const OrthancImage& pixelData, | |
244 OrthancPluginCreateDicomFlags flags); | |
245 | |
2062
40ffd0e8676a
generation of etag in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2060
diff
changeset
|
246 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
|
247 |
395522e46b2b
refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2183
diff
changeset
|
248 void GetDicomQuery(const OrthancPluginWorklistQuery* query); |
2206
27106f7e3759
more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2205
diff
changeset
|
249 |
27106f7e3759
more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2205
diff
changeset
|
250 void DicomToJson(Json::Value& target, |
27106f7e3759
more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2205
diff
changeset
|
251 OrthancPluginDicomToJsonFormat format, |
27106f7e3759
more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2205
diff
changeset
|
252 OrthancPluginDicomToJsonFlags flags, |
27106f7e3759
more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2205
diff
changeset
|
253 uint32_t maxStringLength); |
2264
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
254 |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
255 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
|
256 const std::string& username, |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
257 const std::string& password); |
2979 | 258 |
2264
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
259 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
|
260 const std::string& body, |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
261 const std::string& username, |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
262 const std::string& password); |
2979 | 263 |
2264
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
264 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
|
265 const std::string& body, |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
266 const std::string& username, |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
267 const std::string& password); |
2796
4df3c64402ba
MemoryBuffer::GetDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2792
diff
changeset
|
268 |
4df3c64402ba
MemoryBuffer::GetDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2792
diff
changeset
|
269 void GetDicomInstance(const std::string& instanceId); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 }; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 class OrthancString : public boost::noncopyable |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 private: |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
276 char* str_; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 |
2205
395522e46b2b
refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2183
diff
changeset
|
278 void Clear(); |
395522e46b2b
refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2183
diff
changeset
|
279 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 public: |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
281 OrthancString() : |
2205
395522e46b2b
refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2183
diff
changeset
|
282 str_(NULL) |
395522e46b2b
refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2183
diff
changeset
|
283 { |
395522e46b2b
refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2183
diff
changeset
|
284 } |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 ~OrthancString() |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 Clear(); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 |
2206
27106f7e3759
more refactoring of the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2205
diff
changeset
|
291 // 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
|
292 // allocated by the Orthanc core |
2205
395522e46b2b
refactoring of the worklist sample using OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2183
diff
changeset
|
293 void Assign(char* str); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 const char* GetContent() const |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 return str_; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 void ToString(std::string& target) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 void ToJson(Json::Value& target) const; |
4925
8785d8442f90
skip json comments when loading config
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
303 |
8785d8442f90
skip json comments when loading config
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
304 void ToJsonWithoutComments(Json::Value& target) const; |
8785d8442f90
skip json comments when loading config
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
305 }; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 class OrthancConfiguration : public boost::noncopyable |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 private: |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
311 Json::Value configuration_; // Necessarily a Json::objectValue |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
312 std::string path_; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 std::string GetPath(const std::string& key) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 |
3421
decbede6e3ad
OrthancPlugins::OrthancConfiguration(bool)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
316 void LoadConfiguration(); |
decbede6e3ad
OrthancPlugins::OrthancConfiguration(bool)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
317 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 public: |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
319 OrthancConfiguration(); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
3796 | 321 explicit OrthancConfiguration(bool load); |
3421
decbede6e3ad
OrthancPlugins::OrthancConfiguration(bool)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
322 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 const Json::Value& GetJson() const |
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 return configuration_; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 |
2167
aa2915963531
"Folders" sub-configuration in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2109
diff
changeset
|
328 bool IsSection(const std::string& key) const; |
aa2915963531
"Folders" sub-configuration in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2109
diff
changeset
|
329 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 void GetSection(OrthancConfiguration& target, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 const std::string& key) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 bool LookupStringValue(std::string& target, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 const std::string& key) 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 bool LookupIntegerValue(int& target, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 const std::string& key) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 bool LookupUnsignedIntegerValue(unsigned int& target, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 const std::string& key) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 bool LookupBooleanValue(bool& target, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 const std::string& key) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 bool LookupFloatValue(float& target, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 const std::string& key) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 |
2263
b9775db0fd9b
OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
348 bool LookupListOfStrings(std::list<std::string>& target, |
2265
e46b0ee6c19d
allowSingleString in OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2264
diff
changeset
|
349 const std::string& key, |
e46b0ee6c19d
allowSingleString in OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2264
diff
changeset
|
350 bool allowSingleString) const; |
2263
b9775db0fd9b
OrthancPlugins::OrthancConfiguration::LookupListOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
351 |
2266
a344e47e9c9a
OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2265
diff
changeset
|
352 bool LookupSetOfStrings(std::set<std::string>& target, |
a344e47e9c9a
OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2265
diff
changeset
|
353 const std::string& key, |
a344e47e9c9a
OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2265
diff
changeset
|
354 bool allowSingleString) const; |
a344e47e9c9a
OrthancConfiguration::LookupSetOfStrings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2265
diff
changeset
|
355 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 std::string GetStringValue(const std::string& key, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 const std::string& defaultValue) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 int GetIntegerValue(const std::string& key, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 int defaultValue) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 unsigned int GetUnsignedIntegerValue(const std::string& key, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 unsigned int defaultValue) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 bool GetBooleanValue(const std::string& key, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 bool defaultValue) const; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 float GetFloatValue(const std::string& key, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 float defaultValue) const; |
2803
579acc5e5412
OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2796
diff
changeset
|
370 |
579acc5e5412
OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2796
diff
changeset
|
371 void GetDictionary(std::map<std::string, std::string>& target, |
579acc5e5412
OrthancConfiguration::GetDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2796
diff
changeset
|
372 const std::string& key) const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 }; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
375 class OrthancImage : public boost::noncopyable |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 private: |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 OrthancPluginImage* image_; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 void Clear(); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 |
3236 | 382 void CheckImageAvailable() const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 public: |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
385 OrthancImage(); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 |
3796 | 387 explicit OrthancImage(OrthancPluginImage* image); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
389 OrthancImage(OrthancPluginPixelFormat format, |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 uint32_t width, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 uint32_t height); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
393 OrthancImage(OrthancPluginPixelFormat format, |
2848 | 394 uint32_t width, |
395 uint32_t height, | |
396 uint32_t pitch, | |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
397 void* buffer); |
2848 | 398 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 ~OrthancImage() |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 Clear(); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 void UncompressPngImage(const void* data, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 size_t size); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
406 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 void UncompressJpegImage(const void* data, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 size_t size); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
409 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
410 void DecodeDicomImage(const void* data, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 size_t size, |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 unsigned int frame); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 |
3236 | 414 OrthancPluginPixelFormat GetPixelFormat() const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 |
3236 | 416 unsigned int GetWidth() const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 |
3236 | 418 unsigned int GetHeight() const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 |
3236 | 420 unsigned int GetPitch() const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 |
3915
7e33516965f8
merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3914
diff
changeset
|
422 void* GetBuffer() const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 |
2849 | 424 const OrthancPluginImage* GetObject() const |
425 { | |
426 return image_; | |
427 } | |
2848 | 428 |
3236 | 429 void CompressPngImage(MemoryBuffer& target) const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 void CompressJpegImage(MemoryBuffer& target, |
3236 | 432 uint8_t quality) const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 |
3236 | 434 void AnswerPngImage(OrthancPluginRestOutput* output) const; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 void AnswerJpegImage(OrthancPluginRestOutput* output, |
3236 | 437 uint8_t quality) const; |
3915
7e33516965f8
merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3914
diff
changeset
|
438 |
7e33516965f8
merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3914
diff
changeset
|
439 void* GetWriteableBuffer(); |
7e33516965f8
merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3914
diff
changeset
|
440 |
7e33516965f8
merging sample GDCM decoder and Orthanc Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3914
diff
changeset
|
441 OrthancPluginImage* Release(); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 }; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 |
2231
61e0564d03bb
backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2215
diff
changeset
|
445 #if HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1 |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
446 class FindMatcher : public boost::noncopyable |
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
447 { |
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
448 private: |
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
449 OrthancPluginFindMatcher* matcher_; |
2213
95d1d758abb7
FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2212
diff
changeset
|
450 const OrthancPluginWorklistQuery* worklist_; |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
451 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
452 void SetupDicom(const void* query, |
2215
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2214
diff
changeset
|
453 uint32_t size); |
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2214
diff
changeset
|
454 |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
455 public: |
3796 | 456 explicit FindMatcher(const OrthancPluginWorklistQuery* worklist); |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
457 |
3796 | 458 FindMatcher(const void* query, |
459 uint32_t size) | |
2215
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2214
diff
changeset
|
460 { |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
461 SetupDicom(query, size); |
2215
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2214
diff
changeset
|
462 } |
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2214
diff
changeset
|
463 |
3796 | 464 explicit FindMatcher(const MemoryBuffer& dicom) |
2215
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2214
diff
changeset
|
465 { |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
466 SetupDicom(dicom.GetData(), dicom.GetSize()); |
2215
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2214
diff
changeset
|
467 } |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
468 |
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
469 ~FindMatcher(); |
2213
95d1d758abb7
FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2212
diff
changeset
|
470 |
95d1d758abb7
FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2212
diff
changeset
|
471 bool IsMatch(const void* dicom, |
95d1d758abb7
FindMatcher::IsMatch
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2212
diff
changeset
|
472 uint32_t size) const; |
2214 | 473 |
474 bool IsMatch(const MemoryBuffer& dicom) const | |
475 { | |
476 return IsMatch(dicom.GetData(), dicom.GetSize()); | |
477 } | |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
478 }; |
2231
61e0564d03bb
backwards compatibility within OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2215
diff
changeset
|
479 #endif |
2212
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
480 |
c02f6ec404d8
OrthancPlugins::FindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2206
diff
changeset
|
481 |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
482 bool ReadJson(Json::Value& target, |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
483 const std::string& source); |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
484 |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
485 bool ReadJson(Json::Value& target, |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
486 const void* buffer, |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
487 size_t size); |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
488 |
4444
11ea0a05115b
new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
489 bool ReadJsonWithoutComments(Json::Value& target, |
11ea0a05115b
new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
490 const std::string& source); |
11ea0a05115b
new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
491 |
11ea0a05115b
new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
492 bool ReadJsonWithoutComments(Json::Value& target, |
11ea0a05115b
new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
493 const void* buffer, |
11ea0a05115b
new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
494 size_t size); |
11ea0a05115b
new function in OrthancPluginCppWrapper: ReadJsonWithoutComments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
495 |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
496 void WriteFastJson(std::string& target, |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
497 const Json::Value& source); |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
498 |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
499 void WriteStyledJson(std::string& target, |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
500 const Json::Value& source); |
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4256
diff
changeset
|
501 |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
502 bool RestApiGet(Json::Value& result, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
503 const std::string& uri, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
504 bool applyPlugins); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 |
2968 | 506 bool RestApiGetString(std::string& result, |
507 const std::string& uri, | |
508 bool applyPlugins); | |
509 | |
3026 | 510 bool RestApiGetString(std::string& result, |
511 const std::string& uri, | |
512 const std::map<std::string, std::string>& httpHeaders, | |
513 bool applyPlugins); | |
514 | |
3478
f93a9c6c00c5
added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents:
3443
diff
changeset
|
515 bool RestApiPost(std::string& result, |
f93a9c6c00c5
added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents:
3443
diff
changeset
|
516 const std::string& uri, |
f93a9c6c00c5
added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents:
3443
diff
changeset
|
517 const void* body, |
f93a9c6c00c5
added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents:
3443
diff
changeset
|
518 size_t bodySize, |
f93a9c6c00c5
added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents:
3443
diff
changeset
|
519 bool applyPlugins); |
f93a9c6c00c5
added RestApiPost overload to retrieve a string response
Alain Mazy <alain@mazy.be>
parents:
3443
diff
changeset
|
520 |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
521 bool RestApiPost(Json::Value& result, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
522 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
|
523 const void* body, |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
524 size_t bodySize, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
525 bool applyPlugins); |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
526 |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
527 bool RestApiPost(Json::Value& result, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
528 const std::string& uri, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
529 const Json::Value& body, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
530 bool applyPlugins); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
532 inline bool RestApiPost(Json::Value& result, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
533 const std::string& uri, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
534 const std::string& body, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
535 bool applyPlugins) |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
536 { |
2979 | 537 return RestApiPost(result, uri, body.empty() ? NULL : body.c_str(), |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
538 body.size(), applyPlugins); |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
539 } |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 |
2973 | 541 inline bool RestApiPost(Json::Value& result, |
542 const std::string& uri, | |
543 const MemoryBuffer& body, | |
544 bool applyPlugins) | |
545 { | |
546 return RestApiPost(result, uri, body.GetData(), | |
547 body.GetSize(), applyPlugins); | |
548 } | |
549 | |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
550 bool RestApiPut(Json::Value& result, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
551 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
|
552 const void* body, |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
553 size_t bodySize, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
554 bool applyPlugins); |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
555 |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
556 bool RestApiPut(Json::Value& result, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
557 const std::string& uri, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
558 const Json::Value& body, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
559 bool applyPlugins); |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
560 |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
561 inline bool RestApiPut(Json::Value& result, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
562 const std::string& uri, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
563 const std::string& body, |
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
564 bool applyPlugins) |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 { |
2979 | 566 return RestApiPut(result, uri, body.empty() ? NULL : body.c_str(), |
2058
43cd2ab060c7
cont OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2057
diff
changeset
|
567 body.size(), applyPlugins); |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
570 bool RestApiDelete(const std::string& uri, |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
571 bool applyPlugins); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
573 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
|
574 const std::string& username, |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
575 const std::string& password); |
8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2263
diff
changeset
|
576 |
2968 | 577 void AnswerJson(const Json::Value& value, |
2979 | 578 OrthancPluginRestOutput* output); |
579 | |
3026 | 580 void AnswerString(const std::string& answer, |
581 const char* mimeType, | |
582 OrthancPluginRestOutput* output); | |
583 | |
2979 | 584 void AnswerHttpError(uint16_t httpError, |
585 OrthancPluginRestOutput* output); | |
586 | |
587 void AnswerMethodNotAllowed(OrthancPluginRestOutput* output, const char* allowedMethods); | |
2968 | 588 |
2988
9cc3d40e389b
Orthanc 1.4.3 is now known as 1.5.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2985
diff
changeset
|
589 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0) |
2984
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2979
diff
changeset
|
590 const char* AutodetectMimeType(const std::string& path); |
2985 | 591 #endif |
2968 | 592 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
593 void LogError(const std::string& message); |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
594 |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
595 void LogWarning(const std::string& message); |
2057 | 596 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
597 void LogInfo(const std::string& message); |
2057 | 598 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
599 void ReportMinimalOrthancVersion(unsigned int major, |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2266
diff
changeset
|
600 unsigned int minor, |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2266
diff
changeset
|
601 unsigned int revision); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2266
diff
changeset
|
602 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
603 bool CheckMinimalOrthancVersion(unsigned int major, |
2109
d5c29fd74ffa
OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2062
diff
changeset
|
604 unsigned int minor, |
d5c29fd74ffa
OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2062
diff
changeset
|
605 unsigned int revision); |
d5c29fd74ffa
OrthancPlugins::CheckMinimalOrthancVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2062
diff
changeset
|
606 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
608 namespace Internals |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
609 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 template <RestCallback Callback> |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
611 static OrthancPluginErrorCode Protect(OrthancPluginRestOutput* output, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
612 const char* url, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
613 const OrthancPluginHttpRequest* request) |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 try |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
616 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
617 Callback(output, url, request); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
618 return OrthancPluginErrorCode_Success; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 } |
2239 | 620 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 { |
2959 | 622 #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
|
623 if (HasGlobalContext() && |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
624 e.HasDetails()) |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
625 { |
2961 | 626 // The "false" instructs Orthanc not to log the detailed |
627 // error message. This is to avoid duplicating the details, | |
628 // because "OrthancException" already does it on construction. | |
629 OrthancPluginSetHttpErrorDetails | |
3397
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
630 (GetGlobalContext(), output, e.GetDetails(), false); |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
631 } |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
632 #endif |
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
633 |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 } |
2056
e166a902b3c4
removal of warnings in msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2047
diff
changeset
|
636 catch (boost::bad_lexical_cast&) |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 return OrthancPluginErrorCode_BadFileFormat; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 catch (...) |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 return OrthancPluginErrorCode_Plugin; |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
644 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
645 } |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
648 template <RestCallback Callback> |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
649 void RegisterRestCallback(const std::string& uri, |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 bool isThreadSafe) |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 { |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 if (isThreadSafe) |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 { |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
654 OrthancPluginRegisterRestCallbackNoLock |
3397
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
655 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>); |
2047
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 else |
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
658 { |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
659 OrthancPluginRegisterRestCallback |
3397
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
660 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>); |
2047
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 } |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
663 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
664 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
665 #if HAS_ORTHANC_PLUGIN_PEERS == 1 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
666 class OrthancPeers : public boost::noncopyable |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
667 { |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
668 private: |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
669 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
|
670 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
671 OrthancPluginPeers *peers_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
672 Index index_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
673 uint32_t timeout_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
674 |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
675 size_t GetPeerIndex(const std::string& name) const; |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
676 |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
677 public: |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
678 OrthancPeers(); |
2817
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 ~OrthancPeers(); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
681 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
682 uint32_t GetTimeout() const |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
683 { |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
684 return timeout_; |
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 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
687 void SetTimeout(uint32_t timeout) |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
688 { |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
689 timeout_ = timeout; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
690 } |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
691 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
692 bool LookupName(size_t& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
693 const std::string& name) const; |
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 std::string GetPeerName(size_t index) const; |
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 std::string GetPeerUrl(size_t index) 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 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
|
700 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
701 size_t GetPeersCount() const |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
702 { |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
703 return index_.size(); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
704 } |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
705 |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
706 bool LookupUserProperty(std::string& value, |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
707 size_t index, |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
708 const std::string& key) const; |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
709 |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
710 bool LookupUserProperty(std::string& value, |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
711 const std::string& peer, |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
712 const std::string& key) const; |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2817
diff
changeset
|
713 |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
714 bool DoGet(MemoryBuffer& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
715 size_t index, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
716 const std::string& uri) 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 bool DoGet(MemoryBuffer& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
719 const std::string& name, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
720 const std::string& uri) const; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
721 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
722 bool DoGet(Json::Value& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
723 size_t index, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
724 const std::string& uri) const; |
2979 | 725 |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
726 bool DoGet(Json::Value& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
727 const std::string& name, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
728 const std::string& uri) const; |
2979 | 729 |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
730 bool DoPost(MemoryBuffer& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
731 size_t index, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
732 const std::string& uri, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
733 const std::string& body) const; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
734 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
735 bool DoPost(MemoryBuffer& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
736 const std::string& name, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
737 const std::string& uri, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
738 const std::string& body) const; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
739 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
740 bool DoPost(Json::Value& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
741 size_t index, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
742 const std::string& uri, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
743 const std::string& body) const; |
2979 | 744 |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
745 bool DoPost(Json::Value& target, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
746 const std::string& name, |
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 DoPut(size_t index, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
751 const std::string& uri, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
752 const std::string& body) const; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
753 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
754 bool DoPut(const std::string& name, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
755 const std::string& uri, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
756 const std::string& body) const; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
757 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
758 bool DoDelete(size_t index, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
759 const std::string& uri) const; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
760 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
761 bool DoDelete(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) const; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
763 }; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
764 #endif |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
765 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
766 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
767 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
768 #if HAS_ORTHANC_PLUGIN_JOB == 1 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
769 class OrthancJob : public boost::noncopyable |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
770 { |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
771 private: |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
772 std::string jobType_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
773 std::string content_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
774 bool hasSerialized_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
775 std::string serialized_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
776 float progress_; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
777 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
778 static void CallbackFinalize(void* job); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
779 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
780 static float CallbackGetProgress(void* job); |
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 static const char* CallbackGetContent(void* job); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
783 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
784 static const char* CallbackGetSerialized(void* job); |
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 static OrthancPluginJobStepStatus CallbackStep(void* job); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
787 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
788 static OrthancPluginErrorCode CallbackStop(void* job, |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
789 OrthancPluginJobStopReason reason); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
790 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
791 static OrthancPluginErrorCode CallbackReset(void* job); |
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 protected: |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
794 void ClearContent(); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
795 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
796 void UpdateContent(const Json::Value& content); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
797 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
798 void ClearSerialized(); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
799 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
800 void UpdateSerialized(const Json::Value& serialized); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
801 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
802 void UpdateProgress(float progress); |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
803 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
804 public: |
4256 | 805 explicit OrthancJob(const std::string& jobType); |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
806 |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
807 virtual ~OrthancJob() |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
808 { |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
809 } |
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 virtual OrthancPluginJobStepStatus Step() = 0; |
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 virtual void Stop(OrthancPluginJobStopReason reason) = 0; |
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 virtual void Reset() = 0; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
816 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
817 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
|
818 |
2958
bb7a66efbeb1
OrthancPlugins::SetGlobalContext() in OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2851
diff
changeset
|
819 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
|
820 int priority); |
3437
dbaf439c8888
OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3434
diff
changeset
|
821 |
dbaf439c8888
OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3434
diff
changeset
|
822 static void SubmitAndWait(Json::Value& result, |
dbaf439c8888
OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3434
diff
changeset
|
823 OrthancJob* job /* takes ownership */, |
dbaf439c8888
OrthancPlugins::OrthancJob::SubmitAndWait()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3434
diff
changeset
|
824 int priority); |
3667
c8d8c3b5f47c
OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
825 |
c8d8c3b5f47c
OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
826 // 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
|
827 // conventions as in the Orthanc core (according to the |
c8d8c3b5f47c
OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
828 // "Synchronous" and "Priority" options) |
c8d8c3b5f47c
OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
829 static void SubmitFromRestApiPost(OrthancPluginRestOutput* output, |
c8d8c3b5f47c
OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
830 const Json::Value& body, |
c8d8c3b5f47c
OrthancJob::SubmitFromRestApiPost()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
831 OrthancJob* job); |
2817
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
832 }; |
473bf302d629
C++ wrappers around OrthancPluginJob and OrthancPluginPeers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2803
diff
changeset
|
833 #endif |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
834 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
835 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
836 #if HAS_ORTHANC_PLUGIN_METRICS == 1 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
837 inline void SetMetricsValue(char* name, |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
838 float value) |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
839 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
840 OrthancPluginSetMetricsValue(GetGlobalContext(), name, |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
841 value, OrthancPluginMetricsType_Default); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
842 } |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
843 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
844 class MetricsTimer : public boost::noncopyable |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
845 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
846 private: |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
847 std::string name_; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
848 boost::posix_time::ptime start_; |
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 public: |
3796 | 851 explicit MetricsTimer(const char* name); |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
852 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
853 ~MetricsTimer(); |
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 #endif |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
856 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
857 |
3388 | 858 #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
|
859 class HttpClient : public boost::noncopyable |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
860 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
861 public: |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
862 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
|
863 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
864 class IRequestBody : public boost::noncopyable |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
865 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
866 public: |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
867 virtual ~IRequestBody() |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
868 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
869 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
870 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
871 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
|
872 }; |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
873 |
3438
d97ef941d521
compatibility mode for OrthancPlugins::HttpClient::IAnswer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3437
diff
changeset
|
874 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
875 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
|
876 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
877 public: |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
878 virtual ~IAnswer() |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
879 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
880 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
881 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
882 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
|
883 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
|
884 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
885 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
|
886 size_t size) = 0; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
887 }; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
888 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
889 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
890 private: |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
891 class RequestBodyWrapper; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
892 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
893 uint16_t httpStatus_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
894 OrthancPluginHttpMethod method_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
895 std::string url_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
896 HttpHeaders headers_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
897 std::string username_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
898 std::string password_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
899 uint32_t timeout_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
900 std::string certificateFile_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
901 std::string certificateKeyFile_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
902 std::string certificateKeyPassword_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
903 bool pkcs11_; |
3413 | 904 std::string fullBody_; |
3443
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
905 IRequestBody* chunkedBody_; |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
906 bool allowChunkedTransfers_; |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
907 |
3413 | 908 #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
|
909 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
|
910 IAnswer& answer, // out |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
911 IRequestBody& body) const; |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
912 #endif |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
913 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
914 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
|
915 HttpHeaders& answerHeaders, // out |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
916 std::string& answerBody, // out |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
917 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
|
918 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
919 public: |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
920 HttpClient(); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
921 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
922 uint16_t GetHttpStatus() const |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
923 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
924 return httpStatus_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
925 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
926 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
927 void SetMethod(OrthancPluginHttpMethod method) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
928 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
929 method_ = method; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
930 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
931 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
932 const std::string& GetUrl() const |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
933 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
934 return url_; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
935 } |
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 void SetUrl(const std::string& url) |
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 url_ = url; |
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 |
3424
07c3b6044e9d
OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3421
diff
changeset
|
942 void SetHeaders(const HttpHeaders& headers) |
07c3b6044e9d
OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3421
diff
changeset
|
943 { |
07c3b6044e9d
OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3421
diff
changeset
|
944 headers_ = headers; |
07c3b6044e9d
OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3421
diff
changeset
|
945 } |
07c3b6044e9d
OrthancPlugins::HttpClient::SetHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3421
diff
changeset
|
946 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
947 void AddHeader(const std::string& key, |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
948 const std::string& value) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
949 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
950 headers_[key] = value; |
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 |
3426
00737cd21f40
OrthancPlugins::HttpClient::AddHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3424
diff
changeset
|
953 void AddHeaders(const HttpHeaders& headers); |
00737cd21f40
OrthancPlugins::HttpClient::AddHeaders()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3424
diff
changeset
|
954 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
955 void SetCredentials(const std::string& username, |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
956 const std::string& password); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
957 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
958 void ClearCredentials(); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
959 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
960 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
|
961 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
962 timeout_ = timeout; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
963 } |
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 void SetCertificate(const std::string& certificateFile, |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
966 const std::string& keyFile, |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
967 const std::string& keyPassword); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
968 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
969 void ClearCertificate(); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
970 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
971 void SetPkcs11(bool pkcs11) |
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 pkcs11_ = pkcs11; |
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 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
976 void ClearBody(); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
977 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
978 void SwapBody(std::string& body); |
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 SetBody(const std::string& body); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
981 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
982 void SetBody(IRequestBody& body); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
983 |
3443
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
984 // 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
|
985 // remote server is Orthanc with a version <= 1.5.6. |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
986 void SetChunkedTransfersAllowed(bool allow) |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
987 { |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
988 allowChunkedTransfers_ = allow; |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
989 } |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
990 |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
991 bool IsChunkedTransfersAllowed() const |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
992 { |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
993 return allowChunkedTransfers_; |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
994 } |
0371b65d5f76
OrthancPlugins::HttpClient::SetChunkedTransfersAllowed()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3438
diff
changeset
|
995 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
996 void Execute(IAnswer& answer); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
997 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
998 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
|
999 std::string& answerBody /* out */); |
3420
0a0e7eca95ae
fix encoding in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3419
diff
changeset
|
1000 |
0a0e7eca95ae
fix encoding in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3419
diff
changeset
|
1001 void Execute(HttpHeaders& answerHeaders /* out */, |
0a0e7eca95ae
fix encoding in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3419
diff
changeset
|
1002 Json::Value& answerBody /* out */); |
3434 | 1003 |
1004 void Execute(); | |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3320
diff
changeset
|
1005 }; |
3388 | 1006 #endif |
3397
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1007 |
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1008 |
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1009 |
3414 | 1010 class IChunkedRequestReader : public boost::noncopyable |
3397
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1011 { |
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1012 public: |
3414 | 1013 virtual ~IChunkedRequestReader() |
3397
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1014 { |
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1015 } |
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1016 |
3414 | 1017 virtual void AddChunk(const void* data, |
1018 size_t size) = 0; | |
1019 | |
1020 virtual void Execute(OrthancPluginRestOutput* output) = 0; | |
1021 }; | |
1022 | |
1023 | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1024 typedef IChunkedRequestReader* (*ChunkedRestCallback) (const char* url, |
3414 | 1025 const OrthancPluginHttpRequest* request); |
1026 | |
1027 | |
1028 namespace Internals | |
1029 { | |
3416 | 1030 void NullRestCallback(OrthancPluginRestOutput* output, |
1031 const char* url, | |
1032 const OrthancPluginHttpRequest* request); | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1033 |
3416 | 1034 IChunkedRequestReader *NullChunkedRestCallback(const char* url, |
1035 const OrthancPluginHttpRequest* request); | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1036 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1037 |
3414 | 1038 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1 |
1039 template <ChunkedRestCallback Callback> | |
3418 | 1040 static OrthancPluginErrorCode ChunkedProtect(OrthancPluginServerChunkedRequestReader** reader, |
1041 const char* url, | |
1042 const OrthancPluginHttpRequest* request) | |
3414 | 1043 { |
1044 try | |
1045 { | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1046 if (reader == NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1047 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1048 return OrthancPluginErrorCode_InternalError; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1049 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1050 else |
3414 | 1051 { |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1052 *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
|
1053 if (*reader == NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1054 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1055 return OrthancPluginErrorCode_Plugin; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1056 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1057 else |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1058 { |
3414 | 1059 return OrthancPluginErrorCode_Success; |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1060 } |
3414 | 1061 } |
1062 } | |
1063 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) | |
1064 { | |
1065 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); | |
1066 } | |
1067 catch (boost::bad_lexical_cast&) | |
1068 { | |
1069 return OrthancPluginErrorCode_BadFileFormat; | |
1070 } | |
1071 catch (...) | |
1072 { | |
1073 return OrthancPluginErrorCode_Plugin; | |
1074 } | |
1075 } | |
1076 | |
3416 | 1077 OrthancPluginErrorCode ChunkedRequestReaderAddChunk( |
3414 | 1078 OrthancPluginServerChunkedRequestReader* reader, |
1079 const void* data, | |
3416 | 1080 uint32_t size); |
3397
9019279dbfd7
new plugin c++ wrapper: MultipartRestCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
1081 |
3416 | 1082 OrthancPluginErrorCode ChunkedRequestReaderExecute( |
3414 | 1083 OrthancPluginServerChunkedRequestReader* reader, |
3416 | 1084 OrthancPluginRestOutput* output); |
1085 | |
1086 void ChunkedRequestReaderFinalize( | |
1087 OrthancPluginServerChunkedRequestReader* reader); | |
3414 | 1088 |
3416 | 1089 #else |
3433
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1090 |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1091 OrthancPluginErrorCode ChunkedRestCompatibility(OrthancPluginRestOutput* output, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1092 const char* url, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1093 const OrthancPluginHttpRequest* request, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1094 RestCallback GetHandler, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1095 ChunkedRestCallback PostHandler, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1096 RestCallback DeleteHandler, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1097 ChunkedRestCallback PutHandler); |
3414 | 1098 |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1099 template< |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1100 RestCallback GetHandler, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1101 ChunkedRestCallback PostHandler, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1102 RestCallback DeleteHandler, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1103 ChunkedRestCallback PutHandler |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1104 > |
3433
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1105 inline OrthancPluginErrorCode ChunkedRestCompatibility(OrthancPluginRestOutput* output, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1106 const char* url, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1107 const OrthancPluginHttpRequest* request) |
3414 | 1108 { |
3433
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1109 return ChunkedRestCompatibility(output, url, request, GetHandler, |
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1110 PostHandler, DeleteHandler, PutHandler); |
3414 | 1111 } |
1112 #endif | |
1113 } | |
1114 | |
1115 | |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1116 |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1117 // 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
|
1118 // 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
|
1119 template< |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1120 RestCallback GetHandler = Internals::NullRestCallback, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1121 ChunkedRestCallback PostHandler = Internals::NullChunkedRestCallback, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1122 RestCallback DeleteHandler = Internals::NullRestCallback, |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1123 ChunkedRestCallback PutHandler = Internals::NullChunkedRestCallback |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1124 > |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1125 class ChunkedRestRegistration : public boost::noncopyable |
3414 | 1126 { |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1127 public: |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1128 static void Apply(const std::string& uri) |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1129 { |
3414 | 1130 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1 |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1131 OrthancPluginRegisterChunkedRestCallback( |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1132 GetGlobalContext(), uri.c_str(), |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1133 GetHandler == Internals::NullRestCallback ? NULL : Internals::Protect<GetHandler>, |
3418 | 1134 PostHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PostHandler>, |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1135 DeleteHandler == Internals::NullRestCallback ? NULL : Internals::Protect<DeleteHandler>, |
3418 | 1136 PutHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PutHandler>, |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1137 Internals::ChunkedRequestReaderAddChunk, |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1138 Internals::ChunkedRequestReaderExecute, |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1139 Internals::ChunkedRequestReaderFinalize); |
3414 | 1140 #else |
3433
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1141 OrthancPluginRegisterRestCallbackNoLock( |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1142 GetGlobalContext(), uri.c_str(), |
3433
caa526bb65cc
fixed C++ compatibility wrapper for OrthancPluginRegisterRestCallbackNoLock()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3426
diff
changeset
|
1143 Internals::ChunkedRestCompatibility<GetHandler, PostHandler, DeleteHandler, PutHandler>); |
3414 | 1144 #endif |
3417
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1145 } |
ad263225187c
fix for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3416
diff
changeset
|
1146 }; |
3664
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1147 |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1148 |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1149 |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1150 #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
|
1151 class IStorageCommitmentScpHandler : public boost::noncopyable |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1152 { |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1153 public: |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1154 virtual ~IStorageCommitmentScpHandler() |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1155 { |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1156 } |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1157 |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1158 virtual OrthancPluginStorageCommitmentFailureReason Lookup(const std::string& sopClassUid, |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1159 const std::string& sopInstanceUid) = 0; |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1160 |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1161 static OrthancPluginErrorCode Lookup(OrthancPluginStorageCommitmentFailureReason* target, |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1162 void* rawHandler, |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1163 const char* sopClassUid, |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1164 const char* sopInstanceUid); |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1165 |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1166 static void Destructor(void* rawHandler); |
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 #endif |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1169 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1170 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1171 class DicomInstance : public boost::noncopyable |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1172 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1173 private: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1174 bool toFree_; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1175 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1176 #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
|
1177 const OrthancPluginDicomInstance* instance_; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1178 #else |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1179 OrthancPluginDicomInstance* instance_; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1180 #endif |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1181 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1182 public: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1183 #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
|
1184 explicit DicomInstance(const OrthancPluginDicomInstance* instance); |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1185 #else |
4133
36c30a95bc3f
cppcheck on OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4122
diff
changeset
|
1186 explicit DicomInstance(OrthancPluginDicomInstance* instance); |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1187 #endif |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1188 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1189 #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
|
1190 DicomInstance(const void* buffer, |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1191 size_t size); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1192 #endif |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1193 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1194 ~DicomInstance(); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1195 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1196 std::string GetRemoteAet() const; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1197 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1198 const void* GetBuffer() const |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1199 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1200 return OrthancPluginGetInstanceData(GetGlobalContext(), instance_); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1201 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1202 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1203 size_t GetSize() const |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1204 { |
3963 | 1205 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
|
1206 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1207 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1208 void GetJson(Json::Value& target) const; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1209 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1210 void GetSimplifiedJson(Json::Value& target) const; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1211 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1212 OrthancPluginInstanceOrigin GetOrigin() const |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1213 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1214 return OrthancPluginGetInstanceOrigin(GetGlobalContext(), instance_); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1215 } |
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 #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
|
1218 std::string GetTransferSyntaxUid() const; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1219 #endif |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1220 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1221 #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
|
1222 bool HasPixelData() const; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1223 #endif |
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 #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
|
1226 unsigned int GetFramesCount() const |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1227 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1228 return OrthancPluginGetInstanceFramesCount(GetGlobalContext(), instance_); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1229 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1230 #endif |
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, 7, 0) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1233 void GetRawFrame(std::string& target, |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1234 unsigned int frameIndex) const; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1235 #endif |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1236 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1237 #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
|
1238 OrthancImage* GetDecodedFrame(unsigned int frameIndex) const; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1239 #endif |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1240 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1241 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0) |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1242 void Serialize(std::string& target) const; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1243 #endif |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1244 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1245 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0) |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1246 static DicomInstance* Transcode(const void* buffer, |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1247 size_t size, |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1248 const std::string& transferSyntax); |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
1249 #endif |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3915
diff
changeset
|
1250 }; |
2047
438f86ee19fc
toolbox shared by all plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1251 } |