Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4524:f8660649ae96
added "/peers/{id}/store-straight": Synchronously send the DICOM instance in POST body to the peer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 23 Feb 2021 15:05:55 +0100 |
parents | 671ee7c1fd46 |
children | ff8170d17d90 c8f444e8556d |
rev | line source |
---|---|
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1282
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4394
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * License, or (at your option) any later version. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * program give permission to link the code of its release with the |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * in all respects for all of the code used other than "OpenSSL". If you |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * your version of the file(s), but you are not obligated to do so. If |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * you do not wish to do so, delete this exception statement from your |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * in the program, then also delete it here. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * This program is distributed in the hope that it will be useful, but |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * General Public License for more details. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 **/ |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
4045 | 34 #include "../../Sources/PrecompiledHeadersServer.h" |
1133 | 35 #include "OrthancPlugins.h" |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2135
diff
changeset
|
37 #if ORTHANC_ENABLE_PLUGINS != 1 |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
38 #error The plugin support is disabled |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
39 #endif |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
40 |
3118 | 41 #if !defined(DCMTK_VERSION_NUMBER) |
42 # error The macro DCMTK_VERSION_NUMBER must be defined | |
43 #endif | |
44 | |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
45 |
4045 | 46 #include "../../../OrthancFramework/Sources/Compression/GzipCompressor.h" |
47 #include "../../../OrthancFramework/Sources/Compression/ZlibCompressor.h" | |
48 #include "../../../OrthancFramework/Sources/DicomFormat/DicomArray.h" | |
49 #include "../../../OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.h" | |
50 #include "../../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" | |
51 #include "../../../OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.h" | |
52 #include "../../../OrthancFramework/Sources/DicomParsing/ToDcmtkBridge.h" | |
53 #include "../../../OrthancFramework/Sources/HttpServer/HttpToolbox.h" | |
54 #include "../../../OrthancFramework/Sources/Images/Image.h" | |
55 #include "../../../OrthancFramework/Sources/Images/ImageProcessing.h" | |
56 #include "../../../OrthancFramework/Sources/Images/JpegReader.h" | |
57 #include "../../../OrthancFramework/Sources/Images/JpegWriter.h" | |
58 #include "../../../OrthancFramework/Sources/Images/PngReader.h" | |
59 #include "../../../OrthancFramework/Sources/Images/PngWriter.h" | |
60 #include "../../../OrthancFramework/Sources/Logging.h" | |
4105
c02a2d9efbc2
move FromDcmtkBridge::ExecuteToDicom() to LuaFunctionCall, to remove dependency of DCMTK on Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4087
diff
changeset
|
61 #include "../../../OrthancFramework/Sources/Lua/LuaFunctionCall.h" |
4484
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
62 #include "../../../OrthancFramework/Sources/MallocMemoryBuffer.h" |
4045 | 63 #include "../../../OrthancFramework/Sources/MetricsRegistry.h" |
64 #include "../../../OrthancFramework/Sources/OrthancException.h" | |
65 #include "../../../OrthancFramework/Sources/SerializationToolbox.h" | |
4495
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
66 #include "../../../OrthancFramework/Sources/StringMemoryBuffer.h" |
4045 | 67 #include "../../../OrthancFramework/Sources/Toolbox.h" |
68 #include "../../Sources/OrthancConfiguration.h" | |
69 #include "../../Sources/OrthancFindRequestHandler.h" | |
70 #include "../../Sources/Search/HierarchicalMatcher.h" | |
71 #include "../../Sources/ServerContext.h" | |
72 #include "../../Sources/ServerToolbox.h" | |
1625 | 73 #include "PluginsEnumerations.h" |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
74 #include "PluginsJob.h" |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
3926
2910b0d30fe0
Allow concurrent calls to the custom image decoders provided by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3925
diff
changeset
|
76 #include <boost/regex.hpp> |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
77 #include <dcmtk/dcmdata/dcdict.h> |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
78 #include <dcmtk/dcmdata/dcdicent.h> |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
3414 | 80 #define ERROR_MESSAGE_64BIT "A 64bit version of the Orthanc API is necessary" |
81 | |
3926
2910b0d30fe0
Allow concurrent calls to the custom image decoders provided by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3925
diff
changeset
|
82 |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 namespace Orthanc |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 { |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
85 static void CopyToMemoryBuffer(OrthancPluginMemoryBuffer& target, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
86 const void* data, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
87 size_t size) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
88 { |
3414 | 89 if (static_cast<uint32_t>(size) != size) |
90 { | |
91 throw OrthancException(ErrorCode_NotEnoughMemory, ERROR_MESSAGE_64BIT); | |
92 } | |
93 | |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
94 target.size = size; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
95 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
96 if (size == 0) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
97 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
98 target.data = NULL; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
99 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
100 else |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
101 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
102 target.data = malloc(size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
103 if (target.data != NULL) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
104 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
105 memcpy(target.data, data, size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
106 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
107 else |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
108 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
109 throw OrthancException(ErrorCode_NotEnoughMemory); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
110 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
111 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
112 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
113 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
114 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
115 static void CopyToMemoryBuffer(OrthancPluginMemoryBuffer& target, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
116 const std::string& str) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
117 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
118 if (str.size() == 0) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
119 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
120 target.size = 0; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
121 target.data = NULL; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
122 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
123 else |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
124 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
125 CopyToMemoryBuffer(target, str.c_str(), str.size()); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
126 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
127 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
128 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
129 |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
130 static char* CopyString(const std::string& str) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
131 { |
3414 | 132 if (static_cast<uint32_t>(str.size()) != str.size()) |
133 { | |
134 throw OrthancException(ErrorCode_NotEnoughMemory, ERROR_MESSAGE_64BIT); | |
135 } | |
136 | |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
137 char *result = reinterpret_cast<char*>(malloc(str.size() + 1)); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
138 if (result == NULL) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
139 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
140 throw OrthancException(ErrorCode_NotEnoughMemory); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
141 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
142 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
143 if (str.size() == 0) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
144 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
145 result[0] = '\0'; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
146 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
147 else |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
148 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
149 memcpy(result, &str[0], str.size() + 1); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
150 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
151 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
152 return result; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
153 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
154 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
155 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
156 namespace |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
157 { |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
158 class MemoryBufferRaii : public boost::noncopyable |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
159 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
160 private: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
161 OrthancPluginMemoryBuffer buffer_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
162 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
163 public: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
164 MemoryBufferRaii() |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
165 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
166 buffer_.size = 0; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
167 buffer_.data = NULL; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
168 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
169 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
170 ~MemoryBufferRaii() |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
171 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
172 if (buffer_.size != 0) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
173 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
174 free(buffer_.data); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
175 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
176 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
177 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
178 OrthancPluginMemoryBuffer* GetObject() |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
179 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
180 return &buffer_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
181 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
182 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
183 void ToString(std::string& target) const |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
184 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
185 if ((buffer_.data == NULL && buffer_.size != 0) || |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
186 (buffer_.data != NULL && buffer_.size == 0)) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
187 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
188 throw OrthancException(ErrorCode_Plugin); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
189 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
190 else |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
191 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
192 target.resize(buffer_.size); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
193 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
194 if (buffer_.size != 0) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
195 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
196 memcpy(&target[0], buffer_.data, buffer_.size); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
197 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
198 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
199 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
200 }; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
201 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
202 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
203 class StorageAreaBase : public IStorageArea |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
204 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
205 private: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
206 OrthancPluginStorageCreate create_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
207 OrthancPluginStorageRemove remove_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
208 PluginsErrorDictionary& errorDictionary_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
209 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
210 protected: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
211 PluginsErrorDictionary& GetErrorDictionary() const |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
212 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
213 return errorDictionary_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
214 } |
4495
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
215 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
216 IMemoryBuffer* RangeFromWhole(const std::string& uuid, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
217 FileContentType type, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
218 uint64_t start /* inclusive */, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
219 uint64_t end /* exclusive */) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
220 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
221 if (start > end) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
222 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
223 throw OrthancException(ErrorCode_BadRange); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
224 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
225 else if (start == end) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
226 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
227 return new StringMemoryBuffer; // Empty |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
228 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
229 else |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
230 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
231 std::unique_ptr<IMemoryBuffer> whole(Read(uuid, type)); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
232 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
233 if (start == 0 && |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
234 end == whole->GetSize()) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
235 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
236 return whole.release(); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
237 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
238 else if (end > whole->GetSize()) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
239 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
240 throw OrthancException(ErrorCode_BadRange); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
241 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
242 else |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
243 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
244 std::string range; |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
245 range.resize(end - start); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
246 assert(!range.empty()); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
247 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
248 memcpy(&range[0], reinterpret_cast<const char*>(whole->GetData()) + start, range.size()); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
249 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
250 whole.reset(NULL); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
251 return StringMemoryBuffer::CreateFromSwap(range); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
252 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
253 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
254 } |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
255 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
256 public: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
257 StorageAreaBase(OrthancPluginStorageCreate create, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
258 OrthancPluginStorageRemove remove, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
259 PluginsErrorDictionary& errorDictionary) : |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
260 create_(create), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
261 remove_(remove), |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
262 errorDictionary_(errorDictionary) |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
263 { |
4483
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
264 if (create_ == NULL || |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
265 remove_ == NULL) |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
266 { |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
267 throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement all the required primitives"); |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
268 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
269 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
270 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
271 virtual void Create(const std::string& uuid, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
272 const void* content, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
273 size_t size, |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
274 FileContentType type) ORTHANC_OVERRIDE |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
275 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
276 OrthancPluginErrorCode error = create_ |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
277 (uuid.c_str(), content, size, Plugins::Convert(type)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
278 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
279 if (error != OrthancPluginErrorCode_Success) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
280 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
281 errorDictionary_.LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
282 throw OrthancException(static_cast<ErrorCode>(error)); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
283 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
284 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
285 |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
286 virtual void Remove(const std::string& uuid, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
287 FileContentType type) ORTHANC_OVERRIDE |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
288 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
289 OrthancPluginErrorCode error = remove_ |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
290 (uuid.c_str(), Plugins::Convert(type)); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
291 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
292 if (error != OrthancPluginErrorCode_Success) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
293 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
294 errorDictionary_.LogError(error, true); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
295 throw OrthancException(static_cast<ErrorCode>(error)); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
296 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
297 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
298 }; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
299 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
300 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
301 class PluginStorageArea : public StorageAreaBase |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
302 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
303 private: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
304 OrthancPluginStorageRead read_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
305 OrthancPluginFree free_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
306 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
307 void Free(void* buffer) const |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
308 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
309 if (buffer != NULL) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
310 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
311 free_(buffer); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
312 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
313 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
314 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
315 public: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
316 PluginStorageArea(const _OrthancPluginRegisterStorageArea& callbacks, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
317 PluginsErrorDictionary& errorDictionary) : |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
318 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
319 read_(callbacks.read), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
320 free_(callbacks.free) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
321 { |
4483
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
322 if (read_ == NULL) |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
323 { |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
324 throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement the \"Read\" primitive"); |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
325 } |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
326 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
327 |
4484
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
328 virtual IMemoryBuffer* Read(const std::string& uuid, |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
329 FileContentType type) ORTHANC_OVERRIDE |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
330 { |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
331 std::unique_ptr<MallocMemoryBuffer> result(new MallocMemoryBuffer); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
332 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
333 void* buffer = NULL; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
334 int64_t size = 0; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
335 |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
336 OrthancPluginErrorCode error = read_ |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
337 (&buffer, &size, uuid.c_str(), Plugins::Convert(type)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
338 |
4484
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
339 if (error == OrthancPluginErrorCode_Success) |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
340 { |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
341 result->Assign(buffer, size, free_); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
342 return result.release(); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
343 } |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
344 else |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
345 { |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
346 GetErrorDictionary().LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
347 throw OrthancException(static_cast<ErrorCode>(error)); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
348 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
349 } |
4495
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
350 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
351 virtual IMemoryBuffer* ReadRange(const std::string& uuid, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
352 FileContentType type, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
353 uint64_t start /* inclusive */, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
354 uint64_t end /* exclusive */) ORTHANC_OVERRIDE |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
355 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
356 return RangeFromWhole(uuid, type, start, end); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
357 } |
4498
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
358 |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
359 virtual bool HasReadRange() const ORTHANC_OVERRIDE |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
360 { |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
361 return false; |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
362 } |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
363 }; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
364 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
365 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
366 // New in Orthanc 1.9.0 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
367 class PluginStorageArea2 : public StorageAreaBase |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
368 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
369 private: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
370 OrthancPluginStorageReadWhole readWhole_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
371 OrthancPluginStorageReadRange readRange_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
372 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
373 public: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
374 PluginStorageArea2(const _OrthancPluginRegisterStorageArea2& callbacks, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
375 PluginsErrorDictionary& errorDictionary) : |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
376 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
377 readWhole_(callbacks.readWhole), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
378 readRange_(callbacks.readRange) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
379 { |
4483
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
380 if (readWhole_ == NULL) |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
381 { |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
382 throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement the \"ReadWhole\" primitive"); |
a926f8995d0b
sample for OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4477
diff
changeset
|
383 } |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
384 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
385 |
4484
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
386 virtual IMemoryBuffer* Read(const std::string& uuid, |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
387 FileContentType type) ORTHANC_OVERRIDE |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
388 { |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
389 std::unique_ptr<MallocMemoryBuffer> result(new MallocMemoryBuffer); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
390 |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
391 OrthancPluginMemoryBuffer64 buffer; |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
392 |
4484
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
393 OrthancPluginErrorCode error = readWhole_(&buffer, uuid.c_str(), Plugins::Convert(type)); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
394 |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
395 if (error == OrthancPluginErrorCode_Success) |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
396 { |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
397 result->Assign(buffer.data, buffer.size, ::free); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
398 return result.release(); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
399 } |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
400 else |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
401 { |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
402 GetErrorDictionary().LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
403 throw OrthancException(static_cast<ErrorCode>(error)); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
404 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
405 } |
4495
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
406 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
407 virtual IMemoryBuffer* ReadRange(const std::string& uuid, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
408 FileContentType type, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
409 uint64_t start /* inclusive */, |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
410 uint64_t end /* exclusive */) ORTHANC_OVERRIDE |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
411 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
412 if (readRange_ == NULL) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
413 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
414 return RangeFromWhole(uuid, type, start, end); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
415 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
416 else |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
417 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
418 if (start > end) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
419 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
420 throw OrthancException(ErrorCode_BadRange); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
421 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
422 else if (start == end) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
423 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
424 return new StringMemoryBuffer; |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
425 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
426 else |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
427 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
428 std::string range; |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
429 range.resize(end - start); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
430 assert(!range.empty()); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
431 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
432 OrthancPluginMemoryBuffer64 buffer; |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
433 buffer.data = &range[0]; |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
434 buffer.size = static_cast<uint64_t>(range.size()); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
435 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
436 OrthancPluginErrorCode error = |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
437 readRange_(&buffer, uuid.c_str(), Plugins::Convert(type), start); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
438 |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
439 if (error == OrthancPluginErrorCode_Success) |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
440 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
441 return StringMemoryBuffer::CreateFromSwap(range); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
442 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
443 else |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
444 { |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
445 GetErrorDictionary().LogError(error, true); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
446 throw OrthancException(static_cast<ErrorCode>(error)); |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
447 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
448 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
449 } |
fa2311f94d9f
IStorageArea::ReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4484
diff
changeset
|
450 } |
4498
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
451 |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
452 virtual bool HasReadRange() const ORTHANC_OVERRIDE |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
453 { |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
454 return (readRange_ != NULL); |
7b99e8bb8246
IStorageArea::HasReadRange()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4495
diff
changeset
|
455 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
456 }; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
457 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
458 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
459 class StorageAreaFactory : public boost::noncopyable |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
460 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
461 private: |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
462 enum Version |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
463 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
464 Version1, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
465 Version2 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
466 }; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
467 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
468 SharedLibrary& sharedLibrary_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
469 Version version_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
470 _OrthancPluginRegisterStorageArea callbacks_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
471 _OrthancPluginRegisterStorageArea2 callbacks2_; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
472 PluginsErrorDictionary& errorDictionary_; |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
473 |
4441
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
474 static void WarnNoReadRange() |
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
475 { |
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
476 LOG(WARNING) << "Performance warning: The storage area plugin doesn't implement reading of file ranges"; |
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
477 } |
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
478 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
479 public: |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
480 StorageAreaFactory(SharedLibrary& sharedLibrary, |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
481 const _OrthancPluginRegisterStorageArea& callbacks, |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
482 PluginsErrorDictionary& errorDictionary) : |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
483 sharedLibrary_(sharedLibrary), |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
484 version_(Version1), |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
485 callbacks_(callbacks), |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
486 errorDictionary_(errorDictionary) |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
487 { |
4441
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
488 WarnNoReadRange(); |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
489 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
490 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
491 StorageAreaFactory(SharedLibrary& sharedLibrary, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
492 const _OrthancPluginRegisterStorageArea2& callbacks, |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
493 PluginsErrorDictionary& errorDictionary) : |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
494 sharedLibrary_(sharedLibrary), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
495 version_(Version2), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
496 callbacks2_(callbacks), |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
497 errorDictionary_(errorDictionary) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
498 { |
4441
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
499 if (callbacks.readRange == NULL) |
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
500 { |
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
501 WarnNoReadRange(); |
453cd3a5a0da
better warning about no support of file ranges in storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4440
diff
changeset
|
502 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
503 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
504 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
505 SharedLibrary& GetSharedLibrary() |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
506 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
507 return sharedLibrary_; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
508 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
509 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
510 IStorageArea* Create() const |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
511 { |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
512 switch (version_) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
513 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
514 case Version1: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
515 return new PluginStorageArea(callbacks_, errorDictionary_); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
516 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
517 case Version2: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
518 return new PluginStorageArea2(callbacks2_, errorDictionary_); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
519 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
520 default: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
521 throw OrthancException(ErrorCode_InternalError); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
522 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
523 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
524 }; |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
525 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
526 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
527 class OrthancPeers : public boost::noncopyable |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
528 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
529 private: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
530 std::vector<std::string> names_; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
531 std::vector<WebServiceParameters> parameters_; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
532 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
533 void CheckIndex(size_t i) const |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
534 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
535 assert(names_.size() == parameters_.size()); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
536 if (i >= names_.size()) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
537 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
538 throw OrthancException(ErrorCode_ParameterOutOfRange); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
539 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
540 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
541 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
542 public: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
543 OrthancPeers() |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
544 { |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
545 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
546 |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
547 std::set<std::string> peers; |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
548 lock.GetConfiguration().GetListOfOrthancPeers(peers); |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
549 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
550 names_.reserve(peers.size()); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
551 parameters_.reserve(peers.size()); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
552 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
553 for (std::set<std::string>::const_iterator |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
554 it = peers.begin(); it != peers.end(); ++it) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
555 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
556 WebServiceParameters peer; |
2944
f395460af74d
simplifying OrthancConfiguration for modalities/peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
557 if (lock.GetConfiguration().LookupOrthancPeer(peer, *it)) |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
558 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
559 names_.push_back(*it); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
560 parameters_.push_back(peer); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
561 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
562 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
563 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
564 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
565 size_t GetPeersCount() const |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
566 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
567 return names_.size(); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
568 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
569 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
570 const std::string& GetPeerName(size_t i) const |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
571 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
572 CheckIndex(i); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
573 return names_[i]; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
574 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
575 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
576 const WebServiceParameters& GetPeerParameters(size_t i) const |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
577 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
578 CheckIndex(i); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
579 return parameters_[i]; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
580 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
581 }; |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
582 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
583 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
584 class DicomWebBinaryFormatter : public DicomWebJsonVisitor::IBinaryFormatter |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
585 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
586 private: |
3924
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
587 OrthancPluginDicomWebBinaryCallback oldCallback_; |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
588 OrthancPluginDicomWebBinaryCallback2 newCallback_; // New in Orthanc 1.7.0 |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
589 void* newPayload_; // New in Orthanc 1.7.0 |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
590 DicomWebJsonVisitor::BinaryMode currentMode_; |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
591 std::string currentBulkDataUri_; |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
592 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
593 static void Setter(OrthancPluginDicomWebNode* node, |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
594 OrthancPluginDicomWebBinaryMode mode, |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
595 const char* bulkDataUri) |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
596 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
597 DicomWebBinaryFormatter& that = *reinterpret_cast<DicomWebBinaryFormatter*>(node); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
598 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
599 switch (mode) |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
600 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
601 case OrthancPluginDicomWebBinaryMode_Ignore: |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
602 that.currentMode_ = DicomWebJsonVisitor::BinaryMode_Ignore; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
603 break; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
604 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
605 case OrthancPluginDicomWebBinaryMode_InlineBinary: |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
606 that.currentMode_ = DicomWebJsonVisitor::BinaryMode_InlineBinary; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
607 break; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
608 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
609 case OrthancPluginDicomWebBinaryMode_BulkDataUri: |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
610 if (bulkDataUri == NULL) |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
611 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
612 throw OrthancException(ErrorCode_NullPointer); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
613 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
614 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
615 that.currentBulkDataUri_ = bulkDataUri; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
616 that.currentMode_ = DicomWebJsonVisitor::BinaryMode_BulkDataUri; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
617 break; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
618 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
619 default: |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
620 throw OrthancException(ErrorCode_ParameterOutOfRange); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
621 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
622 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
623 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
624 public: |
4204 | 625 explicit DicomWebBinaryFormatter(OrthancPluginDicomWebBinaryCallback callback) : |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
626 oldCallback_(callback), |
3924
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
627 newCallback_(NULL), |
4204 | 628 newPayload_(NULL), |
629 currentMode_(DicomWebJsonVisitor::BinaryMode_Ignore) | |
3924
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
630 { |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
631 } |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
632 |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
633 DicomWebBinaryFormatter(OrthancPluginDicomWebBinaryCallback2 callback, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
634 void* payload) : |
3924
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
635 oldCallback_(NULL), |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
636 newCallback_(callback), |
4204 | 637 newPayload_(payload), |
638 currentMode_(DicomWebJsonVisitor::BinaryMode_Ignore) | |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
639 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
640 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
641 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
642 virtual DicomWebJsonVisitor::BinaryMode Format(std::string& bulkDataUri, |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
643 const std::vector<DicomTag>& parentTags, |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
644 const std::vector<size_t>& parentIndexes, |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
645 const DicomTag& tag, |
4204 | 646 ValueRepresentation vr) ORTHANC_OVERRIDE |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
647 { |
3924
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
648 if (oldCallback_ == NULL && |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
649 newCallback_ == NULL) |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
650 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
651 return DicomWebJsonVisitor::BinaryMode_InlineBinary; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
652 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
653 else |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
654 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
655 assert(parentTags.size() == parentIndexes.size()); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
656 std::vector<uint16_t> groups(parentTags.size()); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
657 std::vector<uint16_t> elements(parentTags.size()); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
658 std::vector<uint32_t> indexes(parentTags.size()); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
659 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
660 for (size_t i = 0; i < parentTags.size(); i++) |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
661 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
662 groups[i] = parentTags[i].GetGroup(); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
663 elements[i] = parentTags[i].GetElement(); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
664 indexes[i] = static_cast<uint32_t>(parentIndexes[i]); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
665 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
666 bool empty = parentTags.empty(); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
667 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
668 currentMode_ = DicomWebJsonVisitor::BinaryMode_Ignore; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
669 |
3924
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
670 if (oldCallback_ != NULL) |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
671 { |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
672 oldCallback_(reinterpret_cast<OrthancPluginDicomWebNode*>(this), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
673 DicomWebBinaryFormatter::Setter, |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
674 static_cast<uint32_t>(parentTags.size()), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
675 (empty ? NULL : &groups[0]), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
676 (empty ? NULL : &elements[0]), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
677 (empty ? NULL : &indexes[0]), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
678 tag.GetGroup(), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
679 tag.GetElement(), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
680 Plugins::Convert(vr)); |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
681 } |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
682 else |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
683 { |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
684 assert(newCallback_ != NULL); |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
685 newCallback_(reinterpret_cast<OrthancPluginDicomWebNode*>(this), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
686 DicomWebBinaryFormatter::Setter, |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
687 static_cast<uint32_t>(parentTags.size()), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
688 (empty ? NULL : &groups[0]), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
689 (empty ? NULL : &elements[0]), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
690 (empty ? NULL : &indexes[0]), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
691 tag.GetGroup(), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
692 tag.GetElement(), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
693 Plugins::Convert(vr), |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
694 newPayload_); |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
695 } |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
696 |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
697 bulkDataUri = currentBulkDataUri_; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
698 return currentMode_; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
699 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
700 } |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
701 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
702 void Apply(char** target, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
703 bool isJson, |
4204 | 704 const ParsedDicomFile& dicom) |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
705 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
706 DicomWebJsonVisitor visitor; |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
707 visitor.SetFormatter(*this); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
708 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
709 dicom.Apply(visitor); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
710 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
711 std::string s; |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
712 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
713 if (isJson) |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
714 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
715 s = visitor.GetResult().toStyledString(); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
716 } |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
717 else |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
718 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
719 visitor.FormatXml(s); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
720 } |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
721 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
722 *target = CopyString(s); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
723 } |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
724 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
725 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
726 void Apply(char** target, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
727 bool isJson, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
728 const void* dicom, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
729 size_t dicomSize) |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
730 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
731 ParsedDicomFile parsed(dicom, dicomSize); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
732 Apply(target, isJson, parsed); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
733 } |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
734 }; |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
735 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
736 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
737 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
738 class OrthancPlugins::PImpl |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
739 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
740 private: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
741 boost::mutex contextMutex_; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
742 ServerContext* context_; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
743 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
744 public: |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
745 class PluginHttpOutput : public boost::noncopyable |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
746 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
747 private: |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
748 enum MultipartState |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
749 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
750 MultipartState_None, |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
751 MultipartState_FirstPart, |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
752 MultipartState_SecondPart, |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
753 MultipartState_NextParts |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
754 }; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
755 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
756 HttpOutput& output_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
757 std::unique_ptr<std::string> errorDetails_; |
2960
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
758 bool logDetails_; |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
759 MultipartState multipartState_; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
760 std::string multipartSubType_; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
761 std::string multipartContentType_; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
762 std::string multipartFirstPart_; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
763 std::map<std::string, std::string> multipartFirstHeaders_; |
4204 | 764 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
765 public: |
4204 | 766 explicit PluginHttpOutput(HttpOutput& output) : |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
767 output_(output), |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
768 logDetails_(false), |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
769 multipartState_(MultipartState_None) |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
770 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
771 } |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
772 |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
773 HttpOutput& GetOutput() |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
774 { |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
775 if (multipartState_ == MultipartState_None) |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
776 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
777 return output_; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
778 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
779 else |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
780 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
781 // Must use "SendMultipartItem()" on multipart streams |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
782 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
783 } |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
784 } |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
785 |
2960
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
786 void SetErrorDetails(const std::string& details, |
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
787 bool logDetails) |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
788 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
789 errorDetails_.reset(new std::string(details)); |
2960
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
790 logDetails_ = logDetails; |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
791 } |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
792 |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
793 bool HasErrorDetails() const |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
794 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
795 return errorDetails_.get() != NULL; |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
796 } |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
797 |
2960
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
798 bool IsLogDetails() const |
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
799 { |
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
800 return logDetails_; |
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
801 } |
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
802 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
803 const std::string& GetErrorDetails() const |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
804 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
805 if (errorDetails_.get() == NULL) |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
806 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
807 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
808 } |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
809 else |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
810 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
811 return *errorDetails_; |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
812 } |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
813 } |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
814 |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
815 void StartMultipart(const char* subType, |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
816 const char* contentType) |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
817 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
818 if (multipartState_ != MultipartState_None) |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
819 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
820 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
821 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
822 else |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
823 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
824 multipartState_ = MultipartState_FirstPart; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
825 multipartSubType_ = subType; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
826 multipartContentType_ = contentType; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
827 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
828 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
829 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
830 void SendMultipartItem(const void* data, |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
831 size_t size, |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
832 const std::map<std::string, std::string>& headers) |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
833 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
834 if (size != 0 && data == NULL) |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
835 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
836 throw OrthancException(ErrorCode_NullPointer); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
837 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
838 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
839 switch (multipartState_) |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
840 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
841 case MultipartState_None: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
842 // Must call "StartMultipart()" before |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
843 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
844 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
845 case MultipartState_FirstPart: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
846 multipartFirstPart_.assign(reinterpret_cast<const char*>(data), size); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
847 multipartFirstHeaders_ = headers; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
848 multipartState_ = MultipartState_SecondPart; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
849 break; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
850 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
851 case MultipartState_SecondPart: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
852 // Start an actual stream for chunked transfer as soon as |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
853 // there are more than 2 elements in the multipart stream |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
854 output_.StartMultipart(multipartSubType_, multipartContentType_); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
855 output_.SendMultipartItem(multipartFirstPart_.c_str(), multipartFirstPart_.size(), |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
856 multipartFirstHeaders_); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
857 multipartFirstPart_.clear(); // Release memory |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
858 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
859 output_.SendMultipartItem(data, size, headers); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
860 multipartState_ = MultipartState_NextParts; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
861 break; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
862 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
863 case MultipartState_NextParts: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
864 output_.SendMultipartItem(data, size, headers); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
865 break; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
866 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
867 default: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
868 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
869 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
870 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
871 |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
872 void Close(OrthancPluginErrorCode error, |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
873 PluginsErrorDictionary& dictionary) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
874 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
875 if (error == OrthancPluginErrorCode_Success) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
876 { |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
877 switch (multipartState_) |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
878 { |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
879 case MultipartState_None: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
880 assert(!output_.IsWritingMultipart()); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
881 break; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
882 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
883 case MultipartState_FirstPart: // Multipart started, but no part was sent |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
884 case MultipartState_SecondPart: // Multipart started, first part is pending |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
885 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
886 assert(!output_.IsWritingMultipart()); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
887 std::vector<const void*> parts; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
888 std::vector<size_t> sizes; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
889 std::vector<const std::map<std::string, std::string>*> headers; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
890 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
891 if (multipartState_ == MultipartState_SecondPart) |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
892 { |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
893 parts.push_back(multipartFirstPart_.c_str()); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
894 sizes.push_back(multipartFirstPart_.size()); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
895 headers.push_back(&multipartFirstHeaders_); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
896 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
897 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
898 output_.AnswerMultipartWithoutChunkedTransfer(multipartSubType_, multipartContentType_, |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
899 parts, sizes, headers); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
900 break; |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
901 } |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
902 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
903 case MultipartState_NextParts: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
904 assert(output_.IsWritingMultipart()); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
905 output_.CloseMultipart(); |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
906 |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
907 default: |
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
908 throw OrthancException(ErrorCode_InternalError); |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
909 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
910 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
911 else |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
912 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
913 dictionary.LogError(error, false); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
914 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
915 if (HasErrorDetails()) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
916 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
917 throw OrthancException(static_cast<ErrorCode>(error), |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
918 GetErrorDetails(), |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
919 IsLogDetails()); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
920 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
921 else |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
922 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
923 throw OrthancException(static_cast<ErrorCode>(error)); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
924 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
925 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
926 } |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
927 }; |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
928 |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
929 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
930 class RestCallback : public boost::noncopyable |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
931 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
932 private: |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
933 boost::regex regex_; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
934 OrthancPluginRestCallback callback_; |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
935 bool mutualExclusion_; |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
936 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
937 OrthancPluginErrorCode InvokeInternal(PluginHttpOutput& output, |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
938 const std::string& flatUri, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
939 const OrthancPluginHttpRequest& request) |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
940 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
941 return callback_(reinterpret_cast<OrthancPluginRestOutput*>(&output), |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
942 flatUri.c_str(), |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
943 &request); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
944 } |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
945 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
946 public: |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
947 RestCallback(const char* regex, |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
948 OrthancPluginRestCallback callback, |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
949 bool mutualExclusion) : |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
950 regex_(regex), |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
951 callback_(callback), |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
952 mutualExclusion_(mutualExclusion) |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
953 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
954 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
955 |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
956 const boost::regex& GetRegularExpression() const |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
957 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
958 return regex_; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
959 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
960 |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
961 OrthancPluginErrorCode Invoke(boost::recursive_mutex& invokationMutex, |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
962 PluginHttpOutput& output, |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
963 const std::string& flatUri, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
964 const OrthancPluginHttpRequest& request) |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
965 { |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
966 if (mutualExclusion_) |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
967 { |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
968 boost::recursive_mutex::scoped_lock lock(invokationMutex); |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
969 return InvokeInternal(output, flatUri, request); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
970 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
971 else |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
972 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
973 return InvokeInternal(output, flatUri, request); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
974 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
975 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
976 }; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
977 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
978 |
3414 | 979 class ChunkedRestCallback : public boost::noncopyable |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
980 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
981 private: |
3414 | 982 _OrthancPluginChunkedRestCallback parameters_; |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
983 boost::regex regex_; |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
984 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
985 public: |
4223 | 986 explicit ChunkedRestCallback(const _OrthancPluginChunkedRestCallback& parameters) : |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
987 parameters_(parameters), |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
988 regex_(parameters.pathRegularExpression) |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
989 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
990 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
991 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
992 const boost::regex& GetRegularExpression() const |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
993 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
994 return regex_; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
995 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
996 |
3414 | 997 const _OrthancPluginChunkedRestCallback& GetParameters() const |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
998 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
999 return parameters_; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1000 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1001 }; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1002 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1003 |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1004 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1005 class StorageCommitmentScp : public IStorageCommitmentFactory |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1006 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1007 private: |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1008 class Handler : public IStorageCommitmentFactory::ILookupHandler |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1009 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1010 private: |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1011 _OrthancPluginRegisterStorageCommitmentScpCallback parameters_; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1012 void* handler_; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1013 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1014 public: |
4223 | 1015 Handler(const _OrthancPluginRegisterStorageCommitmentScpCallback& parameters, |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1016 void* handler) : |
3664
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3662
diff
changeset
|
1017 parameters_(parameters), |
85acfcc15829
sample storage commitment plugin, C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3662
diff
changeset
|
1018 handler_(handler) |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1019 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1020 if (handler == NULL) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1021 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1022 throw OrthancException(ErrorCode_NullPointer); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1023 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1024 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1025 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1026 virtual ~Handler() |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1027 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1028 assert(handler_ != NULL); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1029 parameters_.destructor(handler_); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1030 handler_ = NULL; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1031 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1032 |
4204 | 1033 virtual StorageCommitmentFailureReason Lookup( |
1034 const std::string& sopClassUid, | |
1035 const std::string& sopInstanceUid) ORTHANC_OVERRIDE | |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1036 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1037 assert(handler_ != NULL); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1038 OrthancPluginStorageCommitmentFailureReason reason = |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1039 OrthancPluginStorageCommitmentFailureReason_Success; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1040 OrthancPluginErrorCode error = parameters_.lookup( |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1041 &reason, handler_, sopClassUid.c_str(), sopInstanceUid.c_str()); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1042 if (error == OrthancPluginErrorCode_Success) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1043 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1044 return Plugins::Convert(reason); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1045 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1046 else |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1047 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1048 throw OrthancException(static_cast<ErrorCode>(error)); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1049 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1050 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1051 }; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1052 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1053 _OrthancPluginRegisterStorageCommitmentScpCallback parameters_; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1054 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1055 public: |
4223 | 1056 explicit StorageCommitmentScp(const _OrthancPluginRegisterStorageCommitmentScpCallback& parameters) : |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1057 parameters_(parameters) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1058 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1059 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1060 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1061 virtual ILookupHandler* CreateStorageCommitment( |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1062 const std::string& jobId, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1063 const std::string& transactionUid, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1064 const std::vector<std::string>& sopClassUids, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1065 const std::vector<std::string>& sopInstanceUids, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1066 const std::string& remoteAet, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1067 const std::string& calledAet) ORTHANC_OVERRIDE |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1068 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1069 const size_t n = sopClassUids.size(); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1070 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1071 if (sopInstanceUids.size() != n) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1072 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1073 throw OrthancException(ErrorCode_ParameterOutOfRange); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1074 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1075 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1076 std::vector<const char*> a, b; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1077 a.resize(n); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1078 b.resize(n); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1079 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1080 for (size_t i = 0; i < n; i++) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1081 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1082 a[i] = sopClassUids[i].c_str(); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1083 b[i] = sopInstanceUids[i].c_str(); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1084 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1085 |
3665
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1086 void* handler = NULL; |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1087 OrthancPluginErrorCode error = parameters_.factory( |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1088 &handler, jobId.c_str(), transactionUid.c_str(), |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1089 a.empty() ? NULL : &a[0], b.empty() ? NULL : &b[0], static_cast<uint32_t>(n), |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1090 remoteAet.c_str(), calledAet.c_str()); |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1091 |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1092 if (error != OrthancPluginErrorCode_Success) |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1093 { |
3665
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1094 throw OrthancException(static_cast<ErrorCode>(error)); |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1095 } |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1096 else if (handler == NULL) |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1097 { |
4c1d2ff7ddd0
handling of errors in storage commitment plugin factory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3664
diff
changeset
|
1098 // This plugin won't handle this storage commitment request |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1099 return NULL; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1100 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1101 else |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1102 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1103 return new Handler(parameters_, handler); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1104 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1105 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1106 }; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1107 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1108 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1109 class ServerContextLock |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1110 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1111 private: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1112 boost::mutex::scoped_lock lock_; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1113 ServerContext* context_; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1114 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1115 public: |
4204 | 1116 explicit ServerContextLock(PImpl& that) : |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1117 lock_(that.contextMutex_), |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1118 context_(that.context_) |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1119 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1120 if (context_ == NULL) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1121 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1122 throw OrthancException(ErrorCode_DatabaseNotInitialized); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1123 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1124 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1125 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1126 ServerContext& GetContext() |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1127 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1128 assert(context_ != NULL); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1129 return *context_; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1130 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1131 }; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1132 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1133 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1134 void SetServerContext(ServerContext* context) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1135 { |
2836
7133ad478eea
fix Debian warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2827
diff
changeset
|
1136 boost::mutex::scoped_lock lock(contextMutex_); |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1137 context_ = context; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1138 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1139 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1140 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1141 typedef std::pair<std::string, _OrthancPluginProperty> Property; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1142 typedef std::list<RestCallback*> RestCallbacks; |
3414 | 1143 typedef std::list<ChunkedRestCallback*> ChunkedRestCallbacks; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1144 typedef std::list<OrthancPluginOnStoredInstanceCallback> OnStoredCallbacks; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1145 typedef std::list<OrthancPluginOnChangeCallback> OnChangeCallbacks; |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
1146 typedef std::list<OrthancPluginIncomingHttpRequestFilter> IncomingHttpRequestFilters; |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
1147 typedef std::list<OrthancPluginIncomingHttpRequestFilter2> IncomingHttpRequestFilters2; |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
1148 typedef std::list<OrthancPluginIncomingDicomInstanceFilter> IncomingDicomInstanceFilters; |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
1149 typedef std::list<OrthancPluginDecodeImageCallback> DecodeImageCallbacks; |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
1150 typedef std::list<OrthancPluginTranscoderCallback> TranscoderCallbacks; |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
1151 typedef std::list<OrthancPluginJobsUnserializer> JobsUnserializers; |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
1152 typedef std::list<OrthancPluginRefreshMetricsCallback> RefreshMetricsCallbacks; |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1153 typedef std::list<StorageCommitmentScp*> StorageCommitmentScpCallbacks; |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
1154 typedef std::map<Property, std::string> Properties; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1155 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
1156 PluginsManager manager_; |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1157 |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1158 RestCallbacks restCallbacks_; |
3414 | 1159 ChunkedRestCallbacks chunkedRestCallbacks_; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1160 OnStoredCallbacks onStoredCallbacks_; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1161 OnChangeCallbacks onChangeCallbacks_; |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1162 OrthancPluginFindCallback findCallback_; |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
1163 OrthancPluginWorklistCallback worklistCallback_; |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
1164 DecodeImageCallbacks decodeImageCallbacks_; |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
1165 TranscoderCallbacks transcoderCallbacks_; |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
1166 JobsUnserializers jobsUnserializers_; |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1167 _OrthancPluginMoveCallback moveCallbacks_; |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
1168 IncomingHttpRequestFilters incomingHttpRequestFilters_; |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
1169 IncomingHttpRequestFilters2 incomingHttpRequestFilters2_; |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
1170 IncomingDicomInstanceFilters incomingDicomInstanceFilters_; |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
1171 RefreshMetricsCallbacks refreshMetricsCallbacks_; |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1172 StorageCommitmentScpCallbacks storageCommitmentScpCallbacks_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1173 std::unique_ptr<StorageAreaFactory> storageArea_; |
4343
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
1174 std::set<std::string> authorizationTokens_; |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1175 |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
1176 boost::recursive_mutex restCallbackInvokationMutex_; |
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
1177 boost::shared_mutex restCallbackRegistrationMutex_; // New in Orthanc 1.9.0 |
1466
0cd0f2ad3599
Fix potential deadlock in the callbacks of plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1452
diff
changeset
|
1178 boost::recursive_mutex storedCallbackMutex_; |
0cd0f2ad3599
Fix potential deadlock in the callbacks of plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1452
diff
changeset
|
1179 boost::recursive_mutex changeCallbackMutex_; |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1180 boost::mutex findCallbackMutex_; |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
1181 boost::mutex worklistCallbackMutex_; |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
1182 boost::shared_mutex decoderTranscoderMutex_; // Changed from "boost::mutex" in Orthanc 1.7.0 |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
1183 boost::mutex jobsUnserializersMutex_; |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
1184 boost::mutex refreshMetricsMutex_; |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1185 boost::mutex storageCommitmentScpMutex_; |
1553
7c4b487b3b4a
ensure mutual exclusion in InvokeService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1186 boost::recursive_mutex invokeServiceMutex_; |
4374
79ef2b6d8e76
there will be a 1.8.2 release before 1.9.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4364
diff
changeset
|
1187 boost::shared_mutex incomingHttpRequestFilterMutex_; // New in Orthanc 1.8.2 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1188 |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
1189 Properties properties_; |
1280
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1190 int argc_; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1191 char** argv_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1192 std::unique_ptr<OrthancPluginDatabase> database_; |
1644
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
1193 PluginsErrorDictionary dictionary_; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1194 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1195 PImpl() : |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1196 context_(NULL), |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1197 findCallback_(NULL), |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
1198 worklistCallback_(NULL), |
1280
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1199 argc_(1), |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1200 argv_(NULL) |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1201 { |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1202 memset(&moveCallbacks_, 0, sizeof(moveCallbacks_)); |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1203 } |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1204 }; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1205 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1206 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1207 |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1208 class OrthancPlugins::WorklistHandler : public IWorklistRequestHandler |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1209 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1210 private: |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1211 OrthancPlugins& that_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1212 std::unique_ptr<HierarchicalMatcher> matcher_; |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1213 std::unique_ptr<ParsedDicomFile> filtered_; |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1214 ParsedDicomFile* currentQuery_; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1215 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1216 void Reset() |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1217 { |
2827
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1218 matcher_.reset(); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1219 filtered_.reset(); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1220 currentQuery_ = NULL; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1221 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1222 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1223 public: |
4204 | 1224 explicit WorklistHandler(OrthancPlugins& that) : that_(that) |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1225 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1226 Reset(); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1227 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1228 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1229 virtual void Handle(DicomFindAnswers& answers, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1230 ParsedDicomFile& query, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1231 const std::string& remoteIp, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1232 const std::string& remoteAet, |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1233 const std::string& calledAet, |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1234 ModalityManufacturer manufacturer) ORTHANC_OVERRIDE |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1235 { |
4204 | 1236 { |
1237 static const char* LUA_CALLBACK = "IncomingWorklistRequestFilter"; | |
1238 | |
2827
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1239 PImpl::ServerContextLock lock(*that_.pimpl_); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1240 LuaScripting::Lock lua(lock.GetContext().GetLuaScripting()); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1241 |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1242 if (!lua.GetLua().IsExistingFunction(LUA_CALLBACK)) |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1243 { |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1244 currentQuery_ = &query; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1245 } |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1246 else |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1247 { |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1248 Json::Value source, origin; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1249 query.DatasetToJson(source, DicomToJsonFormat_Short, DicomToJsonFlags_None, 0); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1250 |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1251 OrthancFindRequestHandler::FormatOrigin |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1252 (origin, remoteIp, remoteAet, calledAet, manufacturer); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1253 |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1254 LuaFunctionCall call(lua.GetLua(), LUA_CALLBACK); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1255 call.PushJson(source); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1256 call.PushJson(origin); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1257 |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1258 Json::Value target; |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1259 call.ExecuteToJson(target, true); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1260 |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1261 filtered_.reset(ParsedDicomFile::CreateFromJson(target, DicomFromJsonFlags_None, |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1262 "" /* no private creator */)); |
2827
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1263 currentQuery_ = filtered_.get(); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1264 } |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1265 } |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1266 |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1267 matcher_.reset(new HierarchicalMatcher(*currentQuery_)); |
d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2823
diff
changeset
|
1268 |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1269 { |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
1270 boost::mutex::scoped_lock lock(that_.pimpl_->worklistCallbackMutex_); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1271 |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
1272 if (that_.pimpl_->worklistCallback_) |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1273 { |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
1274 OrthancPluginErrorCode error = that_.pimpl_->worklistCallback_ |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1275 (reinterpret_cast<OrthancPluginWorklistAnswers*>(&answers), |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1276 reinterpret_cast<const OrthancPluginWorklistQuery*>(this), |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1277 remoteAet.c_str(), |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1278 calledAet.c_str()); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1279 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1280 if (error != OrthancPluginErrorCode_Success) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1281 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1282 Reset(); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1283 that_.GetErrorDictionary().LogError(error, true); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1284 throw OrthancException(static_cast<ErrorCode>(error)); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1285 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1286 } |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1287 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1288 Reset(); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1289 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1290 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1291 |
1812 | 1292 void GetDicomQuery(OrthancPluginMemoryBuffer& target) const |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1293 { |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1294 if (currentQuery_ == NULL) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1295 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1296 throw OrthancException(ErrorCode_Plugin); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1297 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1298 |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1299 std::string dicom; |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1300 currentQuery_->SaveToMemoryBuffer(dicom); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1301 CopyToMemoryBuffer(target, dicom.c_str(), dicom.size()); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1302 } |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1303 |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1304 bool IsMatch(const void* dicom, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1305 size_t size) const |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1306 { |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1307 if (matcher_.get() == NULL) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1308 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1309 throw OrthancException(ErrorCode_Plugin); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1310 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1311 |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1312 ParsedDicomFile f(dicom, size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1313 return matcher_->Match(f); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1314 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1315 |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1316 void AddAnswer(OrthancPluginWorklistAnswers* answers, |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1317 const void* dicom, |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1318 size_t size) const |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1319 { |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1320 if (matcher_.get() == NULL) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1321 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1322 throw OrthancException(ErrorCode_Plugin); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1323 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1324 |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1325 ParsedDicomFile f(dicom, size); |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1326 std::unique_ptr<ParsedDicomFile> summary(matcher_->Extract(f)); |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
1327 reinterpret_cast<DicomFindAnswers*>(answers)->Add(*summary); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1328 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1329 }; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1330 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
1331 |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1332 class OrthancPlugins::FindHandler : public IFindRequestHandler |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1333 { |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1334 private: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1335 OrthancPlugins& that_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1336 std::unique_ptr<DicomArray> currentQuery_; |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1337 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1338 void Reset() |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1339 { |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1340 currentQuery_.reset(NULL); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1341 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1342 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1343 public: |
4204 | 1344 explicit FindHandler(OrthancPlugins& that) : that_(that) |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1345 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1346 Reset(); |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1347 } |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1348 |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1349 virtual void Handle(DicomFindAnswers& answers, |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1350 const DicomMap& input, |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1351 const std::list<DicomTag>& sequencesToReturn, |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1352 const std::string& remoteIp, |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1353 const std::string& remoteAet, |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1354 const std::string& calledAet, |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1355 ModalityManufacturer manufacturer) ORTHANC_OVERRIDE |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1356 { |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1357 DicomMap tmp; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1358 tmp.Assign(input); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1359 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1360 for (std::list<DicomTag>::const_iterator it = sequencesToReturn.begin(); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1361 it != sequencesToReturn.end(); ++it) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1362 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1363 if (!input.HasTag(*it)) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1364 { |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1365 tmp.SetValue(*it, "", false); |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1366 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1367 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1368 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1369 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1370 boost::mutex::scoped_lock lock(that_.pimpl_->findCallbackMutex_); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1371 currentQuery_.reset(new DicomArray(tmp)); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1372 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1373 if (that_.pimpl_->findCallback_) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1374 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1375 OrthancPluginErrorCode error = that_.pimpl_->findCallback_ |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1376 (reinterpret_cast<OrthancPluginFindAnswers*>(&answers), |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1377 reinterpret_cast<const OrthancPluginFindQuery*>(this), |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1378 remoteAet.c_str(), |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1379 calledAet.c_str()); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1380 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1381 if (error != OrthancPluginErrorCode_Success) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1382 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1383 Reset(); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1384 that_.GetErrorDictionary().LogError(error, true); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1385 throw OrthancException(static_cast<ErrorCode>(error)); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1386 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1387 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1388 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1389 Reset(); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1390 } |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1391 } |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1392 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1393 void Invoke(_OrthancPluginService service, |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1394 const _OrthancPluginFindOperation& operation) const |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1395 { |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1396 if (currentQuery_.get() == NULL) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1397 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1398 throw OrthancException(ErrorCode_Plugin); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1399 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1400 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1401 switch (service) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1402 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1403 case _OrthancPluginService_GetFindQuerySize: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1404 *operation.resultUint32 = currentQuery_->GetSize(); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1405 break; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1406 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1407 case _OrthancPluginService_GetFindQueryTag: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1408 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1409 const DicomTag& tag = currentQuery_->GetElement(operation.index).GetTag(); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1410 *operation.resultGroup = tag.GetGroup(); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1411 *operation.resultElement = tag.GetElement(); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1412 break; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1413 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1414 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1415 case _OrthancPluginService_GetFindQueryTagName: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1416 { |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
1417 const DicomElement& element = currentQuery_->GetElement(operation.index); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
1418 *operation.resultString = CopyString(FromDcmtkBridge::GetTagName(element)); |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1419 break; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1420 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1421 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1422 case _OrthancPluginService_GetFindQueryValue: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1423 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1424 *operation.resultString = CopyString(currentQuery_->GetElement(operation.index).GetValue().GetContent()); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1425 break; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1426 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1427 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1428 default: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1429 throw OrthancException(ErrorCode_InternalError); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1430 } |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1431 } |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1432 }; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
1433 |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1434 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1435 |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1436 class OrthancPlugins::MoveHandler : public IMoveRequestHandler |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1437 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1438 private: |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1439 class Driver : public IMoveRequestIterator |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1440 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1441 private: |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1442 void* driver_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1443 unsigned int count_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1444 unsigned int pos_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1445 OrthancPluginApplyMove apply_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1446 OrthancPluginFreeMove free_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1447 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1448 public: |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1449 Driver(void* driver, |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1450 unsigned int count, |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1451 OrthancPluginApplyMove apply, |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1452 OrthancPluginFreeMove free) : |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1453 driver_(driver), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1454 count_(count), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1455 pos_(0), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1456 apply_(apply), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1457 free_(free) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1458 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1459 if (driver_ == NULL) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1460 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1461 throw OrthancException(ErrorCode_Plugin); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1462 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1463 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1464 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1465 virtual ~Driver() |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1466 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1467 if (driver_ != NULL) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1468 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1469 free_(driver_); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1470 driver_ = NULL; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1471 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1472 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1473 |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1474 virtual unsigned int GetSubOperationCount() const ORTHANC_OVERRIDE |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1475 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1476 return count_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1477 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1478 |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1479 virtual Status DoNext() ORTHANC_OVERRIDE |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1480 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1481 if (pos_ >= count_) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1482 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1483 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1484 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1485 else |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1486 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1487 OrthancPluginErrorCode error = apply_(driver_); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1488 if (error != OrthancPluginErrorCode_Success) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1489 { |
2956 | 1490 LOG(ERROR) << "Error while doing C-Move from plugin: " |
1491 << EnumerationToString(static_cast<ErrorCode>(error)); | |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1492 return Status_Failure; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1493 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1494 else |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1495 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1496 pos_++; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1497 return Status_Success; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1498 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1499 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1500 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1501 }; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1502 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1503 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1504 _OrthancPluginMoveCallback params_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1505 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1506 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1507 static std::string ReadTag(const DicomMap& input, |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1508 const DicomTag& tag) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1509 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1510 const DicomValue* value = input.TestAndGetValue(tag); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1511 if (value != NULL && |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1512 !value->IsBinary() && |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1513 !value->IsNull()) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1514 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1515 return value->GetContent(); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1516 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1517 else |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1518 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1519 return std::string(); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1520 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1521 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1522 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1523 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1524 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1525 public: |
4204 | 1526 explicit MoveHandler(OrthancPlugins& that) |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1527 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1528 boost::recursive_mutex::scoped_lock lock(that.pimpl_->invokeServiceMutex_); |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1529 params_ = that.pimpl_->moveCallbacks_; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1530 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1531 if (params_.callback == NULL || |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1532 params_.getMoveSize == NULL || |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1533 params_.applyMove == NULL || |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1534 params_.freeMove == NULL) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1535 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1536 throw OrthancException(ErrorCode_Plugin); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1537 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1538 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1539 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1540 virtual IMoveRequestIterator* Handle(const std::string& targetAet, |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1541 const DicomMap& input, |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2215
diff
changeset
|
1542 const std::string& originatorIp, |
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2215
diff
changeset
|
1543 const std::string& originatorAet, |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1544 const std::string& calledAet, |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1545 uint16_t originatorId) ORTHANC_OVERRIDE |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1546 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1547 std::string levelString = ReadTag(input, DICOM_TAG_QUERY_RETRIEVE_LEVEL); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1548 std::string patientId = ReadTag(input, DICOM_TAG_PATIENT_ID); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1549 std::string accessionNumber = ReadTag(input, DICOM_TAG_ACCESSION_NUMBER); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1550 std::string studyInstanceUid = ReadTag(input, DICOM_TAG_STUDY_INSTANCE_UID); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1551 std::string seriesInstanceUid = ReadTag(input, DICOM_TAG_SERIES_INSTANCE_UID); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1552 std::string sopInstanceUid = ReadTag(input, DICOM_TAG_SOP_INSTANCE_UID); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1553 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1554 OrthancPluginResourceType level = OrthancPluginResourceType_None; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1555 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1556 if (!levelString.empty()) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1557 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1558 level = Plugins::Convert(StringToResourceType(levelString.c_str())); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1559 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1560 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1561 void* driver = params_.callback(level, |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1562 patientId.empty() ? NULL : patientId.c_str(), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1563 accessionNumber.empty() ? NULL : accessionNumber.c_str(), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1564 studyInstanceUid.empty() ? NULL : studyInstanceUid.c_str(), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1565 seriesInstanceUid.empty() ? NULL : seriesInstanceUid.c_str(), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1566 sopInstanceUid.empty() ? NULL : sopInstanceUid.c_str(), |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2215
diff
changeset
|
1567 originatorAet.c_str(), |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1568 calledAet.c_str(), |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1569 targetAet.c_str(), |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2215
diff
changeset
|
1570 originatorId); |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1571 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1572 if (driver == NULL) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1573 { |
2956 | 1574 throw OrthancException(ErrorCode_Plugin, |
1575 "Plugin cannot create a driver for an incoming C-MOVE request"); | |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1576 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1577 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1578 unsigned int size = params_.getMoveSize(driver); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1579 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1580 return new Driver(driver, size, params_.applyMove, params_.freeMove); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1581 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1582 }; |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1583 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1584 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1585 |
3414 | 1586 class OrthancPlugins::HttpClientChunkedRequest : public HttpClient::IRequestBody |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1587 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1588 private: |
3413 | 1589 const _OrthancPluginChunkedHttpClient& params_; |
1590 PluginsErrorDictionary& errorDictionary_; | |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1591 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1592 public: |
3414 | 1593 HttpClientChunkedRequest(const _OrthancPluginChunkedHttpClient& params, |
1594 PluginsErrorDictionary& errorDictionary) : | |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1595 params_(params), |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1596 errorDictionary_(errorDictionary) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1597 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1598 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1599 |
4204 | 1600 virtual bool ReadNextChunk(std::string& chunk) ORTHANC_OVERRIDE |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1601 { |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1602 if (params_.requestIsDone(params_.request)) |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1603 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1604 return false; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1605 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1606 else |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1607 { |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1608 size_t size = params_.requestChunkSize(params_.request); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1609 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1610 chunk.resize(size); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1611 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1612 if (size != 0) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1613 { |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1614 const void* data = params_.requestChunkData(params_.request); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1615 memcpy(&chunk[0], data, size); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1616 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1617 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1618 OrthancPluginErrorCode error = params_.requestNext(params_.request); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1619 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1620 if (error != OrthancPluginErrorCode_Success) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1621 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1622 errorDictionary_.LogError(error, true); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1623 throw OrthancException(static_cast<ErrorCode>(error)); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1624 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1625 else |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1626 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1627 return true; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1628 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1629 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1630 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
1631 }; |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1632 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
1633 |
3414 | 1634 class OrthancPlugins::HttpClientChunkedAnswer : public HttpClient::IAnswer |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1635 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1636 private: |
3413 | 1637 const _OrthancPluginChunkedHttpClient& params_; |
1638 PluginsErrorDictionary& errorDictionary_; | |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1639 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1640 public: |
3414 | 1641 HttpClientChunkedAnswer(const _OrthancPluginChunkedHttpClient& params, |
1642 PluginsErrorDictionary& errorDictionary) : | |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1643 params_(params), |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1644 errorDictionary_(errorDictionary) |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1645 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1646 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1647 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1648 virtual void AddHeader(const std::string& key, |
4204 | 1649 const std::string& value) ORTHANC_OVERRIDE |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1650 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1651 OrthancPluginErrorCode error = params_.answerAddHeader(params_.answer, key.c_str(), value.c_str()); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1652 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1653 if (error != OrthancPluginErrorCode_Success) |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1654 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1655 errorDictionary_.LogError(error, true); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1656 throw OrthancException(static_cast<ErrorCode>(error)); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1657 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1658 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1659 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1660 virtual void AddChunk(const void* data, |
4204 | 1661 size_t size) ORTHANC_OVERRIDE |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1662 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1663 OrthancPluginErrorCode error = params_.answerAddChunk(params_.answer, data, size); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1664 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1665 if (error != OrthancPluginErrorCode_Success) |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1666 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1667 errorDictionary_.LogError(error, true); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1668 throw OrthancException(static_cast<ErrorCode>(error)); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1669 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1670 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1671 }; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1672 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
1673 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1674 OrthancPlugins::OrthancPlugins() |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1675 { |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1676 /* Sanity check of the compiler */ |
1579
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1677 if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1678 sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1679 sizeof(int32_t) != sizeof(_OrthancPluginService) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1680 sizeof(int32_t) != sizeof(_OrthancPluginProperty) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1681 sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1682 sizeof(int32_t) != sizeof(OrthancPluginContentType) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1683 sizeof(int32_t) != sizeof(OrthancPluginResourceType) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1684 sizeof(int32_t) != sizeof(OrthancPluginChangeType) || |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1685 sizeof(int32_t) != sizeof(OrthancPluginImageFormat) || |
1579
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
1686 sizeof(int32_t) != sizeof(OrthancPluginCompressionType) || |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
1687 sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) || |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1688 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1689 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) || |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1690 sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) || |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1691 sizeof(int32_t) != sizeof(_OrthancPluginDatabaseAnswerType) || |
1760
51db4a25a741
LookupIdentifier is plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1744
diff
changeset
|
1692 sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) || |
1815
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
1693 sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin) || |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
1694 sizeof(int32_t) != sizeof(OrthancPluginJobStepStatus) || |
3209
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3205
diff
changeset
|
1695 sizeof(int32_t) != sizeof(OrthancPluginConstraintType) || |
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3205
diff
changeset
|
1696 sizeof(int32_t) != sizeof(OrthancPluginMetricsType) || |
f6374c36a671
documentation of DICOMweb in SDK, compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3205
diff
changeset
|
1697 sizeof(int32_t) != sizeof(OrthancPluginDicomWebBinaryMode) || |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1698 sizeof(int32_t) != sizeof(OrthancPluginStorageCommitmentFailureReason) || |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1699 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeBinary) != static_cast<int>(DicomToJsonFlags_IncludeBinary) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1700 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePrivateTags) != static_cast<int>(DicomToJsonFlags_IncludePrivateTags) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1701 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeUnknownTags) != static_cast<int>(DicomToJsonFlags_IncludeUnknownTags) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1702 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePixelData) != static_cast<int>(DicomToJsonFlags_IncludePixelData) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1703 static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToNull) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToNull) || |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1704 static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToAscii) || |
4514
5b929e6b3c36
removal of "dicom-as-json" attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
1705 static_cast<int>(OrthancPluginDicomToJsonFlags_StopAfterPixelData) != static_cast<int>(DicomToJsonFlags_StopAfterPixelData) || |
4516
671ee7c1fd46
added DicomToJsonFlags_SkipGroupLengths
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
1706 static_cast<int>(OrthancPluginDicomToJsonFlags_SkipGroupLengths) != static_cast<int>(DicomToJsonFlags_SkipGroupLengths) || |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1707 static_cast<int>(OrthancPluginCreateDicomFlags_DecodeDataUriScheme) != static_cast<int>(DicomFromJsonFlags_DecodeDataUriScheme) || |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1708 static_cast<int>(OrthancPluginCreateDicomFlags_GenerateIdentifiers) != static_cast<int>(DicomFromJsonFlags_GenerateIdentifiers)) |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1709 |
1578 | 1710 { |
1711 throw OrthancException(ErrorCode_Plugin); | |
1712 } | |
1713 | |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1714 pimpl_.reset(new PImpl()); |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
1715 pimpl_->manager_.RegisterServiceProvider(*this); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1716 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1717 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1718 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1719 void OrthancPlugins::SetServerContext(ServerContext& context) |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1720 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1721 pimpl_->SetServerContext(&context); |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1722 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1723 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1724 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1725 void OrthancPlugins::ResetServerContext() |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1726 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1727 pimpl_->SetServerContext(NULL); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1728 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
1729 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1730 |
1133 | 1731 OrthancPlugins::~OrthancPlugins() |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1732 { |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1733 for (PImpl::RestCallbacks::iterator it = pimpl_->restCallbacks_.begin(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1734 it != pimpl_->restCallbacks_.end(); ++it) |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1735 { |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1736 delete *it; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1737 } |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1738 |
3414 | 1739 for (PImpl::ChunkedRestCallbacks::iterator it = pimpl_->chunkedRestCallbacks_.begin(); |
1740 it != pimpl_->chunkedRestCallbacks_.end(); ++it) | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1741 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1742 delete *it; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1743 } |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1744 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1745 for (PImpl::StorageCommitmentScpCallbacks::iterator |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1746 it = pimpl_->storageCommitmentScpCallbacks_.begin(); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1747 it != pimpl_->storageCommitmentScpCallbacks_.end(); ++it) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1748 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1749 delete *it; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1750 } |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1751 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1752 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1753 |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1754 static void ArgumentsToPlugin(std::vector<const char*>& keys, |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1755 std::vector<const char*>& values, |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
1756 const HttpToolbox::Arguments& arguments) |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1757 { |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1758 keys.resize(arguments.size()); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1759 values.resize(arguments.size()); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1760 |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1761 size_t pos = 0; |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
1762 for (HttpToolbox::Arguments::const_iterator |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1763 it = arguments.begin(); it != arguments.end(); ++it) |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1764 { |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1765 keys[pos] = it->first.c_str(); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1766 values[pos] = it->second.c_str(); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1767 pos++; |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1768 } |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1769 } |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1770 |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
1771 |
1363
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1772 static void ArgumentsToPlugin(std::vector<const char*>& keys, |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1773 std::vector<const char*>& values, |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
1774 const HttpToolbox::GetArguments& arguments) |
1363
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1775 { |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1776 keys.resize(arguments.size()); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1777 values.resize(arguments.size()); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1778 |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1779 for (size_t i = 0; i < arguments.size(); i++) |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1780 { |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1781 keys[i] = arguments[i].first.c_str(); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1782 values[i] = arguments[i].second.c_str(); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1783 } |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1784 } |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1785 |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
1786 |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1787 namespace |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1788 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1789 class RestCallbackMatcher : public boost::noncopyable |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1790 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1791 private: |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1792 std::string flatUri_; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1793 std::vector<std::string> groups_; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1794 std::vector<const char*> cgroups_; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1795 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1796 public: |
4204 | 1797 explicit RestCallbackMatcher(const UriComponents& uri) : |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
1798 flatUri_(Toolbox::FlattenUri(uri)) |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1799 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1800 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1801 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1802 bool IsMatch(const boost::regex& re) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1803 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1804 // Check whether the regular expression associated to this |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1805 // callback matches the URI |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1806 boost::cmatch what; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1807 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1808 if (boost::regex_match(flatUri_.c_str(), what, re)) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1809 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1810 // Extract the value of the free parameters of the regular expression |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1811 if (what.size() > 1) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1812 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1813 groups_.resize(what.size() - 1); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1814 cgroups_.resize(what.size() - 1); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1815 for (size_t i = 1; i < what.size(); i++) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1816 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1817 groups_[i - 1] = what[i]; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1818 cgroups_[i - 1] = groups_[i - 1].c_str(); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1819 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1820 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1821 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1822 return true; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1823 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1824 else |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1825 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1826 // Not a match |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1827 return false; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1828 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1829 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1830 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1831 uint32_t GetGroupsCount() const |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1832 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1833 return cgroups_.size(); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1834 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1835 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1836 const char* const* GetGroups() const |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1837 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1838 return cgroups_.empty() ? NULL : &cgroups_[0]; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1839 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1840 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1841 const std::string& GetFlatUri() const |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1842 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1843 return flatUri_; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1844 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
1845 }; |
3414 | 1846 |
1847 | |
1848 // WARNING - The lifetime of this internal object must be smaller | |
1849 // than "matcher", "headers" and "getArguments" objects | |
1850 class HttpRequestConverter | |
1851 { | |
1852 private: | |
1853 std::vector<const char*> getKeys_; | |
1854 std::vector<const char*> getValues_; | |
1855 std::vector<const char*> headersKeys_; | |
1856 std::vector<const char*> headersValues_; | |
1857 OrthancPluginHttpRequest converted_; | |
1858 | |
1859 public: | |
1860 HttpRequestConverter(const RestCallbackMatcher& matcher, | |
1861 HttpMethod method, | |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
1862 const HttpToolbox::Arguments& headers) |
3414 | 1863 { |
1864 memset(&converted_, 0, sizeof(OrthancPluginHttpRequest)); | |
1865 | |
1866 ArgumentsToPlugin(headersKeys_, headersValues_, headers); | |
1867 assert(headersKeys_.size() == headersValues_.size()); | |
1868 | |
1869 switch (method) | |
1870 { | |
1871 case HttpMethod_Get: | |
1872 converted_.method = OrthancPluginHttpMethod_Get; | |
1873 break; | |
1874 | |
1875 case HttpMethod_Post: | |
1876 converted_.method = OrthancPluginHttpMethod_Post; | |
1877 break; | |
1878 | |
1879 case HttpMethod_Delete: | |
1880 converted_.method = OrthancPluginHttpMethod_Delete; | |
1881 break; | |
1882 | |
1883 case HttpMethod_Put: | |
1884 converted_.method = OrthancPluginHttpMethod_Put; | |
1885 break; | |
1886 | |
1887 default: | |
1888 throw OrthancException(ErrorCode_InternalError); | |
1889 } | |
1890 | |
1891 converted_.groups = matcher.GetGroups(); | |
1892 converted_.groupsCount = matcher.GetGroupsCount(); | |
1893 converted_.getCount = 0; | |
1894 converted_.getKeys = NULL; | |
1895 converted_.getValues = NULL; | |
1896 converted_.body = NULL; | |
1897 converted_.bodySize = 0; | |
1898 converted_.headersCount = headers.size(); | |
1899 | |
1900 if (headers.size() > 0) | |
1901 { | |
1902 converted_.headersKeys = &headersKeys_[0]; | |
1903 converted_.headersValues = &headersValues_[0]; | |
1904 } | |
1905 } | |
1906 | |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
1907 void SetGetArguments(const HttpToolbox::GetArguments& getArguments) |
3414 | 1908 { |
1909 ArgumentsToPlugin(getKeys_, getValues_, getArguments); | |
1910 assert(getKeys_.size() == getValues_.size()); | |
1911 | |
1912 converted_.getCount = getArguments.size(); | |
1913 | |
1914 if (getArguments.size() > 0) | |
1915 { | |
1916 converted_.getKeys = &getKeys_[0]; | |
1917 converted_.getValues = &getValues_[0]; | |
1918 } | |
1919 } | |
1920 | |
1921 OrthancPluginHttpRequest& GetRequest() | |
1922 { | |
1923 return converted_; | |
1924 } | |
1925 }; | |
1926 } | |
1927 | |
1928 | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1929 static std::string GetAllowedMethods(_OrthancPluginChunkedRestCallback parameters) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1930 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1931 std::string s; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1932 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1933 if (parameters.getHandler != NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1934 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1935 s += "GET"; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1936 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1937 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1938 if (parameters.postHandler != NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1939 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1940 if (!s.empty()) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1941 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1942 s+= ","; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1943 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1944 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1945 s += "POST"; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1946 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1947 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1948 if (parameters.deleteHandler != NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1949 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1950 if (!s.empty()) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1951 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1952 s+= ","; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1953 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1954 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1955 s += "DELETE"; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1956 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1957 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1958 if (parameters.putHandler != NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1959 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1960 if (!s.empty()) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1961 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1962 s+= ","; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1963 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1964 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1965 s += "PUT"; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1966 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1967 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1968 return s; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1969 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1970 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1971 |
3414 | 1972 bool OrthancPlugins::HandleChunkedGetDelete(HttpOutput& output, |
1973 HttpMethod method, | |
1974 const UriComponents& uri, | |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
1975 const HttpToolbox::Arguments& headers, |
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
1976 const HttpToolbox::GetArguments& getArguments) |
3414 | 1977 { |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1978 RestCallbackMatcher matcher(uri); |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1979 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1980 PImpl::ChunkedRestCallback* callback = NULL; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1981 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1982 // Loop over the callbacks registered by the plugins |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
1983 boost::shared_lock<boost::shared_mutex> lock(pimpl_->restCallbackRegistrationMutex_); |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1984 for (PImpl::ChunkedRestCallbacks::const_iterator it = pimpl_->chunkedRestCallbacks_.begin(); |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1985 it != pimpl_->chunkedRestCallbacks_.end(); ++it) |
3414 | 1986 { |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1987 if (matcher.IsMatch((*it)->GetRegularExpression())) |
3414 | 1988 { |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1989 callback = *it; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1990 break; |
3414 | 1991 } |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1992 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1993 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1994 if (callback == NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1995 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1996 return false; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1997 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1998 else |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
1999 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2000 CLOG(INFO, PLUGINS) << "Delegating HTTP request to plugin for URI: " << matcher.GetFlatUri(); |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2001 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2002 OrthancPluginRestCallback handler; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2003 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2004 switch (method) |
3414 | 2005 { |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2006 case HttpMethod_Get: |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2007 handler = callback->GetParameters().getHandler; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2008 break; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2009 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2010 case HttpMethod_Delete: |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2011 handler = callback->GetParameters().deleteHandler; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2012 break; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2013 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2014 default: |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2015 handler = NULL; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2016 break; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2017 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2018 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2019 if (handler == NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2020 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2021 output.SendMethodNotAllowed(GetAllowedMethods(callback->GetParameters())); |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2022 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2023 else |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2024 { |
3414 | 2025 HttpRequestConverter converter(matcher, method, headers); |
2026 converter.SetGetArguments(getArguments); | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2027 |
3414 | 2028 PImpl::PluginHttpOutput pluginOutput(output); |
2029 | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2030 OrthancPluginErrorCode error = handler( |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2031 reinterpret_cast<OrthancPluginRestOutput*>(&pluginOutput), |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2032 matcher.GetFlatUri().c_str(), &converter.GetRequest()); |
3414 | 2033 |
2034 pluginOutput.Close(error, GetErrorDictionary()); | |
2035 } | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2036 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
2037 return true; |
3414 | 2038 } |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2039 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2040 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2041 |
1133 | 2042 bool OrthancPlugins::Handle(HttpOutput& output, |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
2043 RequestOrigin /*origin*/, |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
2044 const char* /*remoteIp*/, |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
2045 const char* /*username*/, |
1329 | 2046 HttpMethod method, |
2047 const UriComponents& uri, | |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
2048 const HttpToolbox::Arguments& headers, |
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
2049 const HttpToolbox::GetArguments& getArguments, |
3401 | 2050 const void* bodyData, |
1446
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1445
diff
changeset
|
2051 size_t bodySize) |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2052 { |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2053 RestCallbackMatcher matcher(uri); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2054 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
2055 PImpl::RestCallback* callback = NULL; |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2056 |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
2057 // Loop over the callbacks registered by the plugins |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2058 boost::shared_lock<boost::shared_mutex> lock(pimpl_->restCallbackRegistrationMutex_); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2059 for (PImpl::RestCallbacks::const_iterator it = pimpl_->restCallbacks_.begin(); |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2060 it != pimpl_->restCallbacks_.end(); ++it) |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2061 { |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2062 if (matcher.IsMatch((*it)->GetRegularExpression())) |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2063 { |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
2064 callback = *it; |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2065 break; |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2066 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2067 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2068 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
2069 if (callback == NULL) |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2070 { |
3414 | 2071 // Callback not found, try to find a chunked callback |
2072 return HandleChunkedGetDelete(output, method, uri, headers, getArguments); | |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2073 } |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2074 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2075 CLOG(INFO, PLUGINS) << "Delegating HTTP request to plugin for URI: " << matcher.GetFlatUri(); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2076 |
3414 | 2077 HttpRequestConverter converter(matcher, method, headers); |
2078 converter.SetGetArguments(getArguments); | |
2079 converter.GetRequest().body = bodyData; | |
2080 converter.GetRequest().bodySize = bodySize; | |
2081 | |
2082 PImpl::PluginHttpOutput pluginOutput(output); | |
899 | 2083 |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
2084 assert(callback != NULL); |
2960
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
2085 OrthancPluginErrorCode error = callback->Invoke |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2086 (pimpl_->restCallbackInvokationMutex_, pluginOutput, matcher.GetFlatUri(), converter.GetRequest()); |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2087 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2088 pluginOutput.Close(error, GetErrorDictionary()); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2089 return true; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2090 } |
899 | 2091 |
2092 | |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2093 class OrthancPlugins::IDicomInstance : public boost::noncopyable |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2094 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2095 public: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2096 virtual ~IDicomInstance() |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2097 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2098 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2099 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2100 virtual bool CanBeFreed() const = 0; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2101 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2102 virtual const DicomInstanceToStore& GetInstance() const = 0; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2103 }; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2104 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2105 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2106 class OrthancPlugins::DicomInstanceFromCallback : public IDicomInstance |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2107 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2108 private: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2109 const DicomInstanceToStore& instance_; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2110 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2111 public: |
4204 | 2112 explicit DicomInstanceFromCallback(const DicomInstanceToStore& instance) : |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2113 instance_(instance) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2114 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2115 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2116 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2117 virtual bool CanBeFreed() const ORTHANC_OVERRIDE |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2118 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2119 return false; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2120 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2121 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2122 virtual const DicomInstanceToStore& GetInstance() const ORTHANC_OVERRIDE |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2123 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2124 return instance_; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2125 }; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2126 }; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2127 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2128 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2129 class OrthancPlugins::DicomInstanceFromBuffer : public IDicomInstance |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2130 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2131 private: |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2132 std::string buffer_; |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2133 std::unique_ptr<DicomInstanceToStore> instance_; |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2134 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2135 public: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2136 DicomInstanceFromBuffer(const void* buffer, |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2137 size_t size) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2138 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2139 buffer_.assign(reinterpret_cast<const char*>(buffer), size); |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2140 |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2141 instance_.reset(DicomInstanceToStore::CreateFromBuffer(buffer_)); |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2142 instance_->SetOrigin(DicomInstanceOrigin::FromPlugins()); |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2143 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2144 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2145 virtual bool CanBeFreed() const ORTHANC_OVERRIDE |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2146 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2147 return true; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2148 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2149 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2150 virtual const DicomInstanceToStore& GetInstance() const ORTHANC_OVERRIDE |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2151 { |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2152 return *instance_; |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2153 }; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2154 }; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2155 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2156 |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2157 class OrthancPlugins::DicomInstanceFromTranscoded : public IDicomInstance |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2158 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2159 private: |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2160 std::unique_ptr<ParsedDicomFile> parsed_; |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2161 std::unique_ptr<DicomInstanceToStore> instance_; |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2162 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2163 public: |
4204 | 2164 explicit DicomInstanceFromTranscoded(IDicomTranscoder::DicomImage& transcoded) : |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
2165 parsed_(transcoded.ReleaseAsParsedDicomFile()) |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2166 { |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2167 if (parsed_.get() == NULL) |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2168 { |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2169 throw OrthancException(ErrorCode_InternalError); |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2170 } |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2171 |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2172 instance_.reset(DicomInstanceToStore::CreateFromParsedDicomFile(*parsed_)); |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2173 instance_->SetOrigin(DicomInstanceOrigin::FromPlugins()); |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2174 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2175 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2176 virtual bool CanBeFreed() const ORTHANC_OVERRIDE |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2177 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2178 return true; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2179 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2180 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2181 virtual const DicomInstanceToStore& GetInstance() const ORTHANC_OVERRIDE |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2182 { |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
2183 return *instance_; |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2184 }; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2185 }; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2186 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
2187 |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
2188 void OrthancPlugins::SignalStoredInstance(const std::string& instanceId, |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2189 const DicomInstanceToStore& instance, |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
2190 const Json::Value& simplifiedTags) |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2191 { |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2192 DicomInstanceFromCallback wrapped(instance); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2193 |
1466
0cd0f2ad3599
Fix potential deadlock in the callbacks of plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1452
diff
changeset
|
2194 boost::recursive_mutex::scoped_lock lock(pimpl_->storedCallbackMutex_); |
1185
cbd1f05b4ef2
plugin callbacks are executed in mutual exclusion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
2195 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2196 for (PImpl::OnStoredCallbacks::const_iterator |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2197 callback = pimpl_->onStoredCallbacks_.begin(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2198 callback != pimpl_->onStoredCallbacks_.end(); ++callback) |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2199 { |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2200 OrthancPluginErrorCode error = (*callback) ( |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2201 reinterpret_cast<OrthancPluginDicomInstance*>(&wrapped), |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2202 instanceId.c_str()); |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2203 |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2204 if (error != OrthancPluginErrorCode_Success) |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2205 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
2206 GetErrorDictionary().LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
2207 throw OrthancException(static_cast<ErrorCode>(error)); |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2208 } |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2209 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2210 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2211 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2212 |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2213 bool OrthancPlugins::FilterIncomingInstance(const DicomInstanceToStore& instance, |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2214 const Json::Value& simplified) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2215 { |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2216 DicomInstanceFromCallback wrapped(instance); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2217 |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2218 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2219 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2220 for (PImpl::IncomingDicomInstanceFilters::const_iterator |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2221 filter = pimpl_->incomingDicomInstanceFilters_.begin(); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2222 filter != pimpl_->incomingDicomInstanceFilters_.end(); ++filter) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2223 { |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2224 int32_t allowed = (*filter) (reinterpret_cast<const OrthancPluginDicomInstance*>(&wrapped)); |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2225 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2226 if (allowed == 0) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2227 { |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2228 return false; |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2229 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2230 else if (allowed != 1) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2231 { |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2232 // The callback is only allowed to answer 0 or 1 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2233 throw OrthancException(ErrorCode_Plugin); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2234 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2235 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2236 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2237 return true; |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2238 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2239 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2240 |
1741
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2241 void OrthancPlugins::SignalChangeInternal(OrthancPluginChangeType changeType, |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2242 OrthancPluginResourceType resourceType, |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2243 const char* resource) |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2244 { |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2245 boost::recursive_mutex::scoped_lock lock(pimpl_->changeCallbackMutex_); |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
2246 |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2247 for (std::list<OrthancPluginOnChangeCallback>::const_iterator |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2248 callback = pimpl_->onChangeCallbacks_.begin(); |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2249 callback != pimpl_->onChangeCallbacks_.end(); ++callback) |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2250 { |
1741
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2251 OrthancPluginErrorCode error = (*callback) (changeType, resourceType, resource); |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2252 |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
2253 if (error != OrthancPluginErrorCode_Success) |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
2254 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
2255 GetErrorDictionary().LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
2256 throw OrthancException(static_cast<ErrorCode>(error)); |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
2257 } |
1178 | 2258 } |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2259 } |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2260 |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2261 |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2262 |
1741
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2263 void OrthancPlugins::SignalChange(const ServerIndexChange& change) |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2264 { |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2265 SignalChangeInternal(Plugins::Convert(change.GetChangeType()), |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2266 Plugins::Convert(change.GetResourceType()), |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2267 change.GetPublicId().c_str()); |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2268 } |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2269 |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2270 |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
2271 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
2272 void OrthancPlugins::RegisterRestCallback(const void* parameters, |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2273 bool mutualExclusion) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2274 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2275 const _OrthancPluginRestCallback& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2276 *reinterpret_cast<const _OrthancPluginRestCallback*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2277 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2278 CLOG(INFO, PLUGINS) << "Plugin has registered a REST callback " |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2279 << (mutualExclusion ? "with" : "without") |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2280 << " mutual exclusion on: " |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2281 << p.pathRegularExpression; |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
2282 |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2283 { |
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2284 boost::unique_lock<boost::shared_mutex> lock(pimpl_->restCallbackRegistrationMutex_); |
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2285 pimpl_->restCallbacks_.push_back(new PImpl::RestCallback(p.pathRegularExpression, p.callback, mutualExclusion)); |
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2286 } |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2287 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2288 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2289 |
3414 | 2290 void OrthancPlugins::RegisterChunkedRestCallback(const void* parameters) |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2291 { |
3414 | 2292 const _OrthancPluginChunkedRestCallback& p = |
2293 *reinterpret_cast<const _OrthancPluginChunkedRestCallback*>(parameters); | |
2294 | |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2295 CLOG(INFO, PLUGINS) << "Plugin has registered a REST callback for chunked streams on: " |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2296 << p.pathRegularExpression; |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2297 |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2298 { |
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2299 boost::unique_lock<boost::shared_mutex> lock(pimpl_->restCallbackRegistrationMutex_); |
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2300 pimpl_->chunkedRestCallbacks_.push_back(new PImpl::ChunkedRestCallback(p)); |
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
2301 } |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2302 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
2303 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2304 |
1133 | 2305 void OrthancPlugins::RegisterOnStoredInstanceCallback(const void* parameters) |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2306 { |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2307 const _OrthancPluginOnStoredInstanceCallback& p = |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2308 *reinterpret_cast<const _OrthancPluginOnStoredInstanceCallback*>(parameters); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2309 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2310 CLOG(INFO, PLUGINS) << "Plugin has registered an OnStoredInstance callback"; |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2311 pimpl_->onStoredCallbacks_.push_back(p.callback); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2312 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2313 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2314 |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2315 void OrthancPlugins::RegisterOnChangeCallback(const void* parameters) |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2316 { |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2317 const _OrthancPluginOnChangeCallback& p = |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2318 *reinterpret_cast<const _OrthancPluginOnChangeCallback*>(parameters); |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2319 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2320 CLOG(INFO, PLUGINS) << "Plugin has registered an OnChange callback"; |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2321 pimpl_->onChangeCallbacks_.push_back(p.callback); |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2322 } |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2323 |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
2324 |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2325 void OrthancPlugins::RegisterWorklistCallback(const void* parameters) |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2326 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2327 const _OrthancPluginWorklistCallback& p = |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2328 *reinterpret_cast<const _OrthancPluginWorklistCallback*>(parameters); |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2329 |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2330 boost::mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_); |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2331 |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2332 if (pimpl_->worklistCallback_ != NULL) |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2333 { |
2956 | 2334 throw OrthancException(ErrorCode_Plugin, |
2335 "Can only register one plugin to handle modality worklists"); | |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2336 } |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2337 else |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2338 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2339 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to handle modality worklists"; |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2340 pimpl_->worklistCallback_ = p.callback; |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2341 } |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2342 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2343 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2344 |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2345 void OrthancPlugins::RegisterFindCallback(const void* parameters) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2346 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2347 const _OrthancPluginFindCallback& p = |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2348 *reinterpret_cast<const _OrthancPluginFindCallback*>(parameters); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2349 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2350 boost::mutex::scoped_lock lock(pimpl_->findCallbackMutex_); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2351 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2352 if (pimpl_->findCallback_ != NULL) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2353 { |
2956 | 2354 throw OrthancException(ErrorCode_Plugin, |
2355 "Can only register one plugin to handle C-FIND requests"); | |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2356 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2357 else |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2358 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2359 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to handle C-FIND requests"; |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2360 pimpl_->findCallback_ = p.callback; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2361 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2362 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2363 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
2364 |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2365 void OrthancPlugins::RegisterMoveCallback(const void* parameters) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2366 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2367 // invokeServiceMutex_ is assumed to be locked |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2368 |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2369 const _OrthancPluginMoveCallback& p = |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2370 *reinterpret_cast<const _OrthancPluginMoveCallback*>(parameters); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2371 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2372 if (pimpl_->moveCallbacks_.callback != NULL) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2373 { |
2956 | 2374 throw OrthancException(ErrorCode_Plugin, |
2375 "Can only register one plugin to handle C-MOVE requests"); | |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2376 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2377 else |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2378 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2379 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to handle C-MOVE requests"; |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2380 pimpl_->moveCallbacks_ = p; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2381 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2382 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2383 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
2384 |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2385 void OrthancPlugins::RegisterDecodeImageCallback(const void* parameters) |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2386 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2387 const _OrthancPluginDecodeImageCallback& p = |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2388 *reinterpret_cast<const _OrthancPluginDecodeImageCallback*>(parameters); |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2389 |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2390 boost::unique_lock<boost::shared_mutex> lock(pimpl_->decoderTranscoderMutex_); |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2391 |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
2392 pimpl_->decodeImageCallbacks_.push_back(p.callback); |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2393 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to decode DICOM images (" |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2394 << pimpl_->decodeImageCallbacks_.size() << " decoder(s) now active)"; |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2395 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2396 |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2397 |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2398 void OrthancPlugins::RegisterTranscoderCallback(const void* parameters) |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2399 { |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2400 const _OrthancPluginTranscoderCallback& p = |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2401 *reinterpret_cast<const _OrthancPluginTranscoderCallback*>(parameters); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2402 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2403 boost::unique_lock<boost::shared_mutex> lock(pimpl_->decoderTranscoderMutex_); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2404 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2405 pimpl_->transcoderCallbacks_.push_back(p.callback); |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2406 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to transcode DICOM images (" |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2407 << pimpl_->transcoderCallbacks_.size() << " transcoder(s) now active)"; |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2408 } |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2409 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
2410 |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2411 void OrthancPlugins::RegisterJobsUnserializer(const void* parameters) |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2412 { |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2413 const _OrthancPluginJobsUnserializer& p = |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2414 *reinterpret_cast<const _OrthancPluginJobsUnserializer*>(parameters); |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2415 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2416 boost::mutex::scoped_lock lock(pimpl_->jobsUnserializersMutex_); |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2417 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2418 pimpl_->jobsUnserializers_.push_back(p.unserializer); |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2419 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to unserialize jobs (" |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2420 << pimpl_->jobsUnserializers_.size() << " unserializer(s) now active)"; |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2421 } |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2422 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
2423 |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
2424 void OrthancPlugins::RegisterIncomingHttpRequestFilter(const void* parameters) |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
2425 { |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
2426 const _OrthancPluginIncomingHttpRequestFilter& p = |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
2427 *reinterpret_cast<const _OrthancPluginIncomingHttpRequestFilter*>(parameters); |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
2428 |
4364
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
2429 boost::unique_lock<boost::shared_mutex> lock(pimpl_->incomingHttpRequestFilterMutex_); |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
2430 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2431 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to filter incoming HTTP requests"; |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
2432 pimpl_->incomingHttpRequestFilters_.push_back(p.callback); |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
2433 } |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2434 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2435 |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2436 void OrthancPlugins::RegisterIncomingHttpRequestFilter2(const void* parameters) |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2437 { |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2438 const _OrthancPluginIncomingHttpRequestFilter2& p = |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2439 *reinterpret_cast<const _OrthancPluginIncomingHttpRequestFilter2*>(parameters); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2440 |
4364
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
2441 boost::unique_lock<boost::shared_mutex> lock(pimpl_->incomingHttpRequestFilterMutex_); |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
2442 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2443 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to filter incoming HTTP requests"; |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2444 pimpl_->incomingHttpRequestFilters2_.push_back(p.callback); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2445 } |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2446 |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
2447 |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2448 void OrthancPlugins::RegisterIncomingDicomInstanceFilter(const void* parameters) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2449 { |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2450 const _OrthancPluginIncomingDicomInstanceFilter& p = |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2451 *reinterpret_cast<const _OrthancPluginIncomingDicomInstanceFilter*>(parameters); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2452 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2453 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to filter incoming DICOM instances"; |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2454 pimpl_->incomingDicomInstanceFilters_.push_back(p.callback); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2455 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2456 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2457 |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2458 void OrthancPlugins::RegisterRefreshMetricsCallback(const void* parameters) |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2459 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2460 const _OrthancPluginRegisterRefreshMetricsCallback& p = |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2461 *reinterpret_cast<const _OrthancPluginRegisterRefreshMetricsCallback*>(parameters); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2462 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2463 boost::mutex::scoped_lock lock(pimpl_->refreshMetricsMutex_); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2464 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2465 CLOG(INFO, PLUGINS) << "Plugin has registered a callback to refresh its metrics"; |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2466 pimpl_->refreshMetricsCallbacks_.push_back(p.callback); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2467 } |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2468 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
2469 |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2470 void OrthancPlugins::RegisterStorageCommitmentScpCallback(const void* parameters) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2471 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2472 const _OrthancPluginRegisterStorageCommitmentScpCallback& p = |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2473 *reinterpret_cast<const _OrthancPluginRegisterStorageCommitmentScpCallback*>(parameters); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2474 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2475 boost::mutex::scoped_lock lock(pimpl_->storageCommitmentScpMutex_); |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2476 CLOG(INFO, PLUGINS) << "Plugin has registered a storage commitment callback"; |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2477 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2478 pimpl_->storageCommitmentScpCallbacks_.push_back(new PImpl::StorageCommitmentScp(p)); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2479 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2480 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
2481 |
1133 | 2482 void OrthancPlugins::AnswerBuffer(const void* parameters) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2483 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2484 const _OrthancPluginAnswerBuffer& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2485 *reinterpret_cast<const _OrthancPluginAnswerBuffer*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2486 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2487 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2488 translatedOutput.SetContentType(p.mimeType); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2489 translatedOutput.Answer(p.answer, p.answerSize); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2490 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2491 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2492 |
1133 | 2493 void OrthancPlugins::Redirect(const void* parameters) |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
2494 { |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2495 const _OrthancPluginOutputPlusArgument& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2496 *reinterpret_cast<const _OrthancPluginOutputPlusArgument*>(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2497 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2498 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2499 translatedOutput.Redirect(p.argument); |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2500 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2501 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2502 |
1133 | 2503 void OrthancPlugins::SendHttpStatusCode(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2504 { |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2505 const _OrthancPluginSendHttpStatusCode& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2506 *reinterpret_cast<const _OrthancPluginSendHttpStatusCode*>(parameters); |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
2507 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2508 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2509 translatedOutput.SendStatus(static_cast<HttpStatus>(p.status)); |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2510 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2511 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2512 |
1594
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2513 void OrthancPlugins::SendHttpStatus(const void* parameters) |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2514 { |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2515 const _OrthancPluginSendHttpStatus& p = |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2516 *reinterpret_cast<const _OrthancPluginSendHttpStatus*>(parameters); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2517 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2518 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
1594
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2519 HttpStatus status = static_cast<HttpStatus>(p.status); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2520 |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2521 if (p.bodySize > 0 && p.body != NULL) |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2522 { |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2523 translatedOutput.SendStatus(status, p.body, p.bodySize); |
1594
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2524 } |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2525 else |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2526 { |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2527 translatedOutput.SendStatus(status); |
1594
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2528 } |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2529 } |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2530 |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
2531 |
1133 | 2532 void OrthancPlugins::SendUnauthorized(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2533 { |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2534 const _OrthancPluginOutputPlusArgument& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2535 *reinterpret_cast<const _OrthancPluginOutputPlusArgument*>(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2536 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2537 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2538 translatedOutput.SendUnauthorized(p.argument); |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2539 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2540 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2541 |
1133 | 2542 void OrthancPlugins::SendMethodNotAllowed(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2543 { |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2544 const _OrthancPluginOutputPlusArgument& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2545 *reinterpret_cast<const _OrthancPluginOutputPlusArgument*>(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2546 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2547 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2548 translatedOutput.SendMethodNotAllowed(p.argument); |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2549 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2550 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2551 |
1133 | 2552 void OrthancPlugins::SetCookie(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2553 { |
1137
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2554 const _OrthancPluginSetHttpHeader& p = |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2555 *reinterpret_cast<const _OrthancPluginSetHttpHeader*>(parameters); |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
2556 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2557 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2558 translatedOutput.SetCookie(p.key, p.value); |
1137
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2559 } |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2560 |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2561 |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2562 void OrthancPlugins::SetHttpHeader(const void* parameters) |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2563 { |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2564 const _OrthancPluginSetHttpHeader& p = |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2565 *reinterpret_cast<const _OrthancPluginSetHttpHeader*>(parameters); |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
2566 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2567 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2568 translatedOutput.AddHeader(p.key, p.value); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2569 } |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2570 |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2571 |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2572 void OrthancPlugins::SetHttpErrorDetails(const void* parameters) |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2573 { |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2574 const _OrthancPluginSetHttpErrorDetails& p = |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2575 *reinterpret_cast<const _OrthancPluginSetHttpErrorDetails*>(parameters); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2576 |
2960
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
2577 PImpl::PluginHttpOutput* output = |
74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2957
diff
changeset
|
2578 reinterpret_cast<PImpl::PluginHttpOutput*>(p.output); |
4056 | 2579 output->SetErrorDetails(p.details, (p.log != 0)); |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
2580 } |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
2581 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
2582 |
1133 | 2583 void OrthancPlugins::CompressAndAnswerPngImage(const void* parameters) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2584 { |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2585 // Bridge for backward compatibility with Orthanc <= 0.9.3 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2586 const _OrthancPluginCompressAndAnswerPngImage& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2587 *reinterpret_cast<const _OrthancPluginCompressAndAnswerPngImage*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2588 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2589 _OrthancPluginCompressAndAnswerImage p2; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2590 p2.output = p.output; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2591 p2.imageFormat = OrthancPluginImageFormat_Png; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2592 p2.pixelFormat = p.format; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2593 p2.width = p.width; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2594 p2.height = p.height; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2595 p2.pitch = p.height; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2596 p2.buffer = p.buffer; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2597 p2.quality = 0; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2598 |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2599 CompressAndAnswerImage(&p2); |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2600 } |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2601 |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2602 |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2603 void OrthancPlugins::CompressAndAnswerImage(const void* parameters) |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2604 { |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2605 const _OrthancPluginCompressAndAnswerImage& p = |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2606 *reinterpret_cast<const _OrthancPluginCompressAndAnswerImage*>(parameters); |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2607 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2608 HttpOutput& translatedOutput = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->GetOutput(); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2609 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2610 ImageAccessor accessor; |
1625 | 2611 accessor.AssignReadOnly(Plugins::Convert(p.pixelFormat), p.width, p.height, p.pitch, p.buffer); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2612 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2613 std::string compressed; |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2614 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2615 switch (p.imageFormat) |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2616 { |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2617 case OrthancPluginImageFormat_Png: |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2618 { |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2619 PngWriter writer; |
4311
cb9aef006229
turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4271
diff
changeset
|
2620 IImageWriter::WriteToMemory(writer, compressed, accessor); |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2621 translatedOutput.SetContentType(MimeType_Png); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2622 break; |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2623 } |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2624 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2625 case OrthancPluginImageFormat_Jpeg: |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2626 { |
1603
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2627 JpegWriter writer; |
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2628 writer.SetQuality(p.quality); |
4311
cb9aef006229
turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4271
diff
changeset
|
2629 IImageWriter::WriteToMemory(writer, compressed, accessor); |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2630 translatedOutput.SetContentType(MimeType_Jpeg); |
1603
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2631 break; |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
2632 } |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2633 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2634 default: |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2635 throw OrthancException(ErrorCode_ParameterOutOfRange); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2636 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2637 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
2638 translatedOutput.Answer(compressed); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2639 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2640 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2641 |
1133 | 2642 void OrthancPlugins::GetDicomForInstance(const void* parameters) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2643 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2644 const _OrthancPluginGetDicomForInstance& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2645 *reinterpret_cast<const _OrthancPluginGetDicomForInstance*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2646 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2647 std::string dicom; |
1452
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
2648 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2649 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2650 PImpl::ServerContextLock lock(*pimpl_); |
2124 | 2651 lock.GetContext().ReadDicom(dicom, p.instanceId); |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2652 } |
1452
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
2653 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2654 CopyToMemoryBuffer(*p.target, dicom); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2655 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2656 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2657 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2658 void OrthancPlugins::RestApiGet(const void* parameters, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2659 bool afterPlugins) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2660 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2661 const _OrthancPluginRestApiGet& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2662 *reinterpret_cast<const _OrthancPluginRestApiGet*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2663 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2664 CLOG(INFO, PLUGINS) << "Plugin making REST GET call on URI " << p.uri |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2665 << (afterPlugins ? " (after plugins)" : " (built-in API)"); |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2666 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2667 IHttpHandler* handler; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2668 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2669 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2670 PImpl::ServerContextLock lock(*pimpl_); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2671 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2672 } |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2673 |
3442
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3429
diff
changeset
|
2674 std::map<std::string, std::string> httpHeaders; |
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3429
diff
changeset
|
2675 |
1445
d26c8a93d05a
refactoring: SimpleGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
2676 std::string result; |
4329
9dc0e42f868b
moving static methods from HttpToolbox to IHttpHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4311
diff
changeset
|
2677 if (IHttpHandler::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri, httpHeaders)) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2678 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2679 CopyToMemoryBuffer(*p.target, result); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2680 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2681 else |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2682 { |
1984
9f09a20e41e2
corrected error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1962
diff
changeset
|
2683 throw OrthancException(ErrorCode_UnknownResource); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2684 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2685 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2686 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
2687 |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2688 void OrthancPlugins::RestApiGet2(const void* parameters) |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2689 { |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2690 const _OrthancPluginRestApiGet2& p = |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2691 *reinterpret_cast<const _OrthancPluginRestApiGet2*>(parameters); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2692 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2693 CLOG(INFO, PLUGINS) << "Plugin making REST GET call on URI " << p.uri |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2694 << (p.afterPlugins ? " (after plugins)" : " (built-in API)"); |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2695 |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
2696 HttpToolbox::Arguments headers; |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2697 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2698 for (uint32_t i = 0; i < p.headersCount; i++) |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2699 { |
1918
e8c2f993f6b3
fix case for HTTP headers keys in OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2700 std::string name(p.headersKeys[i]); |
e8c2f993f6b3
fix case for HTTP headers keys in OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2701 std::transform(name.begin(), name.end(), name.begin(), ::tolower); |
e8c2f993f6b3
fix case for HTTP headers keys in OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2702 headers[name] = p.headersValues[i]; |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2703 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2704 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2705 IHttpHandler* handler; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2706 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2707 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2708 PImpl::ServerContextLock lock(*pimpl_); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2709 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!p.afterPlugins); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2710 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2711 |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2712 std::string result; |
4329
9dc0e42f868b
moving static methods from HttpToolbox to IHttpHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4311
diff
changeset
|
2713 if (IHttpHandler::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri, headers)) |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2714 { |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2715 CopyToMemoryBuffer(*p.target, result); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2716 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2717 else |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2718 { |
1984
9f09a20e41e2
corrected error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1962
diff
changeset
|
2719 throw OrthancException(ErrorCode_UnknownResource); |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2720 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2721 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2722 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
2723 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2724 void OrthancPlugins::RestApiPostPut(bool isPost, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2725 const void* parameters, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2726 bool afterPlugins) |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2727 { |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2728 const _OrthancPluginRestApiPostPut& p = |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2729 *reinterpret_cast<const _OrthancPluginRestApiPostPut*>(parameters); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2730 |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2731 CLOG(INFO, PLUGINS) << "Plugin making REST " << EnumerationToString(isPost ? HttpMethod_Post : HttpMethod_Put) |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2732 << " call on URI " << p.uri << (afterPlugins ? " (after plugins)" : " (built-in API)"); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2733 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2734 IHttpHandler* handler; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2735 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2736 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2737 PImpl::ServerContextLock lock(*pimpl_); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2738 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2739 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2740 |
3442
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3429
diff
changeset
|
2741 std::map<std::string, std::string> httpHeaders; |
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3429
diff
changeset
|
2742 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2743 std::string result; |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
2744 if (isPost ? |
4329
9dc0e42f868b
moving static methods from HttpToolbox to IHttpHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4311
diff
changeset
|
2745 IHttpHandler::SimplePost(result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders) : |
9dc0e42f868b
moving static methods from HttpToolbox to IHttpHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4311
diff
changeset
|
2746 IHttpHandler::SimplePut (result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders)) |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2747 { |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2748 CopyToMemoryBuffer(*p.target, result); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2749 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2750 else |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2751 { |
1984
9f09a20e41e2
corrected error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1962
diff
changeset
|
2752 throw OrthancException(ErrorCode_UnknownResource); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2753 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2754 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2755 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2756 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2757 void OrthancPlugins::RestApiDelete(const void* parameters, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2758 bool afterPlugins) |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2759 { |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
2760 const char* uri = reinterpret_cast<const char*>(parameters); |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2761 CLOG(INFO, PLUGINS) << "Plugin making REST DELETE call on URI " << uri |
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
2762 << (afterPlugins ? " (after plugins)" : " (built-in API)"); |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
2763 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2764 IHttpHandler* handler; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2765 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2766 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2767 PImpl::ServerContextLock lock(*pimpl_); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2768 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2769 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2770 |
3442
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3429
diff
changeset
|
2771 std::map<std::string, std::string> httpHeaders; |
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3429
diff
changeset
|
2772 |
4329
9dc0e42f868b
moving static methods from HttpToolbox to IHttpHandler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4311
diff
changeset
|
2773 if (!IHttpHandler::SimpleDelete(*handler, RequestOrigin_Plugins, uri, httpHeaders)) |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2774 { |
1984
9f09a20e41e2
corrected error code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1962
diff
changeset
|
2775 throw OrthancException(ErrorCode_UnknownResource); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2776 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2777 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2778 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
2779 |
1133 | 2780 void OrthancPlugins::LookupResource(_OrthancPluginService service, |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
2781 const void* parameters) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2782 { |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
2783 const _OrthancPluginRetrieveDynamicString& p = |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
2784 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2785 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2786 /** |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2787 * The enumeration below only uses the tags that are indexed in |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2788 * the Orthanc database. It reflects the |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2789 * "CandidateResources::ApplyFilter()" method of the |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2790 * "OrthancFindRequestHandler" class. |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2791 **/ |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2792 |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2793 DicomTag tag(0, 0); |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2794 ResourceType level; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2795 switch (service) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2796 { |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2797 case _OrthancPluginService_LookupPatient: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2798 tag = DICOM_TAG_PATIENT_ID; |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2799 level = ResourceType_Patient; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2800 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2801 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2802 case _OrthancPluginService_LookupStudy: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2803 tag = DICOM_TAG_STUDY_INSTANCE_UID; |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2804 level = ResourceType_Study; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2805 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2806 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2807 case _OrthancPluginService_LookupStudyWithAccessionNumber: |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2808 tag = DICOM_TAG_ACCESSION_NUMBER; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2809 level = ResourceType_Study; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2810 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2811 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2812 case _OrthancPluginService_LookupSeries: |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2813 tag = DICOM_TAG_SERIES_INSTANCE_UID; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2814 level = ResourceType_Series; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2815 break; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2816 |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2817 case _OrthancPluginService_LookupInstance: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2818 tag = DICOM_TAG_SOP_INSTANCE_UID; |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
2819 level = ResourceType_Instance; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2820 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2821 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2822 default: |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2823 throw OrthancException(ErrorCode_InternalError); |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2824 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2825 |
3034
54e422fe31ce
moving LookupResource to graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2984
diff
changeset
|
2826 std::vector<std::string> result; |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2827 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2828 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2829 PImpl::ServerContextLock lock(*pimpl_); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2830 lock.GetContext().GetIndex().LookupIdentifierExact(result, level, tag, p.argument); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
2831 } |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2832 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2833 if (result.size() == 1) |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2834 { |
3034
54e422fe31ce
moving LookupResource to graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2984
diff
changeset
|
2835 *p.result = CopyString(result[0]); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2836 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2837 else |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2838 { |
3507
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3442
diff
changeset
|
2839 if (result.size() > 1) |
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3442
diff
changeset
|
2840 { |
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3442
diff
changeset
|
2841 LOG(WARNING) << "LookupResource(): Multiple resources match the query (instead of 0 or 1), which indicates " |
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3442
diff
changeset
|
2842 << "your DICOM database breaks the DICOM model of the real world"; |
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3442
diff
changeset
|
2843 } |
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3442
diff
changeset
|
2844 |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2845 throw OrthancException(ErrorCode_UnknownResource); |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2846 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2847 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2848 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2849 |
1067
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2850 static void AccessInstanceMetadataInternal(bool checkExistence, |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2851 const _OrthancPluginAccessDicomInstance& params, |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2852 const DicomInstanceToStore& instance) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2853 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2854 MetadataType metadata; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2855 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2856 try |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2857 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2858 metadata = StringToMetadata(params.key); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2859 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2860 catch (OrthancException&) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2861 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2862 // Unknown metadata |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2863 if (checkExistence) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2864 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2865 *params.resultInt64 = -1; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2866 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2867 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2868 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2869 *params.resultString = NULL; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2870 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2871 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2872 return; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2873 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2874 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2875 ServerIndex::MetadataMap::const_iterator it = |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2876 instance.GetMetadata().find(std::make_pair(ResourceType_Instance, metadata)); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2877 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2878 if (checkExistence) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2879 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2880 if (it != instance.GetMetadata().end()) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2881 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2882 *params.resultInt64 = 1; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2883 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2884 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2885 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2886 *params.resultInt64 = 0; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2887 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2888 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2889 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2890 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2891 if (it != instance.GetMetadata().end()) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2892 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2893 *params.resultString = it->second.c_str(); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2894 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2895 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2896 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2897 // Error: Missing metadata |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2898 *params.resultString = NULL; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2899 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2900 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2901 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2902 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2903 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2904 void OrthancPlugins::AccessDicomInstance(_OrthancPluginService service, |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2905 const void* parameters) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2906 { |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2907 const _OrthancPluginAccessDicomInstance& p = |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2908 *reinterpret_cast<const _OrthancPluginAccessDicomInstance*>(parameters); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2909 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2910 if (p.instance == NULL) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2911 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2912 throw OrthancException(ErrorCode_NullPointer); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2913 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2914 |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2915 const DicomInstanceToStore& instance = |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2916 reinterpret_cast<const IDicomInstance*>(p.instance)->GetInstance(); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2917 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2918 switch (service) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2919 { |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2920 case _OrthancPluginService_GetInstanceRemoteAet: |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2640
diff
changeset
|
2921 *p.resultString = instance.GetOrigin().GetRemoteAetC(); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2922 return; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2923 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2924 case _OrthancPluginService_GetInstanceSize: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2925 *p.resultInt64 = instance.GetBufferSize(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2926 return; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2927 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2928 case _OrthancPluginService_GetInstanceData: |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
2929 *p.resultString = reinterpret_cast<const char*>(instance.GetBufferData()); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2930 return; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2931 |
1067
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2932 case _OrthancPluginService_HasInstanceMetadata: |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2933 AccessInstanceMetadataInternal(true, p, instance); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2934 return; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2935 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2936 case _OrthancPluginService_GetInstanceMetadata: |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2937 AccessInstanceMetadataInternal(false, p, instance); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2938 return; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
2939 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2940 case _OrthancPluginService_GetInstanceJson: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2941 case _OrthancPluginService_GetInstanceSimplifiedJson: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2942 { |
4504
7d1eabfac6e0
removed cached dicom-as-json from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4498
diff
changeset
|
2943 Json::Value dicomAsJson; |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2944 instance.GetDicomAsJson(dicomAsJson); |
4504
7d1eabfac6e0
removed cached dicom-as-json from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4498
diff
changeset
|
2945 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2946 std::string s; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2947 if (service == _OrthancPluginService_GetInstanceJson) |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2948 { |
4504
7d1eabfac6e0
removed cached dicom-as-json from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4498
diff
changeset
|
2949 Toolbox::WriteStyledJson(s, dicomAsJson); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2950 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2951 else |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2952 { |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2953 Json::Value simplified; |
4504
7d1eabfac6e0
removed cached dicom-as-json from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4498
diff
changeset
|
2954 Toolbox::SimplifyDicomAsJson(simplified, dicomAsJson, DicomToJsonFormat_Human); |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
2955 Toolbox::WriteStyledJson(s, simplified); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2956 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2957 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2958 *p.resultStringToFree = CopyString(s); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2959 return; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2960 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2961 |
1815
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
2962 case _OrthancPluginService_GetInstanceOrigin: // New in Orthanc 0.9.5 |
2640
c691fcf66071
ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2616
diff
changeset
|
2963 *p.resultOrigin = Plugins::Convert(instance.GetOrigin().GetRequestOrigin()); |
1815
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
2964 return; |
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
2965 |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2966 case _OrthancPluginService_GetInstanceTransferSyntaxUid: // New in Orthanc 1.6.1 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2967 { |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2968 DicomTransferSyntax s; |
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2969 if (instance.LookupTransferSyntax(s)) |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2970 { |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2971 *p.resultStringToFree = CopyString(GetTransferSyntaxUid(s)); |
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2972 } |
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2973 else |
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2974 { |
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2975 *p.resultStringToFree = CopyString(""); |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2976 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2977 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2978 return; |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2979 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2980 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2981 case _OrthancPluginService_HasInstancePixelData: // New in Orthanc 1.6.1 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2982 *p.resultInt64 = instance.HasPixelData(); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2983 return; |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
2984 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2985 case _OrthancPluginService_GetInstanceFramesCount: // New in Orthanc 1.7.0 |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
2986 *p.resultInt64 = instance.GetFramesCount(); |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2987 return; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
2988 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2989 default: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
2990 throw OrthancException(ErrorCode_InternalError); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2991 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2992 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2993 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
2994 |
1554
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
2995 void OrthancPlugins::BufferCompression(const void* parameters) |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
2996 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
2997 const _OrthancPluginBufferCompression& p = |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
2998 *reinterpret_cast<const _OrthancPluginBufferCompression*>(parameters); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
2999 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3000 std::string result; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3001 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3002 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3003 std::unique_ptr<DeflateBaseCompressor> compressor; |
1554
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3004 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3005 switch (p.compression) |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3006 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3007 case OrthancPluginCompressionType_Zlib: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3008 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3009 compressor.reset(new ZlibCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3010 compressor->SetPrefixWithUncompressedSize(false); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3011 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3012 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3013 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3014 case OrthancPluginCompressionType_ZlibWithSize: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3015 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3016 compressor.reset(new ZlibCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3017 compressor->SetPrefixWithUncompressedSize(true); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3018 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3019 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3020 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3021 case OrthancPluginCompressionType_Gzip: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3022 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3023 compressor.reset(new GzipCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3024 compressor->SetPrefixWithUncompressedSize(false); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3025 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3026 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3027 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3028 case OrthancPluginCompressionType_GzipWithSize: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3029 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3030 compressor.reset(new GzipCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3031 compressor->SetPrefixWithUncompressedSize(true); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3032 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3033 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3034 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3035 default: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3036 throw OrthancException(ErrorCode_ParameterOutOfRange); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3037 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3038 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3039 if (p.uncompress) |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3040 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3041 compressor->Uncompress(result, p.source, p.size); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3042 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3043 else |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3044 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3045 compressor->Compress(result, p.source, p.size); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3046 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3047 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3048 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3049 CopyToMemoryBuffer(*p.target, result); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3050 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3051 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3052 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3053 static OrthancPluginImage* ReturnImage(std::unique_ptr<ImageAccessor>& image) |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3054 { |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3055 // Images returned to plugins are assumed to be writeable. If the |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3056 // input image is read-only, we return a copy so that it can be modified. |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3057 |
3928
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3058 if (image.get() == NULL) |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3059 { |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3060 throw OrthancException(ErrorCode_NullPointer); |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3061 } |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3062 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3063 if (image->IsReadOnly()) |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3064 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3065 std::unique_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight(), false)); |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3066 ImageProcessing::Copy(*copy, *image); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3067 image.reset(NULL); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3068 return reinterpret_cast<OrthancPluginImage*>(copy.release()); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3069 } |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3070 else |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3071 { |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3072 return reinterpret_cast<OrthancPluginImage*>(image.release()); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3073 } |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3074 } |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3075 |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3076 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3077 void OrthancPlugins::AccessDicomInstance2(_OrthancPluginService service, |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3078 const void* parameters) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3079 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3080 const _OrthancPluginAccessDicomInstance2& p = |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3081 *reinterpret_cast<const _OrthancPluginAccessDicomInstance2*>(parameters); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3082 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3083 if (p.instance == NULL) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3084 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3085 throw OrthancException(ErrorCode_NullPointer); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3086 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3087 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3088 const DicomInstanceToStore& instance = |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3089 reinterpret_cast<const IDicomInstance*>(p.instance)->GetInstance(); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3090 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3091 switch (service) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3092 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3093 case _OrthancPluginService_GetInstanceFramesCount: |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
3094 *p.targetUint32 = instance.GetFramesCount(); |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3095 return; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3096 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3097 case _OrthancPluginService_GetInstanceRawFrame: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3098 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3099 if (p.targetBuffer == NULL) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3100 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3101 throw OrthancException(ErrorCode_NullPointer); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3102 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3103 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3104 p.targetBuffer->data = NULL; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3105 p.targetBuffer->size = 0; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3106 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3107 MimeType mime; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3108 std::string frame; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3109 instance.GetParsedDicomFile().GetRawFrame(frame, mime, p.frameIndex); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3110 CopyToMemoryBuffer(*p.targetBuffer, frame); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3111 return; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3112 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3113 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3114 case _OrthancPluginService_GetInstanceDecodedFrame: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3115 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3116 if (p.targetImage == NULL) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3117 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3118 throw OrthancException(ErrorCode_NullPointer); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3119 } |
3928
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3120 |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3121 std::unique_ptr<ImageAccessor> decoded; |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3122 { |
3928
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3123 PImpl::ServerContextLock lock(*pimpl_); |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3124 decoded.reset(lock.GetContext().DecodeDicomFrame(instance, p.frameIndex)); |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3125 } |
3928
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
3126 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3127 *(p.targetImage) = ReturnImage(decoded); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3128 return; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3129 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3130 |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3131 case _OrthancPluginService_SerializeDicomInstance: |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3132 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3133 if (p.targetBuffer == NULL) |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3134 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3135 throw OrthancException(ErrorCode_NullPointer); |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3136 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3137 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3138 p.targetBuffer->data = NULL; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3139 p.targetBuffer->size = 0; |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
3140 CopyToMemoryBuffer(*p.targetBuffer, instance.GetBufferData(), instance.GetBufferSize()); |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3141 return; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3142 } |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3143 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3144 case _OrthancPluginService_GetInstanceAdvancedJson: |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3145 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3146 if (p.targetStringToFree == NULL) |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3147 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3148 throw OrthancException(ErrorCode_NullPointer); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3149 } |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
3150 |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3151 Json::Value json; |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
3152 instance.DatasetToJson(json, Plugins::Convert(p.format), |
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4504
diff
changeset
|
3153 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength); |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3154 |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4374
diff
changeset
|
3155 std::string s; |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
3156 Toolbox::WriteFastJson(s, json); |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4374
diff
changeset
|
3157 *p.targetStringToFree = CopyString(s); |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3158 return; |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3159 } |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3160 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3161 case _OrthancPluginService_GetInstanceDicomWebJson: |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3162 case _OrthancPluginService_GetInstanceDicomWebXml: |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3163 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3164 if (p.targetStringToFree == NULL) |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3165 { |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3166 throw OrthancException(ErrorCode_NullPointer); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3167 } |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3168 |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3169 DicomWebBinaryFormatter formatter(p.dicomWebCallback, p.dicomWebPayload); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3170 formatter.Apply(p.targetStringToFree, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3171 (service == _OrthancPluginService_GetInstanceDicomWebJson), |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3172 instance.GetParsedDicomFile()); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3173 return; |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3174 } |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
3175 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3176 default: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3177 throw OrthancException(ErrorCode_InternalError); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3178 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3179 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3180 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
3181 |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3182 void OrthancPlugins::UncompressImage(const void* parameters) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3183 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
3184 const _OrthancPluginUncompressImage& p = *reinterpret_cast<const _OrthancPluginUncompressImage*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3185 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3186 std::unique_ptr<ImageAccessor> image; |
1604 | 3187 |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3188 switch (p.format) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3189 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3190 case OrthancPluginImageFormat_Png: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3191 { |
1604 | 3192 image.reset(new PngReader); |
3193 reinterpret_cast<PngReader&>(*image).ReadFromMemory(p.data, p.size); | |
3194 break; | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3195 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3196 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3197 case OrthancPluginImageFormat_Jpeg: |
1604 | 3198 { |
3199 image.reset(new JpegReader); | |
3200 reinterpret_cast<JpegReader&>(*image).ReadFromMemory(p.data, p.size); | |
3201 break; | |
3202 } | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3203 |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3204 case OrthancPluginImageFormat_Dicom: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3205 { |
3980
e42f5445d20d
Fix decoding of DICOM images for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
3206 PImpl::ServerContextLock lock(*pimpl_); |
e42f5445d20d
Fix decoding of DICOM images for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
3207 image.reset(lock.GetContext().DecodeDicomFrame(p.data, p.size, 0)); |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3208 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3209 } |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3210 |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3211 default: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3212 throw OrthancException(ErrorCode_ParameterOutOfRange); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3213 } |
1604 | 3214 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3215 *(p.target) = ReturnImage(image); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3216 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3217 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3218 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3219 void OrthancPlugins::CompressImage(const void* parameters) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3220 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
3221 const _OrthancPluginCompressImage& p = *reinterpret_cast<const _OrthancPluginCompressImage*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3222 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3223 std::string compressed; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3224 |
1916 | 3225 ImageAccessor accessor; |
3226 accessor.AssignReadOnly(Plugins::Convert(p.pixelFormat), p.width, p.height, p.pitch, p.buffer); | |
3227 | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3228 switch (p.imageFormat) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3229 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3230 case OrthancPluginImageFormat_Png: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3231 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3232 PngWriter writer; |
4311
cb9aef006229
turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4271
diff
changeset
|
3233 IImageWriter::WriteToMemory(writer, compressed, accessor); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3234 break; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3235 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3236 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3237 case OrthancPluginImageFormat_Jpeg: |
1604 | 3238 { |
3239 JpegWriter writer; | |
3240 writer.SetQuality(p.quality); | |
4311
cb9aef006229
turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4271
diff
changeset
|
3241 IImageWriter::WriteToMemory(writer, compressed, accessor); |
1604 | 3242 break; |
3243 } | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3244 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3245 default: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3246 throw OrthancException(ErrorCode_ParameterOutOfRange); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3247 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3248 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3249 CopyToMemoryBuffer(*p.target, compressed.size() > 0 ? compressed.c_str() : NULL, compressed.size()); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3250 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3251 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
3252 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3253 static void SetupHttpClient(HttpClient& client, |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3254 const _OrthancPluginCallHttpClient2& parameters) |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3255 { |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3256 client.SetUrl(parameters.url); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3257 client.SetConvertHeadersToLowerCase(false); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3258 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3259 if (parameters.timeout != 0) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3260 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3261 client.SetTimeout(parameters.timeout); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3262 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3263 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3264 if (parameters.username != NULL && |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3265 parameters.password != NULL) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3266 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3267 client.SetCredentials(parameters.username, parameters.password); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3268 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3269 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3270 if (parameters.certificateFile != NULL) |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3271 { |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3272 std::string certificate(parameters.certificateFile); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3273 std::string key, password; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3274 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3275 if (parameters.certificateKeyFile) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3276 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3277 key.assign(parameters.certificateKeyFile); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3278 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3279 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3280 if (parameters.certificateKeyPassword) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3281 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3282 password.assign(parameters.certificateKeyPassword); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3283 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3284 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3285 client.SetClientCertificate(certificate, key, password); |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3286 } |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3287 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3288 client.SetPkcs11Enabled(parameters.pkcs11 ? true : false); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3289 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3290 for (uint32_t i = 0; i < parameters.headersCount; i++) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3291 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3292 if (parameters.headersKeys[i] == NULL || |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3293 parameters.headersValues[i] == NULL) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3294 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3295 throw OrthancException(ErrorCode_NullPointer); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3296 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3297 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3298 client.AddHeader(parameters.headersKeys[i], parameters.headersValues[i]); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3299 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3300 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3301 switch (parameters.method) |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3302 { |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3303 case OrthancPluginHttpMethod_Get: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3304 client.SetMethod(HttpMethod_Get); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3305 break; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3306 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3307 case OrthancPluginHttpMethod_Post: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3308 client.SetMethod(HttpMethod_Post); |
3892
fe0e4ef52a72
Fix missing body in "OrthancPluginHttpPost()" and "OrthancPluginHttpPut()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3847
diff
changeset
|
3309 client.GetBody().assign(reinterpret_cast<const char*>(parameters.body), parameters.bodySize); |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3310 break; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3311 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3312 case OrthancPluginHttpMethod_Put: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
3313 client.SetMethod(HttpMethod_Put); |
3892
fe0e4ef52a72
Fix missing body in "OrthancPluginHttpPost()" and "OrthancPluginHttpPut()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3847
diff
changeset
|
3314 client.GetBody().assign(reinterpret_cast<const char*>(parameters.body), parameters.bodySize); |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3315 break; |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3316 |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3317 case OrthancPluginHttpMethod_Delete: |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3318 client.SetMethod(HttpMethod_Delete); |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3319 break; |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3320 |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3321 default: |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3322 throw OrthancException(ErrorCode_ParameterOutOfRange); |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3323 } |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3324 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3325 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3326 |
3413 | 3327 static void ExecuteHttpClientWithoutChunkedBody(uint16_t& httpStatus, |
3328 OrthancPluginMemoryBuffer* answerBody, | |
3329 OrthancPluginMemoryBuffer* answerHeaders, | |
3330 HttpClient& client) | |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3331 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3332 if (answerBody == NULL) |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3333 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3334 throw OrthancException(ErrorCode_NullPointer); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3335 } |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3336 |
2041
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3337 std::string body; |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3338 HttpClient::HttpHeaders headers; |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3339 |
2787
ad2c32082653
Fix OrthancPluginHttpClient() to return the HTTP status on errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
3340 bool success = client.Apply(body, headers); |
2041
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3341 |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3342 // The HTTP request has succeeded |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3343 httpStatus = static_cast<uint16_t>(client.GetLastStatus()); |
2041
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3344 |
2787
ad2c32082653
Fix OrthancPluginHttpClient() to return the HTTP status on errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
3345 if (!success) |
ad2c32082653
Fix OrthancPluginHttpClient() to return the HTTP status on errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
3346 { |
ad2c32082653
Fix OrthancPluginHttpClient() to return the HTTP status on errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
3347 HttpClient::ThrowException(client.GetLastStatus()); |
ad2c32082653
Fix OrthancPluginHttpClient() to return the HTTP status on errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
3348 } |
ad2c32082653
Fix OrthancPluginHttpClient() to return the HTTP status on errors
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
3349 |
2041
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3350 // Copy the HTTP headers of the answer, if the plugin requested them |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3351 if (answerHeaders != NULL) |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3352 { |
2041
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3353 Json::Value json = Json::objectValue; |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3354 |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3355 for (HttpClient::HttpHeaders::const_iterator |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3356 it = headers.begin(); it != headers.end(); ++it) |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3357 { |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3358 json[it->first] = it->second; |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3359 } |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3360 |
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3361 std::string s = json.toStyledString(); |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3362 CopyToMemoryBuffer(*answerHeaders, s); |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3363 } |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3364 |
2041
9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2028
diff
changeset
|
3365 // Copy the body of the answer if it makes sense |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3366 if (client.GetMethod() != HttpMethod_Delete) |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3367 { |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3368 CopyToMemoryBuffer(*answerBody, body); |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3369 } |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3370 } |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3371 |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
3372 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3373 void OrthancPlugins::CallHttpClient(const void* parameters) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3374 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3375 const _OrthancPluginCallHttpClient& p = *reinterpret_cast<const _OrthancPluginCallHttpClient*>(parameters); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3376 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3377 HttpClient client; |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3378 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3379 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3380 _OrthancPluginCallHttpClient2 converted; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3381 memset(&converted, 0, sizeof(converted)); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3382 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3383 converted.answerBody = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3384 converted.answerHeaders = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3385 converted.httpStatus = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3386 converted.method = p.method; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3387 converted.url = p.url; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3388 converted.headersCount = 0; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3389 converted.headersKeys = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3390 converted.headersValues = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3391 converted.body = p.body; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3392 converted.bodySize = p.bodySize; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3393 converted.username = p.username; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3394 converted.password = p.password; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3395 converted.timeout = 0; // Use default timeout |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3396 converted.certificateFile = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3397 converted.certificateKeyFile = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3398 converted.certificateKeyPassword = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3399 converted.pkcs11 = false; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3400 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3401 SetupHttpClient(client, converted); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3402 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3403 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3404 uint16_t status; |
3413 | 3405 ExecuteHttpClientWithoutChunkedBody(status, p.target, NULL, client); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3406 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3407 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3408 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3409 void OrthancPlugins::CallHttpClient2(const void* parameters) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3410 { |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3411 const _OrthancPluginCallHttpClient2& p = *reinterpret_cast<const _OrthancPluginCallHttpClient2*>(parameters); |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3412 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3413 if (p.httpStatus == NULL) |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3414 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3415 throw OrthancException(ErrorCode_NullPointer); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3416 } |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3417 |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3418 HttpClient client; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3419 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3420 if (p.method == OrthancPluginHttpMethod_Post || |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3421 p.method == OrthancPluginHttpMethod_Put) |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3422 { |
3401 | 3423 client.GetBody().assign(reinterpret_cast<const char*>(p.body), p.bodySize); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3424 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3425 |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3426 SetupHttpClient(client, p); |
3413 | 3427 ExecuteHttpClientWithoutChunkedBody(*p.httpStatus, p.answerBody, p.answerHeaders, client); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3428 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3429 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3430 |
3413 | 3431 void OrthancPlugins::ChunkedHttpClient(const void* parameters) |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3432 { |
3413 | 3433 const _OrthancPluginChunkedHttpClient& p = |
3434 *reinterpret_cast<const _OrthancPluginChunkedHttpClient*>(parameters); | |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3435 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3436 if (p.httpStatus == NULL) |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3437 { |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3438 throw OrthancException(ErrorCode_NullPointer); |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3439 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3440 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3441 HttpClient client; |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3442 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3443 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3444 _OrthancPluginCallHttpClient2 converted; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3445 memset(&converted, 0, sizeof(converted)); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3446 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3447 converted.answerBody = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3448 converted.answerHeaders = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3449 converted.httpStatus = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3450 converted.method = p.method; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3451 converted.url = p.url; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3452 converted.headersCount = p.headersCount; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3453 converted.headersKeys = p.headersKeys; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3454 converted.headersValues = p.headersValues; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3455 converted.body = NULL; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3456 converted.bodySize = 0; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3457 converted.username = p.username; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3458 converted.password = p.password; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3459 converted.timeout = p.timeout; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3460 converted.certificateFile = p.certificateFile; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3461 converted.certificateKeyFile = p.certificateKeyFile; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3462 converted.certificateKeyPassword = p.certificateKeyPassword; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3463 converted.pkcs11 = p.pkcs11; |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3464 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3465 SetupHttpClient(client, converted); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3466 } |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3467 |
3414 | 3468 HttpClientChunkedRequest body(p, pimpl_->dictionary_); |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3469 client.SetBody(body); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3470 |
3414 | 3471 HttpClientChunkedAnswer answer(p, pimpl_->dictionary_); |
3393
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3472 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3473 bool success = client.Apply(answer); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3474 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3475 *p.httpStatus = static_cast<uint16_t>(client.GetLastStatus()); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3476 |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3477 if (!success) |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3478 { |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3479 HttpClient::ThrowException(client.GetLastStatus()); |
2cd0369a156f
support of chunked answers in HttpClient and in SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3392
diff
changeset
|
3480 } |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3481 } |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3482 |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
3483 |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3484 void OrthancPlugins::CallPeerApi(const void* parameters) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3485 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3486 const _OrthancPluginCallPeerApi& p = *reinterpret_cast<const _OrthancPluginCallPeerApi*>(parameters); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3487 const OrthancPeers& peers = *reinterpret_cast<const OrthancPeers*>(p.peers); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3488 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3489 HttpClient client(peers.GetPeerParameters(p.peerIndex), p.uri); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3490 client.SetConvertHeadersToLowerCase(false); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3491 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3492 if (p.timeout != 0) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3493 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3494 client.SetTimeout(p.timeout); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3495 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3496 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3497 for (uint32_t i = 0; i < p.additionalHeadersCount; i++) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3498 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3499 if (p.additionalHeadersKeys[i] == NULL || |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3500 p.additionalHeadersValues[i] == NULL) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3501 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3502 throw OrthancException(ErrorCode_NullPointer); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3503 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3504 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3505 client.AddHeader(p.additionalHeadersKeys[i], p.additionalHeadersValues[i]); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3506 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3507 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3508 switch (p.method) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3509 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3510 case OrthancPluginHttpMethod_Get: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3511 client.SetMethod(HttpMethod_Get); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3512 break; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3513 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3514 case OrthancPluginHttpMethod_Post: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3515 client.SetMethod(HttpMethod_Post); |
3401 | 3516 client.GetBody().assign(reinterpret_cast<const char*>(p.body), p.bodySize); |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3517 break; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3518 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3519 case OrthancPluginHttpMethod_Put: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3520 client.SetMethod(HttpMethod_Put); |
3401 | 3521 client.GetBody().assign(reinterpret_cast<const char*>(p.body), p.bodySize); |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3522 break; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3523 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3524 case OrthancPluginHttpMethod_Delete: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3525 client.SetMethod(HttpMethod_Delete); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3526 break; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3527 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3528 default: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3529 throw OrthancException(ErrorCode_ParameterOutOfRange); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3530 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3531 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3532 std::string body; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3533 HttpClient::HttpHeaders headers; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3534 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3535 bool success = client.Apply(body, headers); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3536 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3537 // The HTTP request has succeeded |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3538 *p.httpStatus = static_cast<uint16_t>(client.GetLastStatus()); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3539 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3540 if (!success) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3541 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3542 HttpClient::ThrowException(client.GetLastStatus()); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3543 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3544 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3545 // Copy the HTTP headers of the answer, if the plugin requested them |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3546 if (p.answerHeaders != NULL) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3547 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3548 Json::Value json = Json::objectValue; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3549 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3550 for (HttpClient::HttpHeaders::const_iterator |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3551 it = headers.begin(); it != headers.end(); ++it) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3552 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3553 json[it->first] = it->second; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3554 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3555 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3556 std::string s = json.toStyledString(); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3557 CopyToMemoryBuffer(*p.answerHeaders, s); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3558 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3559 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3560 // Copy the body of the answer if it makes sense |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3561 if (p.method != OrthancPluginHttpMethod_Delete) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3562 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3563 CopyToMemoryBuffer(*p.answerBody, body); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3564 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3565 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3566 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3567 |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3568 void OrthancPlugins::ConvertPixelFormat(const void* parameters) |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3569 { |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3570 const _OrthancPluginConvertPixelFormat& p = *reinterpret_cast<const _OrthancPluginConvertPixelFormat*>(parameters); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3571 const ImageAccessor& source = *reinterpret_cast<const ImageAccessor*>(p.source); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3572 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3573 std::unique_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight(), false)); |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3574 ImageProcessing::Convert(*target, source); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3575 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3576 *(p.target) = ReturnImage(target); |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3577 } |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3578 |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
3579 |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3580 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3581 void OrthancPlugins::GetFontInfo(const void* parameters) |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3582 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3583 const _OrthancPluginGetFontInfo& p = *reinterpret_cast<const _OrthancPluginGetFontInfo*>(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3584 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3585 { |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3586 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3587 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3588 const Font& font = lock.GetConfiguration().GetFontRegistry().GetFont(p.fontIndex); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3589 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3590 if (p.name != NULL) |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3591 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3592 *(p.name) = font.GetName().c_str(); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3593 } |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3594 else if (p.size != NULL) |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3595 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3596 *(p.size) = font.GetSize(); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3597 } |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3598 else |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3599 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3600 throw OrthancException(ErrorCode_InternalError); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3601 } |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3602 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3603 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3604 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3605 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3606 void OrthancPlugins::DrawText(const void* parameters) |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3607 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3608 const _OrthancPluginDrawText& p = *reinterpret_cast<const _OrthancPluginDrawText*>(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3609 |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3610 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3611 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3612 const Font& font = lock.GetConfiguration().GetFontRegistry().GetFont(p.fontIndex); |
4204 | 3613 |
3614 ImageAccessor& target = *reinterpret_cast<ImageAccessor*>(p.image); | |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3615 font.Draw(target, p.utf8Text, p.x, p.y, p.r, p.g, p.b); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3616 } |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3617 } |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3618 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3619 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3620 void OrthancPlugins::ApplyDicomToJson(_OrthancPluginService service, |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3621 const void* parameters) |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3622 { |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3623 const _OrthancPluginDicomToJson& p = |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3624 *reinterpret_cast<const _OrthancPluginDicomToJson*>(parameters); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3625 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3626 std::unique_ptr<ParsedDicomFile> dicom; |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3627 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3628 if (service == _OrthancPluginService_DicomBufferToJson) |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3629 { |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3630 dicom.reset(new ParsedDicomFile(p.buffer, p.size)); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3631 } |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3632 else |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3633 { |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3634 if (p.instanceId == NULL) |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3635 { |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
3636 throw OrthancException(ErrorCode_NullPointer); |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3637 } |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3638 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3639 std::string content; |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3640 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3641 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3642 PImpl::ServerContextLock lock(*pimpl_); |
2124 | 3643 lock.GetContext().ReadDicom(content, p.instanceId); |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3644 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3645 |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3646 dicom.reset(new ParsedDicomFile(content)); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3647 } |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3648 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3649 Json::Value json; |
2128
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2124
diff
changeset
|
3650 dicom->DatasetToJson(json, Plugins::Convert(p.format), |
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2124
diff
changeset
|
3651 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength); |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3652 |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4374
diff
changeset
|
3653 std::string s; |
4394
f7104e9d044c
functions to read/write JSON in OrthancPluginCppWrapper.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
3654 Toolbox::WriteFastJson(s, json); |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4374
diff
changeset
|
3655 *p.result = CopyString(s); |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
3656 } |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3657 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
3658 |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3659 void OrthancPlugins::ApplyCreateDicom(const _OrthancPluginCreateDicom& parameters, |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3660 const char* privateCreatorC) |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3661 { |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3662 Json::Value json; |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3663 |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3664 if (parameters.json == NULL) |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3665 { |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3666 json = Json::objectValue; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3667 } |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3668 else if (!Toolbox::ReadJson(json, parameters.json)) |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4374
diff
changeset
|
3669 { |
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4374
diff
changeset
|
3670 throw OrthancException(ErrorCode_BadJson); |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3671 } |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3672 |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3673 std::string dicom; |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3674 |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3675 { |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3676 // Fix issue 168 (Plugins can't read private tags from the |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3677 // configuration file) |
4476
c1f36fd13730
migrate remaining links to issues in bitbucket to mercurial server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4459
diff
changeset
|
3678 // https://bugs.orthanc-server.com/show_bug.cgi?id=168 |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3679 std::string privateCreator; |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3680 |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3681 if (privateCreatorC == NULL) |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3682 { |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3683 OrthancConfiguration::ReaderLock lock; |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3684 privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator(); |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3685 } |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3686 else |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3687 { |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3688 // New in Orthanc 1.9.0 |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3689 privateCreator.assign(privateCreatorC); |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3690 } |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3691 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3692 std::unique_ptr<ParsedDicomFile> file |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3693 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(parameters.flags), |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3694 privateCreator)); |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3695 |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3696 if (parameters.pixelData) |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3697 { |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3698 file->EmbedImage(*reinterpret_cast<const ImageAccessor*>(parameters.pixelData)); |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3699 } |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3700 |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3701 file->SaveToMemoryBuffer(dicom); |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3702 } |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3703 |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
3704 CopyToMemoryBuffer(*parameters.target, dicom); |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3705 } |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3706 |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3707 |
1833
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3708 void OrthancPlugins::ComputeHash(_OrthancPluginService service, |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3709 const void* parameters) |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3710 { |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3711 const _OrthancPluginComputeHash& p = |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3712 *reinterpret_cast<const _OrthancPluginComputeHash*>(parameters); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3713 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3714 std::string hash; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3715 switch (service) |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3716 { |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3717 case _OrthancPluginService_ComputeMd5: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3718 Toolbox::ComputeMD5(hash, p.buffer, p.size); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3719 break; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3720 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3721 case _OrthancPluginService_ComputeSha1: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3722 Toolbox::ComputeSHA1(hash, p.buffer, p.size); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3723 break; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3724 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3725 default: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3726 throw OrthancException(ErrorCode_ParameterOutOfRange); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3727 } |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3728 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3729 *p.result = CopyString(hash); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3730 } |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3731 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
3732 |
3429
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3733 void OrthancPlugins::GetTagName(const void* parameters) |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3734 { |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3735 const _OrthancPluginGetTagName& p = |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3736 *reinterpret_cast<const _OrthancPluginGetTagName*>(parameters); |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3737 |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3738 std::string privateCreator; |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3739 |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3740 if (p.privateCreator != NULL) |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3741 { |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3742 privateCreator = p.privateCreator; |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3743 } |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3744 |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3745 DicomTag tag(p.group, p.element); |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3746 *p.result = CopyString(FromDcmtkBridge::GetTagName(tag, privateCreator)); |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3747 } |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3748 |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
3749 |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3750 void OrthancPlugins::ApplyCreateImage(_OrthancPluginService service, |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3751 const void* parameters) |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3752 { |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3753 const _OrthancPluginCreateImage& p = |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3754 *reinterpret_cast<const _OrthancPluginCreateImage*>(parameters); |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3755 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
3756 std::unique_ptr<ImageAccessor> result; |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3757 |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3758 switch (service) |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3759 { |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3760 case _OrthancPluginService_CreateImage: |
2107 | 3761 result.reset(new Image(Plugins::Convert(p.format), p.width, p.height, false)); |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3762 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3763 |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3764 case _OrthancPluginService_CreateImageAccessor: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3765 result.reset(new ImageAccessor); |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3766 result->AssignWritable(Plugins::Convert(p.format), p.width, p.height, p.pitch, p.buffer); |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3767 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3768 |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3769 case _OrthancPluginService_DecodeDicomImage: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3770 { |
3980
e42f5445d20d
Fix decoding of DICOM images for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
3771 PImpl::ServerContextLock lock(*pimpl_); |
e42f5445d20d
Fix decoding of DICOM images for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
3772 result.reset(lock.GetContext().DecodeDicomFrame(p.constBuffer, p.bufferSize, p.frameIndex)); |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3773 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3774 } |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3775 |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3776 default: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
3777 throw OrthancException(ErrorCode_InternalError); |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3778 } |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3779 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
3780 *(p.target) = ReturnImage(result); |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
3781 } |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3782 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3783 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3784 void OrthancPlugins::ApplySendMultipartItem(const void* parameters) |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3785 { |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3786 // An exception might be raised in this function if the |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3787 // connection was closed by the HTTP client. |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3788 const _OrthancPluginAnswerBuffer& p = |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3789 *reinterpret_cast<const _OrthancPluginAnswerBuffer*>(parameters); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3790 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3791 std::map<std::string, std::string> headers; // No custom headers |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
3792 reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->SendMultipartItem(p.answer, p.answerSize, headers); |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3793 } |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3794 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3795 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3796 void OrthancPlugins::ApplySendMultipartItem2(const void* parameters) |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3797 { |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3798 // An exception might be raised in this function if the |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3799 // connection was closed by the HTTP client. |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3800 const _OrthancPluginSendMultipartItem2& p = |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3801 *reinterpret_cast<const _OrthancPluginSendMultipartItem2*>(parameters); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3802 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3803 std::map<std::string, std::string> headers; |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3804 for (uint32_t i = 0; i < p.headersCount; i++) |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3805 { |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3806 headers[p.headersKeys[i]] = p.headersValues[i]; |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3807 } |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3808 |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
3809 reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->SendMultipartItem(p.answer, p.answerSize, headers); |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3810 } |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
3811 |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
3812 |
1771 | 3813 void OrthancPlugins::DatabaseAnswer(const void* parameters) |
3814 { | |
3815 const _OrthancPluginDatabaseAnswer& p = | |
3816 *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); | |
3817 | |
3818 if (pimpl_->database_.get() != NULL) | |
3819 { | |
3820 pimpl_->database_->AnswerReceived(p); | |
3821 } | |
3822 else | |
3823 { | |
2956 | 3824 throw OrthancException(ErrorCode_BadRequest, |
3825 "Cannot invoke this service without a custom database back-end"); | |
1771 | 3826 } |
3827 } | |
3828 | |
3829 | |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3830 namespace |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3831 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3832 class DictionaryReadLocker |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3833 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3834 private: |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3835 const DcmDataDictionary& dictionary_; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3836 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3837 public: |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3838 DictionaryReadLocker() : dictionary_(dcmDataDict.rdlock()) |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3839 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3840 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3841 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3842 ~DictionaryReadLocker() |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3843 { |
3118 | 3844 #if DCMTK_VERSION_NUMBER >= 364 |
3845 dcmDataDict.rdunlock(); | |
3846 #else | |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3847 dcmDataDict.unlock(); |
3118 | 3848 #endif |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3849 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3850 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3851 const DcmDataDictionary* operator->() |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3852 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3853 return &dictionary_; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3854 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3855 }; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3856 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3857 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3858 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3859 void OrthancPlugins::ApplyLookupDictionary(const void* parameters) |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3860 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3861 const _OrthancPluginLookupDictionary& p = |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3862 *reinterpret_cast<const _OrthancPluginLookupDictionary*>(parameters); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3863 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3864 DicomTag tag(FromDcmtkBridge::ParseTag(p.name)); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3865 DcmTagKey tag2(tag.GetGroup(), tag.GetElement()); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3866 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3867 DictionaryReadLocker locker; |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3868 const DcmDictEntry* entry = NULL; |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3869 |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3870 if (tag.IsPrivate()) |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3871 { |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3872 // Fix issue 168 (Plugins can't read private tags from the |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3873 // configuration file) |
4476
c1f36fd13730
migrate remaining links to issues in bitbucket to mercurial server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4459
diff
changeset
|
3874 // https://bugs.orthanc-server.com/show_bug.cgi?id=168 |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3875 std::string privateCreator; |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3876 { |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3877 OrthancConfiguration::ReaderLock lock; |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3878 privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator(); |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3879 } |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3880 |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3881 entry = locker->findEntry(tag2, privateCreator.c_str()); |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3882 } |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3883 else |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3884 { |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3885 entry = locker->findEntry(tag2, NULL); |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
3886 } |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3887 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3888 if (entry == NULL) |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3889 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3890 throw OrthancException(ErrorCode_UnknownDicomTag); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3891 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3892 else |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3893 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3894 p.target->group = entry->getKey().getGroup(); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3895 p.target->element = entry->getKey().getElement(); |
2006
6301bbcbcaed
more generic support of value representations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2000
diff
changeset
|
3896 p.target->vr = Plugins::Convert(FromDcmtkBridge::Convert(entry->getEVR())); |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3897 p.target->minMultiplicity = static_cast<uint32_t>(entry->getVMMin()); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3898 p.target->maxMultiplicity = (entry->getVMMax() == DcmVariableVM ? 0 : static_cast<uint32_t>(entry->getVMMax())); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3899 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3900 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3901 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
3902 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3903 bool OrthancPlugins::InvokeSafeService(SharedLibrary& plugin, |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3904 _OrthancPluginService service, |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3905 const void* parameters) |
899 | 3906 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
3907 // Services that can be run without mutual exclusion |
1553
7c4b487b3b4a
ensure mutual exclusion in InvokeService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
3908 |
899 | 3909 switch (service) |
3910 { | |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3911 case _OrthancPluginService_GetOrthancPath: |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3912 { |
2140 | 3913 std::string s = SystemToolbox::GetPathToExecutable(); |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3914 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3915 return true; |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3916 } |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3917 |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3918 case _OrthancPluginService_GetOrthancDirectory: |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3919 { |
2140 | 3920 std::string s = SystemToolbox::GetDirectoryOfExecutable(); |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3921 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3922 return true; |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3923 } |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3924 |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3925 case _OrthancPluginService_GetConfigurationPath: |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3926 { |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3927 std::string s; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3928 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3929 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3930 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3931 s = lock.GetConfiguration().GetConfigurationAbsolutePath(); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3932 } |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3933 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3934 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3935 return true; |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3936 } |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
3937 |
1424
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3938 case _OrthancPluginService_GetConfiguration: |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3939 { |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3940 std::string s; |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3941 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3942 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3943 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3944 lock.GetConfiguration().Format(s); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
3945 } |
1424
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3946 |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3947 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3948 return true; |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3949 } |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
3950 |
1554
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3951 case _OrthancPluginService_BufferCompression: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3952 BufferCompression(parameters); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3953 return true; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
3954 |
907 | 3955 case _OrthancPluginService_AnswerBuffer: |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
3956 AnswerBuffer(parameters); |
899 | 3957 return true; |
3958 | |
907 | 3959 case _OrthancPluginService_CompressAndAnswerPngImage: |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
3960 CompressAndAnswerPngImage(parameters); |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
3961 return true; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
3962 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
3963 case _OrthancPluginService_CompressAndAnswerImage: |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
3964 CompressAndAnswerImage(parameters); |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
3965 return true; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
3966 |
907 | 3967 case _OrthancPluginService_GetDicomForInstance: |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
3968 GetDicomForInstance(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
3969 return true; |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
3970 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
3971 case _OrthancPluginService_RestApiGet: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3972 RestApiGet(parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3973 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3974 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3975 case _OrthancPluginService_RestApiGetAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3976 RestApiGet(parameters, true); |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
3977 return true; |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3978 |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
3979 case _OrthancPluginService_RestApiGet2: |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
3980 RestApiGet2(parameters); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
3981 return true; |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
3982 |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3983 case _OrthancPluginService_RestApiPost: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3984 RestApiPostPut(true, parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3985 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3986 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3987 case _OrthancPluginService_RestApiPostAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3988 RestApiPostPut(true, parameters, true); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3989 return true; |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3990 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3991 case _OrthancPluginService_RestApiDelete: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3992 RestApiDelete(parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3993 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3994 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3995 case _OrthancPluginService_RestApiDeleteAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
3996 RestApiDelete(parameters, true); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3997 return true; |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3998 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
3999 case _OrthancPluginService_RestApiPut: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
4000 RestApiPostPut(false, parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
4001 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
4002 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
4003 case _OrthancPluginService_RestApiPutAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
4004 RestApiPostPut(false, parameters, true); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
4005 return true; |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
4006 |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
4007 case _OrthancPluginService_Redirect: |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
4008 Redirect(parameters); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
4009 return true; |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
4010 |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4011 case _OrthancPluginService_SendUnauthorized: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4012 SendUnauthorized(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4013 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4014 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4015 case _OrthancPluginService_SendMethodNotAllowed: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4016 SendMethodNotAllowed(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4017 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4018 |
1594
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
4019 case _OrthancPluginService_SendHttpStatus: |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
4020 SendHttpStatus(parameters); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
4021 return true; |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
4022 |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4023 case _OrthancPluginService_SendHttpStatusCode: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4024 SendHttpStatusCode(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4025 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4026 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4027 case _OrthancPluginService_SetCookie: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4028 SetCookie(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4029 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
4030 |
1137
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
4031 case _OrthancPluginService_SetHttpHeader: |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
4032 SetHttpHeader(parameters); |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
4033 return true; |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
4034 |
2957
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
4035 case _OrthancPluginService_SetHttpErrorDetails: |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
4036 SetHttpErrorDetails(parameters); |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
4037 return true; |
ccf61f6e22ef
New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2956
diff
changeset
|
4038 |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
4039 case _OrthancPluginService_LookupPatient: |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
4040 case _OrthancPluginService_LookupStudy: |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
4041 case _OrthancPluginService_LookupStudyWithAccessionNumber: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
4042 case _OrthancPluginService_LookupSeries: |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
4043 case _OrthancPluginService_LookupInstance: |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
4044 LookupResource(service, parameters); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
4045 return true; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
4046 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4047 case _OrthancPluginService_GetInstanceRemoteAet: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4048 case _OrthancPluginService_GetInstanceSize: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4049 case _OrthancPluginService_GetInstanceData: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4050 case _OrthancPluginService_GetInstanceJson: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4051 case _OrthancPluginService_GetInstanceSimplifiedJson: |
1067
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
4052 case _OrthancPluginService_HasInstanceMetadata: |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
4053 case _OrthancPluginService_GetInstanceMetadata: |
1815
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
4054 case _OrthancPluginService_GetInstanceOrigin: |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
4055 case _OrthancPluginService_GetInstanceTransferSyntaxUid: |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
4056 case _OrthancPluginService_HasInstancePixelData: |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4057 AccessDicomInstance(service, parameters); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4058 return true; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
4059 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4060 case _OrthancPluginService_GetInstanceFramesCount: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4061 case _OrthancPluginService_GetInstanceRawFrame: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4062 case _OrthancPluginService_GetInstanceDecodedFrame: |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4063 case _OrthancPluginService_SerializeDicomInstance: |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4064 case _OrthancPluginService_GetInstanceAdvancedJson: |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4065 case _OrthancPluginService_GetInstanceDicomWebJson: |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4066 case _OrthancPluginService_GetInstanceDicomWebXml: |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4067 AccessDicomInstance2(service, parameters); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4068 return true; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4069 |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4070 case _OrthancPluginService_SetGlobalProperty: |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
4071 { |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4072 const _OrthancPluginGlobalProperty& p = |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4073 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters); |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4074 if (p.property < 1024) |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4075 { |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4076 return false; |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4077 } |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4078 else |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4079 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4080 PImpl::ServerContextLock lock(*pimpl_); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4081 lock.GetContext().GetIndex().SetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value); |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4082 return true; |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4083 } |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4084 } |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4085 |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4086 case _OrthancPluginService_GetGlobalProperty: |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4087 { |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4088 const _OrthancPluginGlobalProperty& p = |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4089 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters); |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4090 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4091 std::string result; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4092 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4093 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4094 PImpl::ServerContextLock lock(*pimpl_); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4095 result = lock.GetContext().GetIndex().GetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4096 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4097 |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
4098 *(p.result) = CopyString(result); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
4099 return true; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
4100 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
4101 |
1407
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4102 case _OrthancPluginService_GetExpectedDatabaseVersion: |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4103 { |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4104 const _OrthancPluginReturnSingleValue& p = |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4105 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4106 *(p.resultUint32) = ORTHANC_DATABASE_VERSION; |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4107 return true; |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4108 } |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
4109 |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4110 case _OrthancPluginService_StartMultipartAnswer: |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4111 { |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4112 const _OrthancPluginStartMultipartAnswer& p = |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4113 *reinterpret_cast<const _OrthancPluginStartMultipartAnswer*>(parameters); |
3528
f6fe095f7130
don't open a multipart stream if plugin only sends one part
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
4114 reinterpret_cast<PImpl::PluginHttpOutput*>(p.output)->StartMultipart(p.subType, p.contentType); |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4115 return true; |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4116 } |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4117 |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4118 case _OrthancPluginService_SendMultipartItem: |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
4119 ApplySendMultipartItem(parameters); |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4120 return true; |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
4121 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
4122 case _OrthancPluginService_SendMultipartItem2: |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
4123 ApplySendMultipartItem2(parameters); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
4124 return true; |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
4125 |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4126 case _OrthancPluginService_ReadFile: |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4127 { |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4128 const _OrthancPluginReadFile& p = |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4129 *reinterpret_cast<const _OrthancPluginReadFile*>(parameters); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4130 |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4131 std::string content; |
2140 | 4132 SystemToolbox::ReadFile(content, p.path); |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4133 CopyToMemoryBuffer(*p.target, content.size() > 0 ? content.c_str() : NULL, content.size()); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4134 |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4135 return true; |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4136 } |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4137 |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4138 case _OrthancPluginService_WriteFile: |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4139 { |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4140 const _OrthancPluginWriteFile& p = |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4141 *reinterpret_cast<const _OrthancPluginWriteFile*>(parameters); |
4189
15572f0bd743
run fsync() in OrthancPluginWriteFile()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4105
diff
changeset
|
4142 SystemToolbox::WriteFile(p.data, p.size, p.path, true /* run fsync() */); |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4143 return true; |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4144 } |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
4145 |
1593
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4146 case _OrthancPluginService_GetErrorDescription: |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4147 { |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4148 const _OrthancPluginGetErrorDescription& p = |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4149 *reinterpret_cast<const _OrthancPluginGetErrorDescription*>(parameters); |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4150 *(p.target) = EnumerationToString(static_cast<ErrorCode>(p.error)); |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4151 return true; |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4152 } |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
4153 |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4154 case _OrthancPluginService_GetImagePixelFormat: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4155 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
4156 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1625 | 4157 *(p.resultPixelFormat) = Plugins::Convert(reinterpret_cast<const ImageAccessor*>(p.image)->GetFormat()); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4158 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4159 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4160 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4161 case _OrthancPluginService_GetImageWidth: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4162 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
4163 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4164 *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetWidth(); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4165 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4166 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4167 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4168 case _OrthancPluginService_GetImageHeight: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4169 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
4170 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4171 *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetHeight(); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4172 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4173 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4174 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4175 case _OrthancPluginService_GetImagePitch: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4176 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
4177 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4178 *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetPitch(); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4179 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4180 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4181 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4182 case _OrthancPluginService_GetImageBuffer: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4183 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
4184 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
4201 | 4185 *(p.resultBuffer) = const_cast<void*>(reinterpret_cast<const ImageAccessor*>(p.image)->GetConstBuffer()); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4186 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4187 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4188 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4189 case _OrthancPluginService_FreeImage: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4190 { |
1605 | 4191 const _OrthancPluginFreeImage& p = *reinterpret_cast<const _OrthancPluginFreeImage*>(parameters); |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4192 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4193 if (p.image != NULL) |
1609
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
4194 { |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
4195 delete reinterpret_cast<ImageAccessor*>(p.image); |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
4196 } |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4197 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4198 return true; |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4199 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4200 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4201 case _OrthancPluginService_UncompressImage: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4202 UncompressImage(parameters); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4203 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4204 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4205 case _OrthancPluginService_CompressImage: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4206 CompressImage(parameters); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4207 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4208 |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
4209 case _OrthancPluginService_CallHttpClient: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
4210 CallHttpClient(parameters); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
4211 return true; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
4212 |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4213 case _OrthancPluginService_CallHttpClient2: |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4214 CallHttpClient2(parameters); |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4215 return true; |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4216 |
3413 | 4217 case _OrthancPluginService_ChunkedHttpClient: |
4218 ChunkedHttpClient(parameters); | |
3387
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
4219 return true; |
a48d652f1500
new function OrthancPluginHttpClientChunkedBody(), new class OrthancPlugins::HttpClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3209
diff
changeset
|
4220 |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
4221 case _OrthancPluginService_ConvertPixelFormat: |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
4222 ConvertPixelFormat(parameters); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
4223 return true; |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
4224 |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4225 case _OrthancPluginService_GetFontsCount: |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4226 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4227 const _OrthancPluginReturnSingleValue& p = |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4228 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
4229 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
4230 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
4231 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
4232 *(p.resultUint32) = lock.GetConfiguration().GetFontRegistry().GetSize(); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
4233 } |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
4234 |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4235 return true; |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4236 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4237 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4238 case _OrthancPluginService_GetFontInfo: |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4239 GetFontInfo(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4240 return true; |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4241 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4242 case _OrthancPluginService_DrawText: |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4243 DrawText(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4244 return true; |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
4245 |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4246 case _OrthancPluginService_StorageAreaCreate: |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4247 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4248 const _OrthancPluginStorageAreaCreate& p = |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4249 *reinterpret_cast<const _OrthancPluginStorageAreaCreate*>(parameters); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4250 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
2028 | 4251 storage.Create(p.uuid, p.content, static_cast<size_t>(p.size), Plugins::Convert(p.type)); |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4252 return true; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4253 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4254 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4255 case _OrthancPluginService_StorageAreaRead: |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4256 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4257 const _OrthancPluginStorageAreaRead& p = |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4258 *reinterpret_cast<const _OrthancPluginStorageAreaRead*>(parameters); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4259 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
4484
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
4260 std::unique_ptr<IMemoryBuffer> content(storage.Read(p.uuid, Plugins::Convert(p.type))); |
64f06e7d5fc7
new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4483
diff
changeset
|
4261 CopyToMemoryBuffer(*p.target, content->GetData(), content->GetSize()); |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4262 return true; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4263 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4264 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4265 case _OrthancPluginService_StorageAreaRemove: |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4266 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4267 const _OrthancPluginStorageAreaRemove& p = |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4268 *reinterpret_cast<const _OrthancPluginStorageAreaRemove*>(parameters); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4269 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
1625 | 4270 storage.Remove(p.uuid, Plugins::Convert(p.type)); |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4271 return true; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4272 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
4273 |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
4274 case _OrthancPluginService_DicomBufferToJson: |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
4275 case _OrthancPluginService_DicomInstanceToJson: |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
4276 ApplyDicomToJson(service, parameters); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
4277 return true; |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
4278 |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
4279 case _OrthancPluginService_CreateDicom: |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4280 { |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4281 const _OrthancPluginCreateDicom& p = |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4282 *reinterpret_cast<const _OrthancPluginCreateDicom*>(parameters); |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4283 ApplyCreateDicom(p, NULL); |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
4284 return true; |
4477
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4285 } |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4286 |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4287 case _OrthancPluginService_CreateDicom2: |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4288 { |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4289 // New in Orthanc 1.9.0 |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4290 const _OrthancPluginCreateDicom2& p = |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4291 *reinterpret_cast<const _OrthancPluginCreateDicom2*>(parameters); |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4292 ApplyCreateDicom(p.createDicom, p.privateCreator); |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4293 return true; |
0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
4294 } |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
4295 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
4296 case _OrthancPluginService_WorklistAddAnswer: |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
4297 { |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4298 const _OrthancPluginWorklistAnswersOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4299 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
4300 reinterpret_cast<const WorklistHandler*>(p.query)->AddAnswer(p.answers, p.dicom, p.size); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4301 return true; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4302 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4303 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
4304 case _OrthancPluginService_WorklistMarkIncomplete: |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4305 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4306 const _OrthancPluginWorklistAnswersOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4307 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4308 reinterpret_cast<DicomFindAnswers*>(p.answers)->SetComplete(false); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4309 return true; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4310 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4311 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
4312 case _OrthancPluginService_WorklistIsMatch: |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4313 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4314 const _OrthancPluginWorklistQueryOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4315 *reinterpret_cast<const _OrthancPluginWorklistQueryOperation*>(parameters); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4316 *p.isMatch = reinterpret_cast<const WorklistHandler*>(p.query)->IsMatch(p.dicom, p.size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4317 return true; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4318 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4319 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
4320 case _OrthancPluginService_WorklistGetDicomQuery: |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4321 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4322 const _OrthancPluginWorklistQueryOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
4323 *reinterpret_cast<const _OrthancPluginWorklistQueryOperation*>(parameters); |
1812 | 4324 reinterpret_cast<const WorklistHandler*>(p.query)->GetDicomQuery(*p.target); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
4325 return true; |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
4326 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
4327 |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4328 case _OrthancPluginService_FindAddAnswer: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4329 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4330 const _OrthancPluginFindOperation& p = |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4331 *reinterpret_cast<const _OrthancPluginFindOperation*>(parameters); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4332 reinterpret_cast<DicomFindAnswers*>(p.answers)->Add(p.dicom, p.size); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4333 return true; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4334 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4335 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4336 case _OrthancPluginService_FindMarkIncomplete: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4337 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4338 const _OrthancPluginFindOperation& p = |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4339 *reinterpret_cast<const _OrthancPluginFindOperation*>(parameters); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4340 reinterpret_cast<DicomFindAnswers*>(p.answers)->SetComplete(false); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4341 return true; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4342 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4343 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4344 case _OrthancPluginService_GetFindQuerySize: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4345 case _OrthancPluginService_GetFindQueryTag: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4346 case _OrthancPluginService_GetFindQueryTagName: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4347 case _OrthancPluginService_GetFindQueryValue: |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4348 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4349 const _OrthancPluginFindOperation& p = |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4350 *reinterpret_cast<const _OrthancPluginFindOperation*>(parameters); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4351 reinterpret_cast<const FindHandler*>(p.query)->Invoke(service, p); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4352 return true; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4353 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
4354 |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
4355 case _OrthancPluginService_CreateImage: |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
4356 case _OrthancPluginService_CreateImageAccessor: |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
4357 case _OrthancPluginService_DecodeDicomImage: |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
4358 ApplyCreateImage(service, parameters); |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
4359 return true; |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
4360 |
1833
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
4361 case _OrthancPluginService_ComputeMd5: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
4362 case _OrthancPluginService_ComputeSha1: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
4363 ComputeHash(service, parameters); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
4364 return true; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
4365 |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
4366 case _OrthancPluginService_LookupDictionary: |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
4367 ApplyLookupDictionary(parameters); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
4368 return true; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
4369 |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4370 case _OrthancPluginService_GenerateUuid: |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4371 { |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4372 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = |
2512
4dcafa8d6633
SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
4373 CopyString(Toolbox::GenerateUuid()); |
1987
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4374 return true; |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4375 } |
ce90d109bb64
new plugin functions: OrthancPluginHttpClient and OrthancPluginGenerateUuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1984
diff
changeset
|
4376 |
2210
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4377 case _OrthancPluginService_CreateFindMatcher: |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4378 { |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4379 const _OrthancPluginCreateFindMatcher& p = |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4380 *reinterpret_cast<const _OrthancPluginCreateFindMatcher*>(parameters); |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4381 ParsedDicomFile query(p.query, p.size); |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
4382 *(p.target) = reinterpret_cast<OrthancPluginFindMatcher*>(new HierarchicalMatcher(query)); |
2210
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4383 return true; |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4384 } |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4385 |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4386 case _OrthancPluginService_FreeFindMatcher: |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4387 { |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4388 const _OrthancPluginFreeFindMatcher& p = |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4389 *reinterpret_cast<const _OrthancPluginFreeFindMatcher*>(parameters); |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4390 |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4391 if (p.matcher != NULL) |
2210
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4392 { |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4393 delete reinterpret_cast<HierarchicalMatcher*>(p.matcher); |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4394 } |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4395 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4396 return true; |
2210
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4397 } |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4398 |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4399 case _OrthancPluginService_FindMatcherIsMatch: |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4400 { |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4401 const _OrthancPluginFindMatcherIsMatch& p = |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4402 *reinterpret_cast<const _OrthancPluginFindMatcherIsMatch*>(parameters); |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4403 |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4404 if (p.matcher == NULL) |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4405 { |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4406 throw OrthancException(ErrorCode_NullPointer); |
2210
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4407 } |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4408 else |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4409 { |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4410 ParsedDicomFile query(p.dicom, p.size); |
2215
028214a95194
refactoring the worklist sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2210
diff
changeset
|
4411 *p.isMatch = reinterpret_cast<const HierarchicalMatcher*>(p.matcher)->Match(query) ? 1 : 0; |
2210
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4412 return true; |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4413 } |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4414 } |
7bcff7bb7cbf
OrthancPluginFindMatcher
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2172
diff
changeset
|
4415 |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4416 case _OrthancPluginService_GetPeers: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4417 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4418 const _OrthancPluginGetPeers& p = |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4419 *reinterpret_cast<const _OrthancPluginGetPeers*>(parameters); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4420 *(p.peers) = reinterpret_cast<OrthancPluginPeers*>(new OrthancPeers); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4421 return true; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4422 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4423 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4424 case _OrthancPluginService_FreePeers: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4425 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4426 const _OrthancPluginFreePeers& p = |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4427 *reinterpret_cast<const _OrthancPluginFreePeers*>(parameters); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4428 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4429 if (p.peers != NULL) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4430 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4431 delete reinterpret_cast<OrthancPeers*>(p.peers); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4432 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4433 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4434 return true; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4435 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4436 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4437 case _OrthancPluginService_GetPeersCount: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4438 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4439 const _OrthancPluginGetPeersCount& p = |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4440 *reinterpret_cast<const _OrthancPluginGetPeersCount*>(parameters); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4441 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4442 if (p.peers == NULL) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4443 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4444 throw OrthancException(ErrorCode_NullPointer); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4445 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4446 else |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4447 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4448 *(p.target) = reinterpret_cast<const OrthancPeers*>(p.peers)->GetPeersCount(); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4449 return true; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4450 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4451 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4452 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4453 case _OrthancPluginService_GetPeerName: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4454 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4455 const _OrthancPluginGetPeerProperty& p = |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4456 *reinterpret_cast<const _OrthancPluginGetPeerProperty*>(parameters); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4457 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4458 if (p.peers == NULL) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4459 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4460 throw OrthancException(ErrorCode_NullPointer); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4461 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4462 else |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4463 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4464 *(p.target) = reinterpret_cast<const OrthancPeers*>(p.peers)->GetPeerName(p.peerIndex).c_str(); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4465 return true; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4466 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4467 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4468 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4469 case _OrthancPluginService_GetPeerUrl: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4470 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4471 const _OrthancPluginGetPeerProperty& p = |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4472 *reinterpret_cast<const _OrthancPluginGetPeerProperty*>(parameters); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4473 |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4474 if (p.peers == NULL) |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4475 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4476 throw OrthancException(ErrorCode_NullPointer); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4477 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4478 else |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4479 { |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4480 *(p.target) = reinterpret_cast<const OrthancPeers*>(p.peers)->GetPeerParameters(p.peerIndex).GetUrl().c_str(); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4481 return true; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4482 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4483 } |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4484 |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4485 case _OrthancPluginService_GetPeerUserProperty: |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4486 { |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4487 const _OrthancPluginGetPeerProperty& p = |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4488 *reinterpret_cast<const _OrthancPluginGetPeerProperty*>(parameters); |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4489 |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4490 if (p.peers == NULL || |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4491 p.userProperty == NULL) |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4492 { |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4493 throw OrthancException(ErrorCode_NullPointer); |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4494 } |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4495 else |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4496 { |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4497 const WebServiceParameters::Dictionary& properties = |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4498 reinterpret_cast<const OrthancPeers*>(p.peers)->GetPeerParameters(p.peerIndex).GetUserProperties(); |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4499 |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4500 WebServiceParameters::Dictionary::const_iterator found = |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4501 properties.find(p.userProperty); |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4502 |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4503 if (found == properties.end()) |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4504 { |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4505 *(p.target) = NULL; |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4506 } |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4507 else |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4508 { |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4509 *(p.target) = found->second.c_str(); |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4510 } |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4511 |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4512 return true; |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4513 } |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4514 } |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2820
diff
changeset
|
4515 |
2799
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4516 case _OrthancPluginService_CallPeerApi: |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4517 CallPeerApi(parameters); |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4518 return true; |
6e3a60b85da6
New primitives to access Orthanc peers from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2787
diff
changeset
|
4519 |
2815
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4520 case _OrthancPluginService_CreateJob: |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4521 { |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4522 const _OrthancPluginCreateJob& p = |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4523 *reinterpret_cast<const _OrthancPluginCreateJob*>(parameters); |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4524 *(p.target) = reinterpret_cast<OrthancPluginJob*>(new PluginsJob(p)); |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4525 return true; |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4526 } |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4527 |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4528 case _OrthancPluginService_FreeJob: |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4529 { |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4530 const _OrthancPluginFreeJob& p = |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4531 *reinterpret_cast<const _OrthancPluginFreeJob*>(parameters); |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4532 |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4533 if (p.job != NULL) |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4534 { |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4535 delete reinterpret_cast<PluginsJob*>(p.job); |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4536 } |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4537 |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4538 return true; |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4539 } |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4540 |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4541 case _OrthancPluginService_SubmitJob: |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4542 { |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4543 const _OrthancPluginSubmitJob& p = |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4544 *reinterpret_cast<const _OrthancPluginSubmitJob*>(parameters); |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4545 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4546 std::string uuid; |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4547 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4548 PImpl::ServerContextLock lock(*pimpl_); |
2815
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4549 lock.GetContext().GetJobsEngine().GetRegistry().Submit |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
4550 (uuid, reinterpret_cast<PluginsJob*>(p.job), p.priority); |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4551 |
2814
7d1d3136f6cf
more generic handling of content and serialization in plugin jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2813
diff
changeset
|
4552 *p.resultId = CopyString(uuid); |
2813 | 4553 |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4554 return true; |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4555 } |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4556 |
2984
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4557 case _OrthancPluginService_AutodetectMimeType: |
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4558 { |
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4559 const _OrthancPluginRetrieveStaticString& p = |
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4560 *reinterpret_cast<const _OrthancPluginRetrieveStaticString*>(parameters); |
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4561 *p.result = EnumerationToString(SystemToolbox::AutodetectMimeType(p.argument)); |
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4562 return true; |
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4563 } |
db8f360fcb41
OrthancPluginAutodetectMimeType()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2960
diff
changeset
|
4564 |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4565 case _OrthancPluginService_SetMetricsValue: |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4566 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4567 const _OrthancPluginSetMetricsValue& p = |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4568 *reinterpret_cast<const _OrthancPluginSetMetricsValue*>(parameters); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4569 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4570 MetricsType type; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4571 switch (p.type) |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4572 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4573 case OrthancPluginMetricsType_Default: |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4574 type = MetricsType_Default; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4575 break; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4576 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4577 case OrthancPluginMetricsType_Timer: |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4578 type = MetricsType_MaxOver10Seconds; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4579 break; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4580 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4581 default: |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4582 throw OrthancException(ErrorCode_ParameterOutOfRange); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4583 } |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4584 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4585 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4586 PImpl::ServerContextLock lock(*pimpl_); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4587 lock.GetContext().GetMetricsRegistry().SetValue(p.name, p.value, type); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4588 } |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4589 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4590 return true; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4591 } |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4592 |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4593 case _OrthancPluginService_EncodeDicomWebJson: |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4594 case _OrthancPluginService_EncodeDicomWebXml: |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4595 { |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4596 const _OrthancPluginEncodeDicomWeb& p = |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4597 *reinterpret_cast<const _OrthancPluginEncodeDicomWeb*>(parameters); |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4598 |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4599 DicomWebBinaryFormatter formatter(p.callback); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4600 formatter.Apply(p.target, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4601 (service == _OrthancPluginService_EncodeDicomWebJson), |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4602 p.dicom, p.dicomSize); |
3924
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4603 return true; |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4604 } |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4605 |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4606 case _OrthancPluginService_EncodeDicomWebJson2: |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4607 case _OrthancPluginService_EncodeDicomWebXml2: |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4608 { |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4609 const _OrthancPluginEncodeDicomWeb2& p = |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4610 *reinterpret_cast<const _OrthancPluginEncodeDicomWeb2*>(parameters); |
395c59208f10
new functions in SDK: OrthancPluginEncodeDicomWebJson2() and OrthancPluginEncodeDicomWebXml2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3919
diff
changeset
|
4611 |
3925
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4612 DicomWebBinaryFormatter formatter(p.callback, p.payload); |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4613 formatter.Apply(p.target, |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4614 (service == _OrthancPluginService_EncodeDicomWebJson2), |
dd112d2b83f0
new SDK: OrthancPluginGetInstanceAdvancedJson(), OrthancPluginGetInstanceDicomWebJson() and OrthancPluginGetInstanceDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3924
diff
changeset
|
4615 p.dicom, p.dicomSize); |
3205
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4616 return true; |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4617 } |
6c86d4d407da
new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3179
diff
changeset
|
4618 |
3429
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
4619 case _OrthancPluginService_GetTagName: |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
4620 GetTagName(parameters); |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
4621 return true; |
954d15f24366
new function in SDK: OrthancPluginGetTagName()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3420
diff
changeset
|
4622 |
3916
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4623 case _OrthancPluginService_CreateDicomInstance: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4624 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4625 const _OrthancPluginCreateDicomInstance& p = |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4626 *reinterpret_cast<const _OrthancPluginCreateDicomInstance*>(parameters); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4627 *(p.target) = reinterpret_cast<OrthancPluginDicomInstance*>( |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4628 new DicomInstanceFromBuffer(p.buffer, p.size)); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4629 return true; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4630 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4631 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4632 case _OrthancPluginService_FreeDicomInstance: |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4633 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4634 const _OrthancPluginFreeDicomInstance& p = |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4635 *reinterpret_cast<const _OrthancPluginFreeDicomInstance*>(parameters); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4636 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4637 if (p.dicom != NULL) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4638 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4639 IDicomInstance* obj = reinterpret_cast<IDicomInstance*>(p.dicom); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4640 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4641 if (obj->CanBeFreed()) |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4642 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4643 delete obj; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4644 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4645 else |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4646 { |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4647 throw OrthancException(ErrorCode_Plugin, "Cannot free a DICOM instance provided to a callback"); |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4648 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4649 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4650 |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4651 return true; |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4652 } |
0e3849268a55
new plugin SDK primitives related to OrthancPluginDicomInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3906
diff
changeset
|
4653 |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4654 case _OrthancPluginService_TranscodeDicomInstance: |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4655 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4656 const _OrthancPluginCreateDicomInstance& p = |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4657 *reinterpret_cast<const _OrthancPluginCreateDicomInstance*>(parameters); |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4658 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4659 DicomTransferSyntax transferSyntax; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4660 if (p.transferSyntax == NULL || |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4661 !LookupTransferSyntax(transferSyntax, p.transferSyntax)) |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4662 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4663 throw OrthancException(ErrorCode_ParameterOutOfRange, "Unsupported transfer syntax: " + |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4664 std::string(p.transferSyntax == NULL ? "(null)" : p.transferSyntax)); |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4665 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4666 else |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4667 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4668 std::set<DicomTransferSyntax> syntaxes; |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4669 syntaxes.insert(transferSyntax); |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4670 |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4671 IDicomTranscoder::DicomImage source; |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4672 source.SetExternalBuffer(p.buffer, p.size); |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4673 |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4674 IDicomTranscoder::DicomImage transcoded; |
3951
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3946
diff
changeset
|
4675 bool success; |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4676 |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4677 { |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4678 PImpl::ServerContextLock lock(*pimpl_); |
3951
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3946
diff
changeset
|
4679 success = lock.GetContext().Transcode( |
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3946
diff
changeset
|
4680 transcoded, source, syntaxes, true /* allow new sop */); |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4681 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4682 |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4683 if (success) |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4684 { |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4685 *(p.target) = reinterpret_cast<OrthancPluginDicomInstance*>( |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4686 new DicomInstanceFromTranscoded(transcoded)); |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4687 return true; |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4688 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4689 else |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4690 { |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3944
diff
changeset
|
4691 throw OrthancException(ErrorCode_NotImplemented, "Cannot transcode image"); |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4692 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4693 } |
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4694 } |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4695 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4696 case _OrthancPluginService_CreateMemoryBuffer: |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4697 { |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4698 const _OrthancPluginCreateMemoryBuffer& p = |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4699 *reinterpret_cast<const _OrthancPluginCreateMemoryBuffer*>(parameters); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4700 |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4701 p.target->data = NULL; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4702 p.target->size = 0; |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4703 |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4704 if (p.size != 0) |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4705 { |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4706 p.target->data = malloc(p.size); |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4707 if (p.target->data == NULL) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4708 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4709 throw OrthancException(ErrorCode_NotEnoughMemory); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4710 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4711 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4712 p.target->size = p.size; |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4713 } |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4714 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4715 return true; |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4716 } |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4717 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4718 case _OrthancPluginService_CreateMemoryBuffer64: |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4719 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4720 const _OrthancPluginCreateMemoryBuffer64& p = |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4721 *reinterpret_cast<const _OrthancPluginCreateMemoryBuffer64*>(parameters); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4722 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4723 p.target->data = NULL; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4724 p.target->size = 0; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4725 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4726 if (p.size != 0) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4727 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4728 p.target->data = malloc(p.size); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4729 if (p.target->data == NULL) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4730 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4731 throw OrthancException(ErrorCode_NotEnoughMemory); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4732 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4733 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4734 p.target->size = p.size; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4735 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4736 |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4737 return true; |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4738 } |
3919
6f11b3233a06
OrthancPluginTranscodeDicomInstance() and OrthancPluginSerializeDicomInstance()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3916
diff
changeset
|
4739 |
4364
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4740 case _OrthancPluginService_RegisterIncomingHttpRequestFilter: |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4741 RegisterIncomingHttpRequestFilter(parameters); |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4742 return true; |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4743 |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4744 case _OrthancPluginService_RegisterIncomingHttpRequestFilter2: |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4745 RegisterIncomingHttpRequestFilter2(parameters); |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4746 return true; |
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
4747 |
899 | 4748 default: |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4749 return false; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4750 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4751 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4752 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4753 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4754 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4755 bool OrthancPlugins::InvokeProtectedService(SharedLibrary& plugin, |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4756 _OrthancPluginService service, |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4757 const void* parameters) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4758 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4759 // Services that must be run in mutual exclusion. Guideline: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4760 // Whenever "pimpl_" is directly accessed by the service, it |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4761 // should be listed here. |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4762 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4763 switch (service) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4764 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4765 case _OrthancPluginService_RegisterRestCallback: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4766 RegisterRestCallback(parameters, true); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4767 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4768 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4769 case _OrthancPluginService_RegisterRestCallbackNoLock: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4770 RegisterRestCallback(parameters, false); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4771 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4772 |
3414 | 4773 case _OrthancPluginService_RegisterChunkedRestCallback: |
4774 RegisterChunkedRestCallback(parameters); | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
4775 return true; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
4776 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4777 case _OrthancPluginService_RegisterOnStoredInstanceCallback: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4778 RegisterOnStoredInstanceCallback(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4779 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4780 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4781 case _OrthancPluginService_RegisterOnChangeCallback: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4782 RegisterOnChangeCallback(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4783 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4784 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4785 case _OrthancPluginService_RegisterWorklistCallback: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4786 RegisterWorklistCallback(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4787 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4788 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4789 case _OrthancPluginService_RegisterFindCallback: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4790 RegisterFindCallback(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4791 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4792 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4793 case _OrthancPluginService_RegisterMoveCallback: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4794 RegisterMoveCallback(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4795 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4796 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4797 case _OrthancPluginService_RegisterDecodeImageCallback: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4798 RegisterDecodeImageCallback(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4799 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4800 |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4801 case _OrthancPluginService_RegisterTranscoderCallback: |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4802 RegisterTranscoderCallback(parameters); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4803 return true; |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
4804 |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4805 case _OrthancPluginService_RegisterJobsUnserializer: |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4806 RegisterJobsUnserializer(parameters); |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4807 return true; |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
4808 |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
4809 case _OrthancPluginService_RegisterIncomingDicomInstanceFilter: |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
4810 RegisterIncomingDicomInstanceFilter(parameters); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
4811 return true; |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
4812 |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4813 case _OrthancPluginService_RegisterRefreshMetricsCallback: |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4814 RegisterRefreshMetricsCallback(parameters); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4815 return true; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
4816 |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
4817 case _OrthancPluginService_RegisterStorageCommitmentScpCallback: |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
4818 RegisterStorageCommitmentScpCallback(parameters); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
4819 return true; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
4820 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4821 case _OrthancPluginService_RegisterStorageArea: |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4822 case _OrthancPluginService_RegisterStorageArea2: |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4823 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
4824 CLOG(INFO, PLUGINS) << "Plugin has registered a custom storage area"; |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4825 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4826 if (pimpl_->storageArea_.get() == NULL) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4827 { |
4440
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4828 if (service == _OrthancPluginService_RegisterStorageArea) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4829 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4830 const _OrthancPluginRegisterStorageArea& p = |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4831 *reinterpret_cast<const _OrthancPluginRegisterStorageArea*>(parameters); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4832 pimpl_->storageArea_.reset(new StorageAreaFactory(plugin, p, GetErrorDictionary())); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4833 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4834 else if (service == _OrthancPluginService_RegisterStorageArea2) |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4835 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4836 const _OrthancPluginRegisterStorageArea2& p = |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4837 *reinterpret_cast<const _OrthancPluginRegisterStorageArea2*>(parameters); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4838 pimpl_->storageArea_.reset(new StorageAreaFactory(plugin, p, GetErrorDictionary())); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4839 } |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4840 else |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4841 { |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4842 throw OrthancException(ErrorCode_InternalError); |
eddb212b2df9
New functions in the SDK: OrthancPluginCreateMemoryBuffer64() and OrthancPluginRegisterStorageArea2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
4843 } |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4844 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4845 else |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4846 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4847 throw OrthancException(ErrorCode_StorageAreaAlreadyRegistered); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4848 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4849 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4850 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4851 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4852 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4853 case _OrthancPluginService_SetPluginProperty: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4854 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4855 const _OrthancPluginSetPluginProperty& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4856 *reinterpret_cast<const _OrthancPluginSetPluginProperty*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4857 pimpl_->properties_[std::make_pair(p.plugin, p.property)] = p.value; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4858 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4859 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4860 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4861 case _OrthancPluginService_GetCommandLineArgumentsCount: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4862 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4863 const _OrthancPluginReturnSingleValue& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4864 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4865 *(p.resultUint32) = pimpl_->argc_ - 1; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4866 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4867 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4868 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4869 case _OrthancPluginService_GetCommandLineArgument: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4870 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4871 const _OrthancPluginGlobalProperty& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4872 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4873 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4874 if (p.property + 1 > pimpl_->argc_) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4875 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4876 return false; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4877 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4878 else |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4879 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4880 std::string arg = std::string(pimpl_->argv_[p.property + 1]); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4881 *(p.result) = CopyString(arg); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4882 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4883 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4884 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4885 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4886 case _OrthancPluginService_RegisterDatabaseBackend: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4887 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
4888 CLOG(INFO, PLUGINS) << "Plugin has registered a custom database back-end"; |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4889 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4890 const _OrthancPluginRegisterDatabaseBackend& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4891 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackend*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4892 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4893 if (pimpl_->database_.get() == NULL) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4894 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4895 pimpl_->database_.reset(new OrthancPluginDatabase(plugin, GetErrorDictionary(), |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4896 *p.backend, NULL, 0, p.payload)); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4897 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4898 else |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4899 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4900 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4901 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4902 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4903 *(p.result) = reinterpret_cast<OrthancPluginDatabaseContext*>(pimpl_->database_.get()); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4904 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4905 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4906 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4907 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4908 case _OrthancPluginService_RegisterDatabaseBackendV2: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4909 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
4910 CLOG(INFO, PLUGINS) << "Plugin has registered a custom database back-end"; |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4911 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4912 const _OrthancPluginRegisterDatabaseBackendV2& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4913 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackendV2*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4914 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4915 if (pimpl_->database_.get() == NULL) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4916 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4917 pimpl_->database_.reset(new OrthancPluginDatabase(plugin, GetErrorDictionary(), |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4918 *p.backend, p.extensions, |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4919 p.extensionsSize, p.payload)); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4920 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4921 else |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4922 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4923 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4924 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4925 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4926 *(p.result) = reinterpret_cast<OrthancPluginDatabaseContext*>(pimpl_->database_.get()); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4927 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4928 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4929 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4930 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4931 case _OrthancPluginService_DatabaseAnswer: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4932 throw OrthancException(ErrorCode_InternalError); // Implemented before locking (*) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4933 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4934 case _OrthancPluginService_RegisterErrorCode: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4935 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4936 const _OrthancPluginRegisterErrorCode& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4937 *reinterpret_cast<const _OrthancPluginRegisterErrorCode*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4938 *(p.target) = pimpl_->dictionary_.Register(plugin, p.code, p.httpStatus, p.message); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4939 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4940 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4941 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4942 case _OrthancPluginService_RegisterDictionaryTag: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4943 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4944 const _OrthancPluginRegisterDictionaryTag& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4945 *reinterpret_cast<const _OrthancPluginRegisterDictionaryTag*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4946 FromDcmtkBridge::RegisterDictionaryTag(DicomTag(p.group, p.element), |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4947 Plugins::Convert(p.vr), p.name, |
2115
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4948 p.minMultiplicity, p.maxMultiplicity, ""); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4949 return true; |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4950 } |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4951 |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4952 case _OrthancPluginService_RegisterPrivateDictionaryTag: |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4953 { |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4954 const _OrthancPluginRegisterPrivateDictionaryTag& p = |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4955 *reinterpret_cast<const _OrthancPluginRegisterPrivateDictionaryTag*>(parameters); |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4956 FromDcmtkBridge::RegisterDictionaryTag(DicomTag(p.group, p.element), |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4957 Plugins::Convert(p.vr), p.name, |
a657f7772e69
Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2107
diff
changeset
|
4958 p.minMultiplicity, p.maxMultiplicity, p.privateCreator); |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4959 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4960 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4961 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4962 case _OrthancPluginService_ReconstructMainDicomTags: |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4963 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4964 const _OrthancPluginReconstructMainDicomTags& p = |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4965 *reinterpret_cast<const _OrthancPluginReconstructMainDicomTags*>(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4966 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4967 if (pimpl_->database_.get() == NULL) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4968 { |
2956 | 4969 throw OrthancException(ErrorCode_DatabasePlugin, |
4970 "The service ReconstructMainDicomTags can only be invoked by custom database plugins"); | |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4971 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4972 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4973 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
2120 | 4974 ServerToolbox::ReconstructMainDicomTags(*pimpl_->database_, storage, Plugins::Convert(p.level)); |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4975 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4976 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4977 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4978 |
4343
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4979 case _OrthancPluginService_GenerateRestApiAuthorizationToken: |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4980 { |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4981 const _OrthancPluginRetrieveDynamicString& p = |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4982 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters); |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4983 const std::string token = Toolbox::GenerateUuid(); |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4984 |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4985 pimpl_->authorizationTokens_.insert(token); |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4986 *p.result = CopyString("Bearer " + token); |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4987 |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4988 return true; |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4989 } |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
4990 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
4991 default: |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4992 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4993 // This service is unknown to the Orthanc plugin engine |
899 | 4994 return false; |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
4995 } |
899 | 4996 } |
4997 } | |
4998 | |
908
e078ea944089
refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
907
diff
changeset
|
4999 |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5000 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5001 bool OrthancPlugins::InvokeService(SharedLibrary& plugin, |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5002 _OrthancPluginService service, |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5003 const void* parameters) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5004 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
5005 CLOG(TRACE, PLUGINS) << "Calling service " << service << " from plugin " << plugin.GetPath(); |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5006 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5007 if (service == _OrthancPluginService_DatabaseAnswer) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5008 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5009 // This case solves a deadlock at (*) reported by James Webster |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5010 // on 2015-10-27 that was present in versions of Orthanc <= |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5011 // 0.9.4 and related to database plugins implementing a custom |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5012 // index. The problem was that locking the database is already |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5013 // ensured by the "ServerIndex" class if the invoked service is |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5014 // "DatabaseAnswer". |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5015 DatabaseAnswer(parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5016 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5017 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5018 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5019 if (InvokeSafeService(plugin, service, parameters)) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5020 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5021 // The invoked service does not require locking |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5022 return true; |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5023 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5024 else |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5025 { |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5026 // The invoked service requires locking |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5027 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); // (*) |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5028 return InvokeProtectedService(plugin, service, parameters); |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5029 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5030 } |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5031 |
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5032 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5033 bool OrthancPlugins::HasStorageArea() const |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5034 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5035 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5036 return pimpl_->storageArea_.get() != NULL; |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5037 } |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5038 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5039 bool OrthancPlugins::HasDatabaseBackend() const |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5040 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5041 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5042 return pimpl_->database_.get() != NULL; |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5043 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5044 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5045 |
1452
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
5046 IStorageArea* OrthancPlugins::CreateStorageArea() |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5047 { |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5048 if (!HasStorageArea()) |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5049 { |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5050 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5051 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5052 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5053 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5054 return pimpl_->storageArea_->Create(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5055 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5056 } |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5057 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5058 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5059 const SharedLibrary& OrthancPlugins::GetStorageAreaLibrary() const |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5060 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5061 if (!HasStorageArea()) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5062 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5063 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5064 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5065 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5066 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5067 return pimpl_->storageArea_->GetSharedLibrary(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5068 } |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
5069 } |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5070 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5071 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5072 IDatabaseWrapper& OrthancPlugins::GetDatabaseBackend() |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5073 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5074 if (!HasDatabaseBackend()) |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5075 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5076 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5077 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5078 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5079 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5080 return *pimpl_->database_; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5081 } |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5082 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5083 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5084 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5085 const SharedLibrary& OrthancPlugins::GetDatabaseBackendLibrary() const |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5086 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5087 if (!HasDatabaseBackend()) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5088 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5089 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5090 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5091 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5092 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5093 return pimpl_->database_->GetSharedLibrary(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5094 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
5095 } |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
5096 |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5097 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5098 const char* OrthancPlugins::GetProperty(const char* plugin, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5099 _OrthancPluginProperty property) const |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5100 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5101 PImpl::Property p = std::make_pair(plugin, property); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5102 PImpl::Properties::const_iterator it = pimpl_->properties_.find(p); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5103 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5104 if (it == pimpl_->properties_.end()) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5105 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5106 return NULL; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5107 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5108 else |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5109 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5110 return it->second.c_str(); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5111 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5112 } |
1280
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5113 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5114 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5115 void OrthancPlugins::SetCommandLineArguments(int argc, char* argv[]) |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5116 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5117 if (argc < 1 || argv == NULL) |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5118 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5119 throw OrthancException(ErrorCode_ParameterOutOfRange); |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5120 } |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5121 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5122 pimpl_->argc_ = argc; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5123 pimpl_->argv_ = argv; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
5124 } |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5125 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5126 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5127 PluginsManager& OrthancPlugins::GetManager() |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5128 { |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5129 return pimpl_->manager_; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5130 } |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5131 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5132 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5133 const PluginsManager& OrthancPlugins::GetManager() const |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5134 { |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5135 return pimpl_->manager_; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
5136 } |
1644
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
5137 |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
5138 |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
5139 PluginsErrorDictionary& OrthancPlugins::GetErrorDictionary() |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
5140 { |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
5141 return pimpl_->dictionary_; |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
5142 } |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5143 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5144 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5145 IWorklistRequestHandler* OrthancPlugins::ConstructWorklistRequestHandler() |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5146 { |
1809
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
5147 if (HasWorklistHandler()) |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5148 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5149 return new WorklistHandler(*this); |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5150 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5151 else |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5152 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5153 return NULL; |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5154 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
5155 } |
1809
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
5156 |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
5157 |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
5158 bool OrthancPlugins::HasWorklistHandler() |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
5159 { |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
5160 boost::mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_); |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
5161 return pimpl_->worklistCallback_ != NULL; |
1809
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
5162 } |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
5163 |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
5164 |
1995
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5165 IFindRequestHandler* OrthancPlugins::ConstructFindRequestHandler() |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5166 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5167 if (HasFindHandler()) |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5168 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5169 return new FindHandler(*this); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5170 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5171 else |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5172 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5173 return NULL; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5174 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5175 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5176 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5177 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5178 bool OrthancPlugins::HasFindHandler() |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5179 { |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5180 boost::mutex::scoped_lock lock(pimpl_->findCallbackMutex_); |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5181 return pimpl_->findCallback_ != NULL; |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5182 } |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5183 |
f0acfa753973
New callback to handle non-worklists C-Find requests: OrthancPluginRegisterCFindCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1987
diff
changeset
|
5184 |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5185 IMoveRequestHandler* OrthancPlugins::ConstructMoveRequestHandler() |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5186 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5187 if (HasMoveHandler()) |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5188 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5189 return new MoveHandler(*this); |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5190 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5191 else |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5192 { |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5193 return NULL; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5194 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5195 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5196 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5197 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5198 bool OrthancPlugins::HasMoveHandler() |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5199 { |
2000
39329372b667
Speedup in plugins by removing unnecessary locks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1999
diff
changeset
|
5200 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); |
1999
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5201 return pimpl_->moveCallbacks_.callback != NULL; |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5202 } |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5203 |
364cc624eb65
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1995
diff
changeset
|
5204 |
1906
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
5205 bool OrthancPlugins::HasCustomImageDecoder() |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
5206 { |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5207 boost::shared_lock<boost::shared_mutex> lock(pimpl_->decoderTranscoderMutex_); |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5208 return !pimpl_->decodeImageCallbacks_.empty(); |
1906
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
5209 } |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
5210 |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
5211 |
3931
e6606d3ec892
new configuration option: BuiltinDecoderTranscoderOrder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
5212 bool OrthancPlugins::HasCustomTranscoder() |
e6606d3ec892
new configuration option: BuiltinDecoderTranscoderOrder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
5213 { |
e6606d3ec892
new configuration option: BuiltinDecoderTranscoderOrder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
5214 boost::shared_lock<boost::shared_mutex> lock(pimpl_->decoderTranscoderMutex_); |
e6606d3ec892
new configuration option: BuiltinDecoderTranscoderOrder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
5215 return !pimpl_->transcoderCallbacks_.empty(); |
e6606d3ec892
new configuration option: BuiltinDecoderTranscoderOrder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
5216 } |
e6606d3ec892
new configuration option: BuiltinDecoderTranscoderOrder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
5217 |
e6606d3ec892
new configuration option: BuiltinDecoderTranscoderOrder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3930
diff
changeset
|
5218 |
3928
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
5219 ImageAccessor* OrthancPlugins::Decode(const void* dicom, |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
5220 size_t size, |
4cdc875510d1
ServerContext::DecodeDicomFrame()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3926
diff
changeset
|
5221 unsigned int frame) |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
5222 { |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5223 boost::shared_lock<boost::shared_mutex> lock(pimpl_->decoderTranscoderMutex_); |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5224 |
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5225 for (PImpl::DecodeImageCallbacks::const_iterator |
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5226 decoder = pimpl_->decodeImageCallbacks_.begin(); |
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5227 decoder != pimpl_->decodeImageCallbacks_.end(); ++decoder) |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
5228 { |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5229 OrthancPluginImage* pluginImage = NULL; |
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5230 if ((*decoder) (&pluginImage, dicom, size, frame) == OrthancPluginErrorCode_Success && |
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5231 pluginImage != NULL) |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
5232 { |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5233 return reinterpret_cast<ImageAccessor*>(pluginImage); |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
5234 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
5235 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
5236 |
2012
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5237 return NULL; |
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5238 } |
50b9bc19dc62
More than one custom image decoder can be installed (e.g. to handle different transfer syntaxes)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2009
diff
changeset
|
5239 |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5240 |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5241 bool OrthancPlugins::IsAllowed(HttpMethod method, |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5242 const char* uri, |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5243 const char* ip, |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5244 const char* username, |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
5245 const HttpToolbox::Arguments& httpHeaders, |
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
5246 const HttpToolbox::GetArguments& getArguments) |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5247 { |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5248 OrthancPluginHttpMethod cMethod = Plugins::Convert(method); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5249 |
1962 | 5250 std::vector<const char*> httpKeys(httpHeaders.size()); |
5251 std::vector<const char*> httpValues(httpHeaders.size()); | |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5252 |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5253 size_t pos = 0; |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
5254 for (HttpToolbox::Arguments::const_iterator |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5255 it = httpHeaders.begin(); it != httpHeaders.end(); ++it, pos++) |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5256 { |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5257 httpKeys[pos] = it->first.c_str(); |
1962 | 5258 httpValues[pos] = it->second.c_str(); |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5259 } |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5260 |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5261 std::vector<const char*> getKeys(getArguments.size()); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5262 std::vector<const char*> getValues(getArguments.size()); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5263 |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5264 for (size_t i = 0; i < getArguments.size(); i++) |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5265 { |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5266 getKeys[i] = getArguments[i].first.c_str(); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5267 getValues[i] = getArguments[i].second.c_str(); |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5268 } |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5269 |
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5270 { |
4364
d527a081f92d
Allow concurrency on the OrthancPluginRegisterIncomingHttpRequestFilter() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4343
diff
changeset
|
5271 boost::shared_lock<boost::shared_mutex> lock(pimpl_->incomingHttpRequestFilterMutex_); |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5272 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5273 // Improved callback with support for GET arguments, since Orthanc 1.3.0 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5274 for (PImpl::IncomingHttpRequestFilters2::const_iterator |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5275 filter = pimpl_->incomingHttpRequestFilters2_.begin(); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5276 filter != pimpl_->incomingHttpRequestFilters2_.end(); ++filter) |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5277 { |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5278 int32_t allowed = (*filter) (cMethod, uri, ip, |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5279 httpKeys.size(), |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5280 httpKeys.empty() ? NULL : &httpKeys[0], |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5281 httpValues.empty() ? NULL : &httpValues[0], |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5282 getKeys.size(), |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5283 getKeys.empty() ? NULL : &getKeys[0], |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5284 getValues.empty() ? NULL : &getValues[0]); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5285 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5286 if (allowed == 0) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5287 { |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5288 return false; |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5289 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5290 else if (allowed != 1) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5291 { |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5292 // The callback is only allowed to answer 0 or 1 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5293 throw OrthancException(ErrorCode_Plugin); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5294 } |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5295 } |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5296 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5297 for (PImpl::IncomingHttpRequestFilters::const_iterator |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5298 filter = pimpl_->incomingHttpRequestFilters_.begin(); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5299 filter != pimpl_->incomingHttpRequestFilters_.end(); ++filter) |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5300 { |
3847
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5301 int32_t allowed = (*filter) (cMethod, uri, ip, httpKeys.size(), |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5302 httpKeys.empty() ? NULL : &httpKeys[0], |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5303 httpValues.empty() ? NULL : &httpValues[0]); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5304 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5305 if (allowed == 0) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5306 { |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5307 return false; |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5308 } |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5309 else if (allowed != 1) |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5310 { |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5311 // The callback is only allowed to answer 0 or 1 |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5312 throw OrthancException(ErrorCode_Plugin); |
1491d501836a
actual implementation of OrthancPluginRegisterIncomingDicomInstanceFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3840
diff
changeset
|
5313 } |
2268
ce5c13b95dac
New function: OrthancPluginRegisterIncomingHttpRequestFilter2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
5314 } |
1961
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5315 } |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5316 |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5317 return true; |
ef1e9856c26f
New callback to filter incoming HTTP requests: OrthancPluginRegisterIncomingHttpRequestFilter()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1918
diff
changeset
|
5318 } |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5319 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5320 |
2815
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
5321 IJob* OrthancPlugins::UnserializeJob(const std::string& type, |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
5322 const Json::Value& value) |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5323 { |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5324 const std::string serialized = value.toStyledString(); |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5325 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5326 boost::mutex::scoped_lock lock(pimpl_->jobsUnserializersMutex_); |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5327 |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5328 for (PImpl::JobsUnserializers::iterator |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5329 unserializer = pimpl_->jobsUnserializers_.begin(); |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5330 unserializer != pimpl_->jobsUnserializers_.end(); ++unserializer) |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5331 { |
2815
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
5332 OrthancPluginJob* job = (*unserializer) (type.c_str(), serialized.c_str()); |
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
5333 if (job != NULL) |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5334 { |
2815
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
5335 return reinterpret_cast<PluginsJob*>(job); |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5336 } |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5337 } |
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5338 |
2815
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2814
diff
changeset
|
5339 return NULL; |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2799
diff
changeset
|
5340 } |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5341 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5342 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5343 void OrthancPlugins::RefreshMetrics() |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5344 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5345 boost::mutex::scoped_lock lock(pimpl_->refreshMetricsMutex_); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5346 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5347 for (PImpl::RefreshMetricsCallbacks::iterator |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5348 it = pimpl_->refreshMetricsCallbacks_.begin(); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5349 it != pimpl_->refreshMetricsCallbacks_.end(); ++it) |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5350 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5351 if (*it != NULL) |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5352 { |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5353 (*it) (); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5354 } |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5355 } |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3120
diff
changeset
|
5356 } |
3395
0ce9b4f5fdf5
new abstraction: IHttpHandler::CreateStreamHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
5357 |
0ce9b4f5fdf5
new abstraction: IHttpHandler::CreateStreamHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
5358 |
3414 | 5359 class OrthancPlugins::HttpServerChunkedReader : public IHttpHandler::IChunkedRequestReader |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5360 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5361 private: |
3414 | 5362 OrthancPluginServerChunkedRequestReader* reader_; |
5363 _OrthancPluginChunkedRestCallback parameters_; | |
5364 PluginsErrorDictionary& errorDictionary_; | |
3399
4e8205871967
OrthancPluginRegisterMultipartRestCallback() is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3397
diff
changeset
|
5365 |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5366 public: |
3414 | 5367 HttpServerChunkedReader(OrthancPluginServerChunkedRequestReader* reader, |
5368 const _OrthancPluginChunkedRestCallback& parameters, | |
5369 PluginsErrorDictionary& errorDictionary) : | |
5370 reader_(reader), | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5371 parameters_(parameters), |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5372 errorDictionary_(errorDictionary) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5373 { |
3414 | 5374 assert(reader_ != NULL); |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5375 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5376 |
3414 | 5377 virtual ~HttpServerChunkedReader() |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5378 { |
3414 | 5379 assert(reader_ != NULL); |
5380 parameters_.finalize(reader_); | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5381 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5382 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5383 virtual void AddBodyChunk(const void* data, |
4204 | 5384 size_t size) ORTHANC_OVERRIDE |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5385 { |
3414 | 5386 if (static_cast<uint32_t>(size) != size) |
5387 { | |
5388 throw OrthancException(ErrorCode_NotEnoughMemory, ERROR_MESSAGE_64BIT); | |
5389 } | |
5390 | |
5391 assert(reader_ != NULL); | |
5392 parameters_.addChunk(reader_, data, size); | |
5393 } | |
4204 | 5394 |
5395 virtual void Execute(HttpOutput& output) ORTHANC_OVERRIDE | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5396 { |
3414 | 5397 assert(reader_ != NULL); |
3399
4e8205871967
OrthancPluginRegisterMultipartRestCallback() is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3397
diff
changeset
|
5398 |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5399 PImpl::PluginHttpOutput pluginOutput(output); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5400 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5401 OrthancPluginErrorCode error = parameters_.execute( |
3414 | 5402 reader_, reinterpret_cast<OrthancPluginRestOutput*>(&pluginOutput)); |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5403 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5404 pluginOutput.Close(error, errorDictionary_); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5405 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5406 }; |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5407 |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5408 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
5409 bool OrthancPlugins::CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target, |
3414 | 5410 RequestOrigin origin, |
5411 const char* remoteIp, | |
5412 const char* username, | |
5413 HttpMethod method, | |
5414 const UriComponents& uri, | |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4329
diff
changeset
|
5415 const HttpToolbox::Arguments& headers) |
3395
0ce9b4f5fdf5
new abstraction: IHttpHandler::CreateStreamHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
5416 { |
3414 | 5417 if (method != HttpMethod_Post && |
5418 method != HttpMethod_Put) | |
5419 { | |
5420 throw OrthancException(ErrorCode_InternalError); | |
5421 } | |
5422 | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5423 RestCallbackMatcher matcher(uri); |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5424 |
3414 | 5425 PImpl::ChunkedRestCallback* callback = NULL; |
5426 | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5427 // Loop over the callbacks registered by the plugins |
4459
16392fe89ce0
new mutex to protect registration of REST callbacks: restCallbackRegistrationMutex_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4441
diff
changeset
|
5428 boost::shared_lock<boost::shared_mutex> lock(pimpl_->restCallbackRegistrationMutex_); |
3414 | 5429 for (PImpl::ChunkedRestCallbacks::const_iterator it = pimpl_->chunkedRestCallbacks_.begin(); |
5430 it != pimpl_->chunkedRestCallbacks_.end(); ++it) | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5431 { |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5432 if (matcher.IsMatch((*it)->GetRegularExpression())) |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5433 { |
3414 | 5434 callback = *it; |
5435 break; | |
3396
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5436 } |
4981405e6c5c
new sdk: OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3395
diff
changeset
|
5437 } |
3395
0ce9b4f5fdf5
new abstraction: IHttpHandler::CreateStreamHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
5438 |
3414 | 5439 if (callback == NULL) |
5440 { | |
5441 // Callback not found | |
5442 return false; | |
5443 } | |
5444 else | |
5445 { | |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5446 OrthancPluginServerChunkedRequestReaderFactory handler; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5447 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5448 switch (method) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5449 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5450 case HttpMethod_Post: |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5451 handler = callback->GetParameters().postHandler; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5452 break; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5453 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5454 case HttpMethod_Put: |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5455 handler = callback->GetParameters().putHandler; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5456 break; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5457 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5458 default: |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5459 handler = NULL; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5460 break; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5461 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5462 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5463 if (handler == NULL) |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5464 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5465 return false; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5466 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5467 else |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5468 { |
4271
1bd14c900699
LogCategory_PLUGINS
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4268
diff
changeset
|
5469 CLOG(INFO, PLUGINS) << "Delegating chunked HTTP request to plugin for URI: " << matcher.GetFlatUri(); |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5470 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5471 HttpRequestConverter converter(matcher, method, headers); |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5472 converter.GetRequest().body = NULL; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5473 converter.GetRequest().bodySize = 0; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5474 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5475 OrthancPluginServerChunkedRequestReader* reader = NULL; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5476 |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5477 OrthancPluginErrorCode errorCode = handler( |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5478 &reader, matcher.GetFlatUri().c_str(), &converter.GetRequest()); |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5479 |
4086
4cd94ed75a5b
Issue #182: Better handling of errors in plugins reading chunked HTTP body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3980
diff
changeset
|
5480 if (errorCode != OrthancPluginErrorCode_Success) |
4cd94ed75a5b
Issue #182: Better handling of errors in plugins reading chunked HTTP body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3980
diff
changeset
|
5481 { |
4cd94ed75a5b
Issue #182: Better handling of errors in plugins reading chunked HTTP body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3980
diff
changeset
|
5482 throw OrthancException(static_cast<ErrorCode>(errorCode)); |
4cd94ed75a5b
Issue #182: Better handling of errors in plugins reading chunked HTTP body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3980
diff
changeset
|
5483 } |
4cd94ed75a5b
Issue #182: Better handling of errors in plugins reading chunked HTTP body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3980
diff
changeset
|
5484 else if (reader == NULL) |
3415
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5485 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5486 // The plugin has not created a reader for chunked body |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5487 return false; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5488 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5489 else |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5490 { |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5491 target.reset(new HttpServerChunkedReader(reader, callback->GetParameters(), GetErrorDictionary())); |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5492 return true; |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5493 } |
2a821deece64
refactoring to handle "not allowed" HTTP status 405
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3414
diff
changeset
|
5494 } |
3414 | 5495 } |
3395
0ce9b4f5fdf5
new abstraction: IHttpHandler::CreateStreamHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3393
diff
changeset
|
5496 } |
3662
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5497 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5498 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5499 IStorageCommitmentFactory::ILookupHandler* OrthancPlugins::CreateStorageCommitment( |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5500 const std::string& jobId, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5501 const std::string& transactionUid, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5502 const std::vector<std::string>& sopClassUids, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5503 const std::vector<std::string>& sopInstanceUids, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5504 const std::string& remoteAet, |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5505 const std::string& calledAet) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5506 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5507 boost::mutex::scoped_lock lock(pimpl_->storageCommitmentScpMutex_); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5508 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5509 for (PImpl::StorageCommitmentScpCallbacks::iterator |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5510 it = pimpl_->storageCommitmentScpCallbacks_.begin(); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5511 it != pimpl_->storageCommitmentScpCallbacks_.end(); ++it) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5512 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5513 assert(*it != NULL); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5514 IStorageCommitmentFactory::ILookupHandler* handler = (*it)->CreateStorageCommitment |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5515 (jobId, transactionUid, sopClassUids, sopInstanceUids, remoteAet, calledAet); |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5516 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5517 if (handler != NULL) |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5518 { |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5519 return handler; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5520 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5521 } |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5522 |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5523 return NULL; |
d8371b4302ff
OrthancPluginRegisterStorageCommitmentScpCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
5524 } |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3847
diff
changeset
|
5525 |
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3847
diff
changeset
|
5526 |
3944
aae045f802f4
preparing simplified interface for IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3931
diff
changeset
|
5527 bool OrthancPlugins::TranscodeBuffer(std::string& target, |
aae045f802f4
preparing simplified interface for IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3931
diff
changeset
|
5528 const void* buffer, |
aae045f802f4
preparing simplified interface for IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3931
diff
changeset
|
5529 size_t size, |
aae045f802f4
preparing simplified interface for IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3931
diff
changeset
|
5530 const std::set<DicomTransferSyntax>& allowedSyntaxes, |
aae045f802f4
preparing simplified interface for IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3931
diff
changeset
|
5531 bool allowNewSopInstanceUid) |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3847
diff
changeset
|
5532 { |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5533 boost::shared_lock<boost::shared_mutex> lock(pimpl_->decoderTranscoderMutex_); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5534 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5535 if (pimpl_->transcoderCallbacks_.empty()) |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5536 { |
3964 | 5537 return false; |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5538 } |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5539 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5540 std::vector<const char*> uids; |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5541 uids.reserve(allowedSyntaxes.size()); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5542 for (std::set<DicomTransferSyntax>::const_iterator |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5543 it = allowedSyntaxes.begin(); it != allowedSyntaxes.end(); ++it) |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5544 { |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5545 uids.push_back(GetTransferSyntaxUid(*it)); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5546 } |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5547 |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5548 for (PImpl::TranscoderCallbacks::const_iterator |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5549 transcoder = pimpl_->transcoderCallbacks_.begin(); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5550 transcoder != pimpl_->transcoderCallbacks_.end(); ++transcoder) |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5551 { |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5552 MemoryBufferRaii a; |
3951
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3946
diff
changeset
|
5553 |
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3946
diff
changeset
|
5554 if ((*transcoder) (a.GetObject(), buffer, size, uids.empty() ? NULL : &uids[0], |
3930
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5555 static_cast<uint32_t>(uids.size()), allowNewSopInstanceUid) == |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5556 OrthancPluginErrorCode_Success) |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5557 { |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5558 a.ToString(target); |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5559 return true; |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5560 } |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5561 } |
b99acc213937
transcoder plugins and GDCM transcoding are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3929
diff
changeset
|
5562 |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3847
diff
changeset
|
5563 return false; |
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3847
diff
changeset
|
5564 } |
4343
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
5565 |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
5566 |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
5567 bool OrthancPlugins::IsValidAuthorizationToken(const std::string& token) const |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
5568 { |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
5569 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
5570 return (pimpl_->authorizationTokens_.find(token) != pimpl_->authorizationTokens_.end()); |
e1e918e790e8
New function in the SDK: OrthancPluginGenerateRestApiAuthorizationToken()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
5571 } |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5572 } |