annotate Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h @ 0:4e889a8e8be2

initial commit of the viewer plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Jul 2023 19:15:27 +0200
parents
children 42ebec01143b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "OrthancPluginException.h"
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <orthanc/OrthancCPlugin.h>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <boost/noncopyable.hpp>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <boost/lexical_cast.hpp>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include <boost/date_time/posix_time/posix_time.hpp>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <json/value.h>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include <vector>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include <list>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include <set>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include <map>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 /**
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 * The definition of ORTHANC_PLUGINS_VERSION_IS_ABOVE below is for
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 * backward compatibility with Orthanc SDK <= 1.3.0.
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 *
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 * $ hg diff -r Orthanc-1.3.0:Orthanc-1.3.1 ../../../Plugins/Include/orthanc/OrthancCPlugin.h
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 *
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 **/
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 #if !defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 #define ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(major, minor, revision) \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 (ORTHANC_VERSION_MAJOR > major || \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 (ORTHANC_VERSION_MAJOR == major && \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 (ORTHANC_VERSION_MINOR > minor || \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 (ORTHANC_VERSION_MINOR == minor && \
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ORTHANC_VERSION_REVISION >= revision))))
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 // The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 # define HAS_ORTHANC_PLUGIN_FIND_MATCHER 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 4, 2)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 # define HAS_ORTHANC_PLUGIN_PEERS 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 # define HAS_ORTHANC_PLUGIN_JOB 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 # define HAS_ORTHANC_PLUGIN_PEERS 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 # define HAS_ORTHANC_PLUGIN_JOB 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 # define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 # define HAS_ORTHANC_PLUGIN_METRICS 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 # define HAS_ORTHANC_PLUGIN_METRICS 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 1, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 # define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 # define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 # define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 # define HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 # define HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 10, 1)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 # define HAS_ORTHANC_PLUGIN_WEBDAV 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 # define HAS_ORTHANC_PLUGIN_WEBDAV 0
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 namespace OrthancPlugins
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 typedef void (*RestCallback) (OrthancPluginRestOutput* output,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 const OrthancPluginHttpRequest* request);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 void SetGlobalContext(OrthancPluginContext* context);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 bool HasGlobalContext();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 OrthancPluginContext* GetGlobalContext();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 class OrthancImage;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 class MemoryBuffer : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 OrthancPluginMemoryBuffer buffer_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 void Check(OrthancPluginErrorCode code);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 bool CheckHttp(OrthancPluginErrorCode code);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 MemoryBuffer();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 // This constructor makes a copy of the given buffer in the memory
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 // handled by the Orthanc core
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 MemoryBuffer(const void* buffer,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 size_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 ~MemoryBuffer()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 Clear();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 OrthancPluginMemoryBuffer* operator*()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 return &buffer_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 // This transfers ownership from "other" to "this"
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 void Assign(OrthancPluginMemoryBuffer& other);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 void Swap(MemoryBuffer& other);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 OrthancPluginMemoryBuffer Release();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 const char* GetData() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 if (buffer_.size > 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 return reinterpret_cast<const char*>(buffer_.data);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 return NULL;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 size_t GetSize() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 return buffer_.size;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 bool IsEmpty() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 return GetSize() == 0 || GetData() == NULL;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 void Clear();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 void ToString(std::string& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 void ToJson(Json::Value& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 bool RestApiGet(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 bool RestApiGet(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 const std::map<std::string, std::string>& httpHeaders,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 bool RestApiPost(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 const void* body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 size_t bodySize,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 bool RestApiPut(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 const void* body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 size_t bodySize,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 bool RestApiPost(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 const Json::Value& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 #if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 bool RestApiPost(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 const Json::Value& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 const std::map<std::string, std::string>& httpHeaders,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 bool RestApiPost(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 const void* body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 size_t bodySize,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 const std::map<std::string, std::string>& httpHeaders,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 bool RestApiPut(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 const Json::Value& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 bool RestApiPost(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 bool applyPlugins)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 return RestApiPost(uri, body.empty() ? NULL : body.c_str(), body.size(), applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 bool RestApiPut(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 bool applyPlugins)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 return RestApiPut(uri, body.empty() ? NULL : body.c_str(), body.size(), applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 void CreateDicom(const Json::Value& tags,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 OrthancPluginCreateDicomFlags flags);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 void CreateDicom(const Json::Value& tags,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 const OrthancImage& pixelData,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 OrthancPluginCreateDicomFlags flags);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 void ReadFile(const std::string& path);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 void GetDicomQuery(const OrthancPluginWorklistQuery* query);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 void DicomToJson(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 OrthancPluginDicomToJsonFormat format,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 OrthancPluginDicomToJsonFlags flags,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 uint32_t maxStringLength);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 bool HttpGet(const std::string& url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 const std::string& username,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 const std::string& password);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 bool HttpPost(const std::string& url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 const std::string& username,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 const std::string& password);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 bool HttpPut(const std::string& url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 const std::string& username,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 const std::string& password);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 void GetDicomInstance(const std::string& instanceId);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 class OrthancString : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 char* str_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 void Clear();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 OrthancString() :
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 str_(NULL)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 ~OrthancString()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 Clear();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 // This transfers ownership, warning: The string must have been
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 // allocated by the Orthanc core
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 void Assign(char* str);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 const char* GetContent() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 return str_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 bool IsNullOrEmpty() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 return str_ == NULL || str_[0] == 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 void ToString(std::string& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 void ToJson(Json::Value& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 void ToJsonWithoutComments(Json::Value& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 class OrthancConfiguration : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 Json::Value configuration_; // Necessarily a Json::objectValue
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 std::string path_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 std::string GetPath(const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 void LoadConfiguration();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 OrthancConfiguration(); // loads the full Orthanc configuration
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 explicit OrthancConfiguration(bool load);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 explicit OrthancConfiguration(const Json::Value& configuration, const std::string& path); // e.g. to load a section from a default json content
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 const Json::Value& GetJson() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 return configuration_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 bool IsSection(const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 void GetSection(OrthancConfiguration& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 bool LookupStringValue(std::string& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 bool LookupIntegerValue(int& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 bool LookupUnsignedIntegerValue(unsigned int& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 bool LookupBooleanValue(bool& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 bool LookupFloatValue(float& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 bool LookupListOfStrings(std::list<std::string>& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 bool allowSingleString) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 bool LookupSetOfStrings(std::set<std::string>& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 bool allowSingleString) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 std::string GetStringValue(const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 const std::string& defaultValue) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 int GetIntegerValue(const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 int defaultValue) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 unsigned int GetUnsignedIntegerValue(const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 unsigned int defaultValue) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 bool GetBooleanValue(const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 bool defaultValue) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 float GetFloatValue(const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 float defaultValue) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 void GetDictionary(std::map<std::string, std::string>& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 class OrthancImage : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 OrthancPluginImage* image_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 void Clear();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 void CheckImageAvailable() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 OrthancImage();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 explicit OrthancImage(OrthancPluginImage* image);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 OrthancImage(OrthancPluginPixelFormat format,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 uint32_t width,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 uint32_t height);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 OrthancImage(OrthancPluginPixelFormat format,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 uint32_t width,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 uint32_t height,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 uint32_t pitch,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 void* buffer);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 ~OrthancImage()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 Clear();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 void UncompressPngImage(const void* data,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 size_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 void UncompressJpegImage(const void* data,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 size_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 void DecodeDicomImage(const void* data,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 size_t size,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 unsigned int frame);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 OrthancPluginPixelFormat GetPixelFormat() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 unsigned int GetWidth() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 unsigned int GetHeight() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 unsigned int GetPitch() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 void* GetBuffer() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 const OrthancPluginImage* GetObject() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 return image_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 void CompressPngImage(MemoryBuffer& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 void CompressJpegImage(MemoryBuffer& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 uint8_t quality) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 void AnswerPngImage(OrthancPluginRestOutput* output) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 void AnswerJpegImage(OrthancPluginRestOutput* output,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 uint8_t quality) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 void* GetWriteableBuffer();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 OrthancPluginImage* Release();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 #if HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 class FindMatcher : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 OrthancPluginFindMatcher* matcher_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 const OrthancPluginWorklistQuery* worklist_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 void SetupDicom(const void* query,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 uint32_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 explicit FindMatcher(const OrthancPluginWorklistQuery* worklist);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 FindMatcher(const void* query,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 uint32_t size)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 SetupDicom(query, size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 explicit FindMatcher(const MemoryBuffer& dicom)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 SetupDicom(dicom.GetData(), dicom.GetSize());
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501 ~FindMatcher();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 bool IsMatch(const void* dicom,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 uint32_t size) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 bool IsMatch(const MemoryBuffer& dicom) const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 return IsMatch(dicom.GetData(), dicom.GetSize());
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 bool ReadJson(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 const std::string& source);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 bool ReadJson(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 const void* buffer,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 size_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 bool ReadJsonWithoutComments(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 const std::string& source);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 bool ReadJsonWithoutComments(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 const void* buffer,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 size_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 void WriteFastJson(std::string& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 const Json::Value& source);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 void WriteStyledJson(std::string& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 const Json::Value& source);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 bool RestApiGet(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 bool RestApiGet(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 const std::map<std::string, std::string>& httpHeaders,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 bool RestApiGetString(std::string& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 bool RestApiGetString(std::string& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 const std::map<std::string, std::string>& httpHeaders,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 bool RestApiPost(std::string& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 const void* body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555 size_t bodySize,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 bool RestApiPost(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 const void* body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 size_t bodySize,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 #if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 bool RestApiPost(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 const Json::Value& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 const std::map<std::string, std::string>& httpHeaders,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 bool RestApiPost(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 const Json::Value& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577 inline bool RestApiPost(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 bool applyPlugins)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 return RestApiPost(result, uri, body.empty() ? NULL : body.c_str(),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 body.size(), applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 inline bool RestApiPost(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 const MemoryBuffer& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 bool applyPlugins)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 return RestApiPost(result, uri, body.GetData(),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 body.GetSize(), applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 bool RestApiPut(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 const void* body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598 size_t bodySize,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 bool RestApiPut(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 const Json::Value& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 inline bool RestApiPut(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 bool applyPlugins)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 return RestApiPut(result, uri, body.empty() ? NULL : body.c_str(),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 body.size(), applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 bool RestApiDelete(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 bool applyPlugins);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 bool HttpDelete(const std::string& url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 const std::string& username,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 const std::string& password);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 void AnswerJson(const Json::Value& value,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 OrthancPluginRestOutput* output);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 void AnswerString(const std::string& answer,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 const char* mimeType,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 OrthancPluginRestOutput* output);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 void AnswerHttpError(uint16_t httpError,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 OrthancPluginRestOutput* output);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 void AnswerMethodNotAllowed(OrthancPluginRestOutput* output, const char* allowedMethods);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 const char* AutodetectMimeType(const std::string& path);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638 void LogError(const std::string& message);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 void LogWarning(const std::string& message);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 void LogInfo(const std::string& message);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 void ReportMinimalOrthancVersion(unsigned int major,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 unsigned int minor,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 unsigned int revision);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 bool CheckMinimalOrthancVersion(unsigned int major,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 unsigned int minor,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 unsigned int revision);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 bool CheckMinimalVersion(const char* version,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 unsigned int major,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 unsigned int minor,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 unsigned int revision);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 namespace Internals
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 template <RestCallback Callback>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 static OrthancPluginErrorCode Protect(OrthancPluginRestOutput* output,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 const OrthancPluginHttpRequest* request)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664 try
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 Callback(output, url, request);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 return OrthancPluginErrorCode_Success;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 #if HAS_ORTHANC_EXCEPTION == 1 && HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 if (HasGlobalContext() &&
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 e.HasDetails())
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 // The "false" instructs Orthanc not to log the detailed
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 // error message. This is to avoid duplicating the details,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 // because "OrthancException" already does it on construction.
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 OrthancPluginSetHttpErrorDetails
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 (GetGlobalContext(), output, e.GetDetails(), false);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 catch (boost::bad_lexical_cast&)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 return OrthancPluginErrorCode_BadFileFormat;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 catch (...)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 return OrthancPluginErrorCode_Plugin;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 template <RestCallback Callback>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 void RegisterRestCallback(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 bool isThreadSafe)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 if (isThreadSafe)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 OrthancPluginRegisterRestCallbackNoLock
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 OrthancPluginRegisterRestCallback
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709 (GetGlobalContext(), uri.c_str(), Internals::Protect<Callback>);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 #if HAS_ORTHANC_PLUGIN_PEERS == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 class OrthancPeers : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 typedef std::map<std::string, uint32_t> Index;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 OrthancPluginPeers *peers_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 Index index_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 uint32_t timeout_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724 size_t GetPeerIndex(const std::string& name) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 OrthancPeers();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 ~OrthancPeers();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 uint32_t GetTimeout() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 return timeout_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 void SetTimeout(uint32_t timeout)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738 timeout_ = timeout;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 bool LookupName(size_t& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 const std::string& name) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 std::string GetPeerName(size_t index) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 std::string GetPeerUrl(size_t index) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 std::string GetPeerUrl(const std::string& name) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750 size_t GetPeersCount() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752 return index_.size();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 bool LookupUserProperty(std::string& value,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 size_t index,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 bool LookupUserProperty(std::string& value,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 const std::string& peer,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 const std::string& key) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 bool DoGet(MemoryBuffer& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 size_t index,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 bool DoGet(MemoryBuffer& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 bool DoGet(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 size_t index,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 bool DoGet(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 bool DoPost(MemoryBuffer& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784 size_t index,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 bool DoPost(MemoryBuffer& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790 const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 bool DoPost(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 size_t index,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 bool DoPost(Json::Value& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
804 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807 bool DoPut(size_t index,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
808 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812 bool DoPut(const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814 const std::string& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
817 bool DoDelete(size_t index,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
819 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821 bool DoDelete(const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
822 const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823 const std::map<std::string, std::string>& headers) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
824 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
825 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 #if HAS_ORTHANC_PLUGIN_JOB == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 class OrthancJob : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
832 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
833 std::string jobType_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
834 std::string content_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835 bool hasSerialized_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836 std::string serialized_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
837 float progress_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839 static void CallbackFinalize(void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
840
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
841 static float CallbackGetProgress(void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
842
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 11, 3)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844 static OrthancPluginErrorCode CallbackGetContent(OrthancPluginMemoryBuffer* target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845 void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
846 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
847 static const char* CallbackGetContent(void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
848 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
849
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 11, 3)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851 static int32_t CallbackGetSerialized(OrthancPluginMemoryBuffer* target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
853 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854 static const char* CallbackGetSerialized(void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
855 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
857 static OrthancPluginJobStepStatus CallbackStep(void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
858
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
859 static OrthancPluginErrorCode CallbackStop(void* job,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
860 OrthancPluginJobStopReason reason);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
861
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
862 static OrthancPluginErrorCode CallbackReset(void* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
863
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
864 protected:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
865 void ClearContent();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
867 void UpdateContent(const Json::Value& content);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869 void ClearSerialized();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871 void UpdateSerialized(const Json::Value& serialized);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873 void UpdateProgress(float progress);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
874
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
875 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
876 explicit OrthancJob(const std::string& jobType);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
877
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878 virtual ~OrthancJob()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
880 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
881
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 virtual OrthancPluginJobStepStatus Step() = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
884 virtual void Stop(OrthancPluginJobStopReason reason) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
886 virtual void Reset() = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 static OrthancPluginJob* Create(OrthancJob* job /* takes ownership */);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
889
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
890 static std::string Submit(OrthancJob* job /* takes ownership */,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 int priority);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893 static void SubmitAndWait(Json::Value& result,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 OrthancJob* job /* takes ownership */,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895 int priority);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 // Submit a job from a POST on the REST API with the same
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
898 // conventions as in the Orthanc core (according to the
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 // "Synchronous" and "Priority" options)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 static void SubmitFromRestApiPost(OrthancPluginRestOutput* output,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 const Json::Value& body,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 OrthancJob* job);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 #if HAS_ORTHANC_PLUGIN_METRICS == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 inline void SetMetricsValue(char* name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 float value)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 OrthancPluginSetMetricsValue(GetGlobalContext(), name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912 value, OrthancPluginMetricsType_Default);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915 class MetricsTimer : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
916 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
917 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918 std::string name_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919 boost::posix_time::ptime start_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
921 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
922 explicit MetricsTimer(const char* name);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
923
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924 ~MetricsTimer();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929 #if HAS_ORTHANC_PLUGIN_HTTP_CLIENT == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930 class HttpClient : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933 typedef std::map<std::string, std::string> HttpHeaders;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
934
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 class IRequestBody : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 virtual ~IRequestBody()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
940 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942 virtual bool ReadNextChunk(std::string& chunk) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
944
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 class IAnswer : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
947 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
948 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
949 virtual ~IAnswer()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 virtual void AddHeader(const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 const std::string& value) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956 virtual void AddChunk(const void* data,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957 size_t size) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 class RequestBodyWrapper;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
964 uint16_t httpStatus_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
965 OrthancPluginHttpMethod method_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
966 std::string url_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967 HttpHeaders headers_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 std::string username_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
969 std::string password_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
970 uint32_t timeout_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
971 std::string certificateFile_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
972 std::string certificateKeyFile_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
973 std::string certificateKeyPassword_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
974 bool pkcs11_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975 std::string fullBody_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
976 IRequestBody* chunkedBody_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
977 bool allowChunkedTransfers_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
978
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
979 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
980 void ExecuteWithStream(uint16_t& httpStatus, // out
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
981 IAnswer& answer, // out
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
982 IRequestBody& body) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
983 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
984
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
985 void ExecuteWithoutStream(uint16_t& httpStatus, // out
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
986 HttpHeaders& answerHeaders, // out
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
987 std::string& answerBody, // out
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
988 const std::string& body) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
989
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
990 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
991 HttpClient();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
992
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
993 uint16_t GetHttpStatus() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
994 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
995 return httpStatus_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
996 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
997
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
998 void SetMethod(OrthancPluginHttpMethod method)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
999 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1000 method_ = method;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1001 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1002
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1003 const std::string& GetUrl() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1004 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1005 return url_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1006 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1007
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1008 void SetUrl(const std::string& url)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1009 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1010 url_ = url;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1011 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1012
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1013 void SetHeaders(const HttpHeaders& headers)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1014 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1015 headers_ = headers;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1016 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1017
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1018 void AddHeader(const std::string& key,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1019 const std::string& value)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1020 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1021 headers_[key] = value;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1022 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1023
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1024 void AddHeaders(const HttpHeaders& headers);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1025
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1026 void SetCredentials(const std::string& username,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1027 const std::string& password);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1028
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1029 void ClearCredentials();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1030
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1031 void SetTimeout(unsigned int timeout) // 0 for default timeout
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1032 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1033 timeout_ = timeout;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1035
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1036 void SetCertificate(const std::string& certificateFile,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1037 const std::string& keyFile,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1038 const std::string& keyPassword);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 void ClearCertificate();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042 void SetPkcs11(bool pkcs11)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044 pkcs11_ = pkcs11;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1045 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1046
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1047 void ClearBody();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1048
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1049 void SwapBody(std::string& body);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1050
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1051 void SetBody(const std::string& body);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1052
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1053 void SetBody(IRequestBody& body);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1054
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1055 // This function can be used to disable chunked transfers if the
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1056 // remote server is Orthanc with a version <= 1.5.6.
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1057 void SetChunkedTransfersAllowed(bool allow)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1058 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1059 allowChunkedTransfers_ = allow;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1060 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1061
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1062 bool IsChunkedTransfersAllowed() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1063 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1064 return allowChunkedTransfers_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1065 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1066
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1067 void Execute(IAnswer& answer);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1068
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1069 void Execute(HttpHeaders& answerHeaders /* out */,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1070 std::string& answerBody /* out */);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1071
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1072 void Execute(HttpHeaders& answerHeaders /* out */,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1073 Json::Value& answerBody /* out */);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1074
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1075 void Execute();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1076 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1077 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1078
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1079
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1080
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1081 class IChunkedRequestReader : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1082 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1083 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1084 virtual ~IChunkedRequestReader()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1085 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1086 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1087
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1088 virtual void AddChunk(const void* data,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1089 size_t size) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1090
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1091 virtual void Execute(OrthancPluginRestOutput* output) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1092 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1093
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1094
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1095 typedef IChunkedRequestReader* (*ChunkedRestCallback) (const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1096 const OrthancPluginHttpRequest* request);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1097
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1098
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1099 namespace Internals
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1100 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1101 void NullRestCallback(OrthancPluginRestOutput* output,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1102 const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1103 const OrthancPluginHttpRequest* request);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1104
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1105 IChunkedRequestReader *NullChunkedRestCallback(const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1106 const OrthancPluginHttpRequest* request);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1107
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1108
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1109 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1110 template <ChunkedRestCallback Callback>
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1111 static OrthancPluginErrorCode ChunkedProtect(OrthancPluginServerChunkedRequestReader** reader,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1112 const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1113 const OrthancPluginHttpRequest* request)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1114 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1115 try
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1116 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1117 if (reader == NULL)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1118 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1119 return OrthancPluginErrorCode_InternalError;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1120 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1121 else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1122 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1123 *reader = reinterpret_cast<OrthancPluginServerChunkedRequestReader*>(Callback(url, request));
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1124 if (*reader == NULL)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1125 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1126 return OrthancPluginErrorCode_Plugin;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1127 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1128 else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1129 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1130 return OrthancPluginErrorCode_Success;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1131 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1132 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1133 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1134 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1135 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1136 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1137 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1138 catch (boost::bad_lexical_cast&)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1139 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1140 return OrthancPluginErrorCode_BadFileFormat;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1141 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1142 catch (...)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144 return OrthancPluginErrorCode_Plugin;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1145 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1146 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1147
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1148 OrthancPluginErrorCode ChunkedRequestReaderAddChunk(
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1149 OrthancPluginServerChunkedRequestReader* reader,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1150 const void* data,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1151 uint32_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1152
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1153 OrthancPluginErrorCode ChunkedRequestReaderExecute(
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1154 OrthancPluginServerChunkedRequestReader* reader,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1155 OrthancPluginRestOutput* output);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1156
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1157 void ChunkedRequestReaderFinalize(
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1158 OrthancPluginServerChunkedRequestReader* reader);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1159
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1160 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1162 OrthancPluginErrorCode ChunkedRestCompatibility(OrthancPluginRestOutput* output,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1163 const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1164 const OrthancPluginHttpRequest* request,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1165 RestCallback GetHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1166 ChunkedRestCallback PostHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1167 RestCallback DeleteHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1168 ChunkedRestCallback PutHandler);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1169
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1170 template<
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1171 RestCallback GetHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1172 ChunkedRestCallback PostHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1173 RestCallback DeleteHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1174 ChunkedRestCallback PutHandler
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1175 >
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1176 inline OrthancPluginErrorCode ChunkedRestCompatibility(OrthancPluginRestOutput* output,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1177 const char* url,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1178 const OrthancPluginHttpRequest* request)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1179 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1180 return ChunkedRestCompatibility(output, url, request, GetHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1181 PostHandler, DeleteHandler, PutHandler);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1182 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1183 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1184 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1185
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1186
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1187
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1188 // NB: We use a templated class instead of a templated function, because
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1189 // default values are only available in functions since C++11
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1190 template<
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1191 RestCallback GetHandler = Internals::NullRestCallback,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1192 ChunkedRestCallback PostHandler = Internals::NullChunkedRestCallback,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1193 RestCallback DeleteHandler = Internals::NullRestCallback,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1194 ChunkedRestCallback PutHandler = Internals::NullChunkedRestCallback
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1195 >
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1196 class ChunkedRestRegistration : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1197 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1198 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1199 static void Apply(const std::string& uri)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1200 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1201 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1202 OrthancPluginRegisterChunkedRestCallback(
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1203 GetGlobalContext(), uri.c_str(),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204 GetHandler == Internals::NullRestCallback ? NULL : Internals::Protect<GetHandler>,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1205 PostHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PostHandler>,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1206 DeleteHandler == Internals::NullRestCallback ? NULL : Internals::Protect<DeleteHandler>,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1207 PutHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PutHandler>,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1208 Internals::ChunkedRequestReaderAddChunk,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1209 Internals::ChunkedRequestReaderExecute,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210 Internals::ChunkedRequestReaderFinalize);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1211 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1212 OrthancPluginRegisterRestCallbackNoLock(
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1213 GetGlobalContext(), uri.c_str(),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1214 Internals::ChunkedRestCompatibility<GetHandler, PostHandler, DeleteHandler, PutHandler>);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1215 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1216 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1217 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1218
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1219
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1220
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1221 #if HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1222 class IStorageCommitmentScpHandler : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1223 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1224 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1225 virtual ~IStorageCommitmentScpHandler()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1226 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1227 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1228
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1229 virtual OrthancPluginStorageCommitmentFailureReason Lookup(const std::string& sopClassUid,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1230 const std::string& sopInstanceUid) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1231
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1232 static OrthancPluginErrorCode Lookup(OrthancPluginStorageCommitmentFailureReason* target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1233 void* rawHandler,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1234 const char* sopClassUid,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1235 const char* sopInstanceUid);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1236
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1237 static void Destructor(void* rawHandler);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1238 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1239 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1240
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1241
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1242 class DicomInstance : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1243 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1244 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1245 bool toFree_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1246
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1247 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1248 const OrthancPluginDicomInstance* instance_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1249 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1250 OrthancPluginDicomInstance* instance_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1251 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1252
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1253 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1254 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1255 explicit DicomInstance(const OrthancPluginDicomInstance* instance);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1256 #else
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1257 explicit DicomInstance(OrthancPluginDicomInstance* instance);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1258 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1259
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1260 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1261 DicomInstance(const void* buffer,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1262 size_t size);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1263 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1264
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1265 ~DicomInstance();
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1266
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1267 const OrthancPluginDicomInstance* GetObject() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1268 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1269 return instance_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1270 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1271
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1272 std::string GetRemoteAet() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1273
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1274 const void* GetBuffer() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1275 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1276 return OrthancPluginGetInstanceData(GetGlobalContext(), instance_);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1277 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1278
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1279 size_t GetSize() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1280 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1281 return static_cast<size_t>(OrthancPluginGetInstanceSize(GetGlobalContext(), instance_));
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1282 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1283
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1284 void GetJson(Json::Value& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1285
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1286 void GetSimplifiedJson(Json::Value& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1287
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1288 OrthancPluginInstanceOrigin GetOrigin() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1289 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1290 return OrthancPluginGetInstanceOrigin(GetGlobalContext(), instance_);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1291 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1292
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1293 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1294 std::string GetTransferSyntaxUid() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1295 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1296
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1297 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 1)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1298 bool HasPixelData() const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1299 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1300
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1301 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1302 unsigned int GetFramesCount() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1303 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1304 return OrthancPluginGetInstanceFramesCount(GetGlobalContext(), instance_);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1305 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1306 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1307
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1308 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1309 void GetRawFrame(std::string& target,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1310 unsigned int frameIndex) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1311 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1312
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1313 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1314 OrthancImage* GetDecodedFrame(unsigned int frameIndex) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1315 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1316
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1317 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1318 void Serialize(std::string& target) const;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1319 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1320
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1321 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1322 static DicomInstance* Transcode(const void* buffer,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1323 size_t size,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1324 const std::string& transferSyntax);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1325 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1326
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1327 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 1)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1328 static DicomInstance* Load(const std::string& instanceId,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1329 OrthancPluginLoadDicomInstanceMode mode);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1330 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1331 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1332
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1333 // helper method to convert Http headers from the plugin SDK to a std::map
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1334 void GetHttpHeaders(std::map<std::string, std::string>& result, const OrthancPluginHttpRequest* request);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1335
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1336 #if HAS_ORTHANC_PLUGIN_WEBDAV == 1
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1337 class IWebDavCollection : public boost::noncopyable
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1338 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1339 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1340 class FileInfo
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1341 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1342 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1343 std::string name_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1344 uint64_t contentSize_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1345 std::string mime_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1346 std::string dateTime_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1347
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1348 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1349 FileInfo(const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1350 uint64_t contentSize,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1351 const std::string& dateTime) :
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1352 name_(name),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1353 contentSize_(contentSize),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1354 dateTime_(dateTime)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1355 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1356 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1357
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1358 const std::string& GetName() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1359 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1360 return name_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1361 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1362
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1363 uint64_t GetContentSize() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1364 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1365 return contentSize_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1366 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1367
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1368 void SetMimeType(const std::string& mime)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1369 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1370 mime_ = mime;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1371 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1372
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1373 const std::string& GetMimeType() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1374 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1375 return mime_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1376 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1377
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1378 const std::string& GetDateTime() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1379 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1380 return dateTime_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1381 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1382 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1383
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1384 class FolderInfo
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1385 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1386 private:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1387 std::string name_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1388 std::string dateTime_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1389
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1390 public:
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1391 FolderInfo(const std::string& name,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1392 const std::string& dateTime) :
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1393 name_(name),
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1394 dateTime_(dateTime)
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1395 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1396 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1397
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1398 const std::string& GetName() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1399 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1400 return name_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1401 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1402
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1403 const std::string& GetDateTime() const
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1404 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1405 return dateTime_;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1406 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1407 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1408
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1409 virtual ~IWebDavCollection()
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1410 {
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1411 }
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1412
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1413 virtual bool IsExistingFolder(const std::vector<std::string>& path) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1414
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1415 virtual bool ListFolder(std::list<FileInfo>& files,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1416 std::list<FolderInfo>& subfolders,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1417 const std::vector<std::string>& path) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1418
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1419 virtual bool GetFile(std::string& content /* out */,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1420 std::string& mime /* out */,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1421 std::string& dateTime /* out */,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1422 const std::vector<std::string>& path) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1423
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1424 virtual bool StoreFile(const std::vector<std::string>& path,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1425 const void* data,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1426 size_t size) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1427
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1428 virtual bool CreateFolder(const std::vector<std::string>& path) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1429
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1430 virtual bool DeleteItem(const std::vector<std::string>& path) = 0;
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1431
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1432 static void Register(const std::string& uri,
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1433 IWebDavCollection& collection);
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1434 };
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1435 #endif
4e889a8e8be2 initial commit of the viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1436 }