comparison OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h @ 575:6f01dd71b601 laaw

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Sep 2013 13:50:49 +0200
parents OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h@8fb9867d8089
children a0001c222b32
comparison
equal deleted inserted replaced
574:11b1eec09336 575:6f01dd71b601
1 /**
2 * Laaw - Lightweight, Automated API Wrapper
3 * Copyright (C) 2010-2013 Jomago - Alain Mazy, Benjamin Golinvaux,
4 * Sebastien Jodogne
5 *
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * In addition, as a special exception, the copyright holders of this
12 * program give permission to link the code of its release with the
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
14 * that use the same license as the "OpenSSL" library), and distribute
15 * the linked executables. You must obey the GNU General Public License
16 * in all respects for all of the code used other than "OpenSSL". If you
17 * modify file(s) with this exception, you may extend this exception to
18 * your version of the file(s), but you are not obligated to do so. If
19 * you do not wish to do so, delete this exception statement from your
20 * version. If you delete this exception statement from all source files
21 * in the program, then also delete it here.
22 *
23 * This program is distributed in the hope that it will be useful, but
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 **/
31
32
33 /**
34 * @file
35 **/
36
37 #pragma once
38
39 #include <stdexcept>
40 #include <memory>
41 #include <string>
42 #include <string.h>
43
44 #if defined(_WIN32)
45
46 /********************************************************************
47 ** This is the Windows-specific section
48 ********************************************************************/
49
50 #include <windows.h>
51
52 /* cf. http://sourceforge.net/p/predef/wiki/Architectures/ */
53 #ifdef _M_X64
54 /* 64 bits target */
55 #define LAAW_ORTHANC_CLIENT_CALL_CONV __fastcall
56 #define LAAW_ORTHANC_CLIENT_CALL_DECORATION(Name, StdCallSuffix) Name
57 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "OrthancClient_Windows64.dll"
58 #else
59 /* 32 bits target */
60 #define LAAW_ORTHANC_CLIENT_CALL_CONV __stdcall
61 #define LAAW_ORTHANC_CLIENT_CALL_DECORATION(Name, StdCallSuffix) "_" Name "@" StdCallSuffix
62 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "OrthancClient_Windows32.dll"
63 #endif
64
65 #define LAAW_ORTHANC_CLIENT_HANDLE_TYPE HINSTANCE
66 #define LAAW_ORTHANC_CLIENT_HANDLE_NULL 0
67 #define LAAW_ORTHANC_CLIENT_FUNCTION_TYPE FARPROC
68 #define LAAW_ORTHANC_CLIENT_LOADER(path) LoadLibraryA(path)
69 #define LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle, name, decoration) GetProcAddress(handle, LAAW_ORTHANC_CLIENT_CALL_DECORATION(name, decoration))
70 #define LAAW_ORTHANC_CLIENT_CLOSER(handle) FreeLibrary(handle)
71
72
73 /********************************************************************
74 ** This is the Linux-specific section
75 ********************************************************************/
76
77 #elif defined (__linux)
78
79 #include <stdlib.h>
80 #include <dlfcn.h>
81
82 /* cf. http://sourceforge.net/p/predef/wiki/Architectures/ */
83 #ifdef __amd64__
84 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient.so.0.6"
85 #else
86 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient.so.0.6"
87 #endif
88
89 #define LAAW_ORTHANC_CLIENT_CALL_CONV
90 #define LAAW_ORTHANC_CLIENT_HANDLE_TYPE void*
91 #define LAAW_ORTHANC_CLIENT_HANDLE_NULL NULL
92 #define LAAW_ORTHANC_CLIENT_FUNCTION_TYPE intptr_t
93 #define LAAW_ORTHANC_CLIENT_LOADER(path) dlopen(path, RTLD_LAZY)
94 #define LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle, name, decoration) (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) dlsym(handle, name)
95 #define LAAW_ORTHANC_CLIENT_CLOSER(handle) dlclose(handle)
96
97
98 #else
99 #error Please support your platform here
100 #endif
101
102
103 /********************************************************************
104 ** Definition of the integer types
105 ********************************************************************/
106
107 #ifndef LAAW_INT8 // Only define the integer types once
108
109 #if defined(__GNUC__)
110
111 // Under GCC (including MinGW), the stdint.h standard header is used.
112
113 #include <stdint.h>
114
115 #define LAAW_INT8 int8_t
116 #define LAAW_UINT8 uint8_t
117 #define LAAW_INT16 int16_t
118 #define LAAW_UINT16 uint16_t
119 #define LAAW_INT32 int32_t
120 #define LAAW_UINT32 uint32_t
121 #define LAAW_INT64 int64_t
122 #define LAAW_UINT64 uint64_t
123
124 #elif defined(_MSC_VER)
125
126 // Under Visual Studio, it is required to define the various integer
127 // types by hand.
128
129 #if (_MSC_VER < 1300)
130 typedef signed char LAAW_INT8;
131 typedef signed short LAAW_INT16;
132 typedef signed int LAAW_INT32;
133 typedef unsigned char LAAW_UINT8;
134 typedef unsigned short LAAW_UINT16;
135 typedef unsigned int LAAW_UINT32;
136 #else
137 typedef signed __int8 LAAW_INT8;
138 typedef signed __int16 LAAW_INT16;
139 typedef signed __int32 LAAW_INT32;
140 typedef unsigned __int8 LAAW_UINT8;
141 typedef unsigned __int16 LAAW_UINT16;
142 typedef unsigned __int32 LAAW_UINT32;
143 #endif
144
145 typedef signed __int64 LAAW_INT64;
146 typedef unsigned __int64 LAAW_UINT64;
147
148 #else
149 #error "Please support your compiler here"
150 #endif
151
152 #endif
153
154
155
156
157
158 /********************************************************************
159 ** This is a shared section between Windows and Linux
160 ********************************************************************/
161
162 namespace OrthancClient {
163 /**
164 * @brief Exception class that is thrown by the functions of this shared library.
165 **/
166 class OrthancClientException : public std::exception
167 {
168 private:
169 std::string message_;
170
171 public:
172 /**
173 * @brief Constructs an exception.
174 * @param message The error message.
175 **/
176 OrthancClientException(std::string message) : message_(message)
177 {
178 }
179
180 ~OrthancClientException() throw()
181 {
182 }
183
184 /**
185 * @brief Get the error message associated with this exception.
186 * @returns The error message.
187 **/
188 const std::string& What() const throw()
189 {
190 return message_;
191 }
192 };
193 }
194
195
196 namespace OrthancClient { namespace Internals {
197 /**
198 * This internal class implements a Singleton design pattern that will
199 * store a reference to the shared library handle, together with a
200 * pointer to each function in the shared library.
201 **/
202 class Library
203 {
204 private:
205 LAAW_ORTHANC_CLIENT_HANDLE_TYPE handle_;
206 LAAW_ORTHANC_CLIENT_FUNCTION_TYPE functionsIndex_[60 + 1];
207
208
209
210 void Load(const char* sharedLibraryPath)
211 {
212
213 if (handle_ != LAAW_ORTHANC_CLIENT_HANDLE_NULL)
214 {
215 // Do nothing if the library is already loaded
216 return;
217 }
218
219 /* Setup the path to the default shared library if not provided */
220 if (sharedLibraryPath == NULL)
221 {
222 sharedLibraryPath = LAAW_ORTHANC_CLIENT_DEFAULT_PATH;
223 }
224
225 /* Load the shared library */
226 handle_ = LAAW_ORTHANC_CLIENT_LOADER(sharedLibraryPath);
227
228
229 if (handle_ == LAAW_ORTHANC_CLIENT_HANDLE_NULL)
230 {
231 throw ::OrthancClient::OrthancClientException("Error loading shared library");
232 }
233
234 LoadFunctions();
235 }
236
237 inline void LoadFunctions();
238
239 void FreeString(char* str)
240 {
241 typedef void (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (char*);
242 Function function = (Function) GetFunction(60);
243 function(str);
244 }
245
246 Library()
247 {
248 handle_ = LAAW_ORTHANC_CLIENT_HANDLE_NULL;
249 }
250
251 ~Library()
252 {
253 Finalize();
254 }
255
256 public:
257 LAAW_ORTHANC_CLIENT_FUNCTION_TYPE GetFunction(unsigned int index)
258 {
259 /**
260 * If the library has not been manually initialized by a call to
261 * ::OrthancClient::Initialize(), it is loaded from
262 * the default location (lazy initialization).
263 **/
264 if (handle_ == NULL)
265 {
266 Load(NULL);
267 }
268
269 return functionsIndex_[index];
270 }
271
272 void ThrowExceptionIfNeeded(char* message)
273 {
274 if (message != NULL)
275 {
276 std::string tmp(message);
277 FreeString(message);
278 throw ::OrthancClient::OrthancClientException(tmp);
279 }
280 }
281
282 static inline Library& GetInstance()
283 {
284 /**
285 * This function defines a "static variable" inside a "static
286 * inline method" of a class. This ensures that a single
287 * instance of this variable will be used across all the
288 * compilation modules of the software.
289 * http://stackoverflow.com/a/1389403/881731
290 **/
291
292 static Library singleton;
293 return singleton;
294 }
295
296 static void Initialize(const char* sharedLibraryPath)
297 {
298 GetInstance().Load(sharedLibraryPath);
299 }
300
301 void Finalize()
302 {
303 if (handle_ != LAAW_ORTHANC_CLIENT_HANDLE_NULL)
304 {
305 LAAW_ORTHANC_CLIENT_CLOSER(handle_);
306 handle_ = LAAW_ORTHANC_CLIENT_HANDLE_NULL;
307 }
308 }
309 };
310 }}
311
312
313
314
315 namespace OrthancClient {
316 /*!
317 * \addtogroup Initialization Initialization of the shared library.
318 * @{
319 */
320
321 /**
322 * @brief Manually initialize the shared library, using the default library name.
323 *
324 * Call this method before using the library to ensure correct
325 * behaviour in multi-threaded applications. This method is also
326 * useful to control the time at which the shared library is
327 * loaded (e.g. for real-time applications).
328 **/
329 inline void Initialize()
330 {
331 ::OrthancClient::Internals::Library::Initialize(NULL);
332 }
333
334 /**
335 * @brief Manually initialize the shared library.
336 *
337 * Call this method before using the library to ensure correct
338 * behaviour in multi-threaded applications. This method is also
339 * useful to control the time at which the shared library is
340 * loaded (e.g. for real-time applications).
341 *
342 * @param sharedLibraryPath The path to the shared library that
343 * contains the module.
344 **/
345 inline void Initialize(const std::string& sharedLibraryPath)
346 {
347 ::OrthancClient::Internals::Library::Initialize(sharedLibraryPath.c_str());
348 }
349
350 /**
351 * @brief Manually finalize the shared library.
352 *
353 * Calling explicitly this function is not mandatory. It is useful to
354 * force the release of the resources acquired by the shared library,
355 * or to manually control the order in which the global variables get
356 * deleted.
357 **/
358 inline void Finalize()
359 {
360 ::OrthancClient::Internals::Library::GetInstance().Finalize();
361 }
362
363
364 /**
365 * @}
366 */
367 }
368
369
370
371 void ::OrthancClient::Internals::Library::LoadFunctions()
372 {
373 typedef const char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) ();
374 Function getVersion = (Function) LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_GetVersion", "0");
375 if (getVersion == NULL)
376 {
377 throw ::OrthancClient::OrthancClientException("Unable to get the library version");
378 }
379
380 /**
381 * It is assumed that the API does not change when the revision
382 * number (MAJOR.MINOR.REVISION) changes.
383 **/
384 if (strcmp(getVersion(), "0.6"))
385 {
386 throw ::OrthancClient::OrthancClientException("Mismatch between the C++ header and the library version");
387 }
388
389 functionsIndex_[60] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_FreeString", "4");
390 functionsIndex_[3] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7", "8");
391 functionsIndex_[4] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e", "8");
392 functionsIndex_[5] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d7497fd24e4b453f2965bae9ef8330b0", "4");
393 functionsIndex_[6] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0", "8");
394 functionsIndex_[7] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050", "8");
395 functionsIndex_[8] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc", "12");
396 functionsIndex_[9] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7", "8");
397 functionsIndex_[10] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b", "8");
398 functionsIndex_[11] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421", "16");
399 functionsIndex_[0] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c", "8");
400 functionsIndex_[1] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b", "16");
401 functionsIndex_[2] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38", "4");
402 functionsIndex_[14] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f756172daf04516eec3a566adabb4335", "4");
403 functionsIndex_[15] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118", "8");
404 functionsIndex_[16] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63", "12");
405 functionsIndex_[17] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1", "8");
406 functionsIndex_[18] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701", "16");
407 functionsIndex_[12] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919", "12");
408 functionsIndex_[13] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1", "4");
409 functionsIndex_[21] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2", "4");
410 functionsIndex_[22] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3", "8");
411 functionsIndex_[23] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d", "8");
412 functionsIndex_[24] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db", "12");
413 functionsIndex_[25] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5", "8");
414 functionsIndex_[26] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca", "8");
415 functionsIndex_[27] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757", "8");
416 functionsIndex_[28] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5", "8");
417 functionsIndex_[29] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0", "8");
418 functionsIndex_[30] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab", "8");
419 functionsIndex_[31] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d", "8");
420 functionsIndex_[32] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64", "16");
421 functionsIndex_[33] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5", "28");
422 functionsIndex_[34] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c", "32");
423 functionsIndex_[19] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342", "12");
424 functionsIndex_[20] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0", "4");
425 functionsIndex_[37] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7", "4");
426 functionsIndex_[38] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321", "8");
427 functionsIndex_[39] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05", "12");
428 functionsIndex_[40] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7", "8");
429 functionsIndex_[41] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654", "16");
430 functionsIndex_[35] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678", "12");
431 functionsIndex_[36] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376", "4");
432 functionsIndex_[44] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb", "8");
433 functionsIndex_[45] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146", "8");
434 functionsIndex_[46] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda", "8");
435 functionsIndex_[47] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484", "12");
436 functionsIndex_[48] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb", "12");
437 functionsIndex_[49] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1729a067d902771517388eedd7346b23", "12");
438 functionsIndex_[50] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745", "8");
439 functionsIndex_[51] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0", "8");
440 functionsIndex_[52] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8", "8");
441 functionsIndex_[53] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c", "8");
442 functionsIndex_[54] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b", "8");
443 functionsIndex_[55] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef", "12");
444 functionsIndex_[56] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a", "4");
445 functionsIndex_[57] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c", "4");
446 functionsIndex_[58] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91", "8");
447 functionsIndex_[59] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e", "8");
448 functionsIndex_[42] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d", "12");
449 functionsIndex_[43] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207", "4");
450
451 /* Check whether the functions were properly loaded */
452 for (unsigned int i = 0; i <= 60; i++)
453 {
454 if (functionsIndex_[i] == (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) NULL)
455 {
456 throw ::OrthancClient::OrthancClientException("Unable to load the functions of the shared library");
457 }
458 }
459 }
460 namespace OrthancClient
461 {
462 class OrthancConnection;
463 }
464
465 namespace OrthancClient
466 {
467 class Patient;
468 }
469
470 namespace OrthancClient
471 {
472 class Series;
473 }
474
475 namespace OrthancClient
476 {
477 class Study;
478 }
479
480 namespace OrthancClient
481 {
482 class Instance;
483 }
484
485 namespace Orthanc
486 {
487 enum PixelFormat
488 {
489 PixelFormat_SignedGrayscale16 = 3,
490 PixelFormat_RGB24 = 0,
491 PixelFormat_Grayscale8 = 1,
492 PixelFormat_Grayscale16 = 2
493 };
494 }
495
496 namespace Orthanc
497 {
498 enum ImageExtractionMode
499 {
500 ImageExtractionMode_Int16 = 3,
501 ImageExtractionMode_Preview = 0,
502 ImageExtractionMode_UInt8 = 1,
503 ImageExtractionMode_UInt16 = 2
504 };
505 }
506
507 namespace OrthancClient
508 {
509 /**
510 * @brief Connection to an instance of %Orthanc.
511 *
512 * This class encapsulates a connection to an instance of %Orthanc through its REST API.
513 *
514 **/
515 class OrthancConnection
516 {
517 friend class ::OrthancClient::Patient;
518 friend class ::OrthancClient::Series;
519 friend class ::OrthancClient::Study;
520 friend class ::OrthancClient::Instance;
521 private:
522 bool isReference_;
523 void* pimpl_;
524 OrthancConnection(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
525 OrthancConnection(const OrthancConnection& other) { *this = other; }
526 void operator= (const OrthancConnection& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
527 public:
528 inline OrthancConnection(const ::std::string& orthancUrl);
529 inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password);
530 inline ~OrthancConnection();
531 inline LAAW_UINT32 GetThreadCount() const;
532 inline void SetThreadCount(LAAW_UINT32 threadCount);
533 inline void Refresh();
534 inline ::std::string GetOrthancUrl() const;
535 inline LAAW_UINT32 GetPatientCount();
536 inline ::OrthancClient::Patient GetPatient(LAAW_UINT32 index);
537 inline void DeletePatient(LAAW_UINT32 index);
538 inline void StoreFile(const ::std::string& filename);
539 inline void Store(const void* dicom, LAAW_UINT64 size);
540 };
541 }
542
543 namespace OrthancClient
544 {
545 class Patient
546 {
547 friend class ::OrthancClient::OrthancConnection;
548 friend class ::OrthancClient::Series;
549 friend class ::OrthancClient::Study;
550 friend class ::OrthancClient::Instance;
551 private:
552 bool isReference_;
553 void* pimpl_;
554 Patient(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
555 Patient(const Patient& other) { *this = other; }
556 void operator= (const Patient& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
557 public:
558 inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
559 inline ~Patient();
560 inline void Reload();
561 inline LAAW_UINT32 GetStudyCount();
562 inline ::OrthancClient::Study GetStudy(LAAW_UINT32 index);
563 inline ::std::string GetId() const;
564 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
565 };
566 }
567
568 namespace OrthancClient
569 {
570 class Series
571 {
572 friend class ::OrthancClient::OrthancConnection;
573 friend class ::OrthancClient::Patient;
574 friend class ::OrthancClient::Study;
575 friend class ::OrthancClient::Instance;
576 private:
577 bool isReference_;
578 void* pimpl_;
579 Series(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
580 Series(const Series& other) { *this = other; }
581 void operator= (const Series& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
582 public:
583 inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
584 inline ~Series();
585 inline void Reload();
586 inline bool Is3DImage();
587 inline LAAW_UINT32 GetInstanceCount();
588 inline ::OrthancClient::Instance GetInstance(LAAW_UINT32 index);
589 inline ::std::string GetId() const;
590 inline ::std::string GetUrl() const;
591 inline LAAW_UINT32 GetWidth();
592 inline LAAW_UINT32 GetHeight();
593 inline float GetVoxelSizeX();
594 inline float GetVoxelSizeY();
595 inline float GetVoxelSizeZ();
596 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
597 inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride);
598 inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[]);
599 };
600 }
601
602 namespace OrthancClient
603 {
604 class Study
605 {
606 friend class ::OrthancClient::OrthancConnection;
607 friend class ::OrthancClient::Patient;
608 friend class ::OrthancClient::Series;
609 friend class ::OrthancClient::Instance;
610 private:
611 bool isReference_;
612 void* pimpl_;
613 Study(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
614 Study(const Study& other) { *this = other; }
615 void operator= (const Study& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
616 public:
617 inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
618 inline ~Study();
619 inline void Reload();
620 inline LAAW_UINT32 GetSeriesCount();
621 inline ::OrthancClient::Series GetSeries(LAAW_UINT32 index);
622 inline ::std::string GetId() const;
623 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
624 };
625 }
626
627 namespace OrthancClient
628 {
629 class Instance
630 {
631 friend class ::OrthancClient::OrthancConnection;
632 friend class ::OrthancClient::Patient;
633 friend class ::OrthancClient::Series;
634 friend class ::OrthancClient::Study;
635 private:
636 bool isReference_;
637 void* pimpl_;
638 Instance(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
639 Instance(const Instance& other) { *this = other; }
640 void operator= (const Instance& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
641 public:
642 inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
643 inline ~Instance();
644 inline ::std::string GetId() const;
645 inline void SetImageExtractionMode(::Orthanc::ImageExtractionMode mode);
646 inline ::Orthanc::ImageExtractionMode GetImageExtractionMode() const;
647 inline ::std::string GetTagAsString(const ::std::string& tag) const;
648 inline float GetTagAsFloat(const ::std::string& tag) const;
649 inline LAAW_INT32 GetTagAsInt(const ::std::string& tag) const;
650 inline LAAW_UINT32 GetWidth();
651 inline LAAW_UINT32 GetHeight();
652 inline LAAW_UINT32 GetPitch();
653 inline ::Orthanc::PixelFormat GetPixelFormat();
654 inline const void* GetBuffer();
655 inline const void* GetBuffer(LAAW_UINT32 y);
656 inline void DiscardImage();
657 inline void DiscardDicom();
658 inline LAAW_UINT64 GetDicomSize();
659 inline const void* GetDicom();
660 };
661 }
662
663 namespace OrthancClient
664 {
665 /**
666 * @brief Create a connection to an instance of %Orthanc.
667 *
668 * Create a connection to an instance of %Orthanc.
669 *
670 * @param orthancUrl URL to which the REST API of %Orthanc is listening.
671 **/
672 inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl)
673 {
674 isReference_ = false;
675 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*);
676 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(0);
677 char* error = function(&pimpl_, orthancUrl.c_str());
678 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
679 }
680 /**
681 * @brief Create a connection to an instance of %Orthanc, with authentication.
682 *
683 * Create a connection to an instance of %Orthanc, with authentication.
684 *
685 * @param orthancUrl URL to which the REST API of %Orthanc is listening.
686 * @param username The username.
687 * @param password The password.
688 **/
689 inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password)
690 {
691 isReference_ = false;
692 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*, const char*, const char*);
693 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(1);
694 char* error = function(&pimpl_, orthancUrl.c_str(), username.c_str(), password.c_str());
695 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
696 }
697 /**
698 * @brief Destructs the object.
699 *
700 * Destructs the object.
701 *
702 **/
703 inline OrthancConnection::~OrthancConnection()
704 {
705 if (isReference_) return;
706 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
707 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(2);
708 char* error = function(pimpl_);
709 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
710 }
711 /**
712 * @brief Returns the number of threads for this connection.
713 *
714 * Returns the number of simultaneous connections that are used when downloading information from this instance of %Orthanc.
715 *
716 * @return The number of threads.
717 **/
718 inline LAAW_UINT32 OrthancConnection::GetThreadCount() const
719 {
720 LAAW_UINT32 result_;
721 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_UINT32*);
722 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(3);
723 char* error = function(pimpl_, &result_);
724 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
725 return result_;
726 }
727 /**
728 * @brief Sets the number of threads for this connection.
729 *
730 * Sets the number of simultaneous connections that are used when downloading information from this instance of %Orthanc.
731 *
732 * @param threadCount The number of threads.
733 **/
734 inline void OrthancConnection::SetThreadCount(LAAW_UINT32 threadCount)
735 {
736 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
737 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(4);
738 char* error = function(pimpl_, threadCount);
739 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
740 }
741 /**
742 * @brief Refresh the list of the patients.
743 *
744 * This method will reload the list of the patients from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
745 *
746 **/
747 inline void OrthancConnection::Refresh()
748 {
749 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
750 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(5);
751 char* error = function(pimpl_);
752 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
753 }
754 /**
755 * @brief Returns the URL of this instance of %Orthanc.
756 *
757 * Returns the URL of the remote %Orthanc instance to which this object is connected.
758 *
759 * @return The URL.
760 **/
761 inline ::std::string OrthancConnection::GetOrthancUrl() const
762 {
763 const char* result_;
764 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
765 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(6);
766 char* error = function(pimpl_, &result_);
767 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
768 return std::string(result_);
769 }
770 /**
771 * @brief Returns the number of patients.
772 *
773 * Returns the number of patients that are stored in the remote instance of %Orthanc.
774 *
775 * @return The number of patients.
776 **/
777 inline LAAW_UINT32 OrthancConnection::GetPatientCount()
778 {
779 LAAW_UINT32 result_;
780 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
781 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(7);
782 char* error = function(pimpl_, &result_);
783 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
784 return result_;
785 }
786 /**
787 * @brief Get some patient.
788 *
789 * This method will return an object that contains information about some patient. The patients are indexed by a number between 0 (inclusive) and the result of GetPatientCount() (exclusive).
790 *
791 * @param index The index of the patient of interest.
792 * @return The patient.
793 **/
794 inline ::OrthancClient::Patient OrthancConnection::GetPatient(LAAW_UINT32 index)
795 {
796 void* result_;
797 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
798 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(8);
799 char* error = function(pimpl_, &result_, index);
800 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
801 return ::OrthancClient::Patient(result_);
802 }
803 /**
804 * @brief Delete some patient.
805 *
806 * Delete some patient from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
807 *
808 * @param index The index of the patient of interest.
809 * @return The patient.
810 **/
811 inline void OrthancConnection::DeletePatient(LAAW_UINT32 index)
812 {
813 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
814 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(9);
815 char* error = function(pimpl_, index);
816 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
817 }
818 /**
819 * @brief Send a DICOM file.
820 *
821 * This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
822 *
823 * @param filename Path to the DICOM file
824 **/
825 inline void OrthancConnection::StoreFile(const ::std::string& filename)
826 {
827 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const char*);
828 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(10);
829 char* error = function(pimpl_, filename.c_str());
830 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
831 }
832 /**
833 * @brief Send a DICOM file that is contained inside a memory buffer.
834 *
835 * This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.
836 *
837 * @param dicom The memory buffer containing the DICOM file.
838 * @param size The size of the DICOM file.
839 **/
840 inline void OrthancConnection::Store(const void* dicom, LAAW_UINT64 size)
841 {
842 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void*, LAAW_UINT64);
843 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(11);
844 char* error = function(pimpl_, dicom, size);
845 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
846 }
847 }
848
849 namespace OrthancClient
850 {
851 inline Patient::Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
852 {
853 isReference_ = false;
854 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
855 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(12);
856 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
857 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
858 }
859 /**
860 * @brief Destructs the object.
861 *
862 * Destructs the object.
863 *
864 **/
865 inline Patient::~Patient()
866 {
867 if (isReference_) return;
868 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
869 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(13);
870 char* error = function(pimpl_);
871 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
872 }
873 inline void Patient::Reload()
874 {
875 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
876 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(14);
877 char* error = function(pimpl_);
878 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
879 }
880 inline LAAW_UINT32 Patient::GetStudyCount()
881 {
882 LAAW_UINT32 result_;
883 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
884 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(15);
885 char* error = function(pimpl_, &result_);
886 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
887 return result_;
888 }
889 inline ::OrthancClient::Study Patient::GetStudy(LAAW_UINT32 index)
890 {
891 void* result_;
892 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
893 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(16);
894 char* error = function(pimpl_, &result_, index);
895 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
896 return ::OrthancClient::Study(result_);
897 }
898 inline ::std::string Patient::GetId() const
899 {
900 const char* result_;
901 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
902 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(17);
903 char* error = function(pimpl_, &result_);
904 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
905 return std::string(result_);
906 }
907 inline ::std::string Patient::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
908 {
909 const char* result_;
910 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
911 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(18);
912 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
913 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
914 return std::string(result_);
915 }
916 }
917
918 namespace OrthancClient
919 {
920 inline Series::Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
921 {
922 isReference_ = false;
923 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
924 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(19);
925 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
926 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
927 }
928 /**
929 * @brief Destructs the object.
930 *
931 * Destructs the object.
932 *
933 **/
934 inline Series::~Series()
935 {
936 if (isReference_) return;
937 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
938 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(20);
939 char* error = function(pimpl_);
940 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
941 }
942 inline void Series::Reload()
943 {
944 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
945 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(21);
946 char* error = function(pimpl_);
947 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
948 }
949 inline bool Series::Is3DImage()
950 {
951 LAAW_INT32 result_;
952 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
953 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(22);
954 char* error = function(pimpl_, &result_);
955 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
956 return result_ != 0;
957 }
958 inline LAAW_UINT32 Series::GetInstanceCount()
959 {
960 LAAW_UINT32 result_;
961 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
962 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(23);
963 char* error = function(pimpl_, &result_);
964 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
965 return result_;
966 }
967 inline ::OrthancClient::Instance Series::GetInstance(LAAW_UINT32 index)
968 {
969 void* result_;
970 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
971 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(24);
972 char* error = function(pimpl_, &result_, index);
973 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
974 return ::OrthancClient::Instance(result_);
975 }
976 inline ::std::string Series::GetId() const
977 {
978 const char* result_;
979 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
980 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(25);
981 char* error = function(pimpl_, &result_);
982 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
983 return std::string(result_);
984 }
985 inline ::std::string Series::GetUrl() const
986 {
987 const char* result_;
988 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
989 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(26);
990 char* error = function(pimpl_, &result_);
991 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
992 return std::string(result_);
993 }
994 inline LAAW_UINT32 Series::GetWidth()
995 {
996 LAAW_UINT32 result_;
997 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
998 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(27);
999 char* error = function(pimpl_, &result_);
1000 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1001 return result_;
1002 }
1003 inline LAAW_UINT32 Series::GetHeight()
1004 {
1005 LAAW_UINT32 result_;
1006 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1007 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(28);
1008 char* error = function(pimpl_, &result_);
1009 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1010 return result_;
1011 }
1012 inline float Series::GetVoxelSizeX()
1013 {
1014 float result_;
1015 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1016 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(29);
1017 char* error = function(pimpl_, &result_);
1018 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1019 return result_;
1020 }
1021 inline float Series::GetVoxelSizeY()
1022 {
1023 float result_;
1024 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1025 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(30);
1026 char* error = function(pimpl_, &result_);
1027 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1028 return result_;
1029 }
1030 inline float Series::GetVoxelSizeZ()
1031 {
1032 float result_;
1033 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
1034 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(31);
1035 char* error = function(pimpl_, &result_);
1036 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1037 return result_;
1038 }
1039 inline ::std::string Series::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1040 {
1041 const char* result_;
1042 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1043 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(32);
1044 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1045 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1046 return std::string(result_);
1047 }
1048 inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride)
1049 {
1050 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64);
1051 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(33);
1052 char* error = function(pimpl_, target, format, lineStride, stackStride);
1053 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1054 }
1055 inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[])
1056 {
1057 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64, float*);
1058 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(34);
1059 char* error = function(pimpl_, target, format, lineStride, stackStride, progress);
1060 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1061 }
1062 }
1063
1064 namespace OrthancClient
1065 {
1066 inline Study::Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1067 {
1068 isReference_ = false;
1069 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1070 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(35);
1071 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1072 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1073 }
1074 /**
1075 * @brief Destructs the object.
1076 *
1077 * Destructs the object.
1078 *
1079 **/
1080 inline Study::~Study()
1081 {
1082 if (isReference_) return;
1083 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1084 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(36);
1085 char* error = function(pimpl_);
1086 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1087 }
1088 inline void Study::Reload()
1089 {
1090 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1091 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(37);
1092 char* error = function(pimpl_);
1093 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1094 }
1095 inline LAAW_UINT32 Study::GetSeriesCount()
1096 {
1097 LAAW_UINT32 result_;
1098 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1099 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(38);
1100 char* error = function(pimpl_, &result_);
1101 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1102 return result_;
1103 }
1104 inline ::OrthancClient::Series Study::GetSeries(LAAW_UINT32 index)
1105 {
1106 void* result_;
1107 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
1108 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(39);
1109 char* error = function(pimpl_, &result_, index);
1110 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1111 return ::OrthancClient::Series(result_);
1112 }
1113 inline ::std::string Study::GetId() const
1114 {
1115 const char* result_;
1116 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1117 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(40);
1118 char* error = function(pimpl_, &result_);
1119 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1120 return std::string(result_);
1121 }
1122 inline ::std::string Study::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1123 {
1124 const char* result_;
1125 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1126 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(41);
1127 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1128 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1129 return std::string(result_);
1130 }
1131 }
1132
1133 namespace OrthancClient
1134 {
1135 inline Instance::Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1136 {
1137 isReference_ = false;
1138 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1139 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(42);
1140 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1141 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1142 }
1143 /**
1144 * @brief Destructs the object.
1145 *
1146 * Destructs the object.
1147 *
1148 **/
1149 inline Instance::~Instance()
1150 {
1151 if (isReference_) return;
1152 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1153 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(43);
1154 char* error = function(pimpl_);
1155 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1156 }
1157 inline ::std::string Instance::GetId() const
1158 {
1159 const char* result_;
1160 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1161 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(44);
1162 char* error = function(pimpl_, &result_);
1163 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1164 return std::string(result_);
1165 }
1166 inline void Instance::SetImageExtractionMode(::Orthanc::ImageExtractionMode mode)
1167 {
1168 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32);
1169 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(45);
1170 char* error = function(pimpl_, mode);
1171 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1172 }
1173 inline ::Orthanc::ImageExtractionMode Instance::GetImageExtractionMode() const
1174 {
1175 LAAW_INT32 result_;
1176 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*);
1177 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(46);
1178 char* error = function(pimpl_, &result_);
1179 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1180 return static_cast< ::Orthanc::ImageExtractionMode >(result_);
1181 }
1182 inline ::std::string Instance::GetTagAsString(const ::std::string& tag) const
1183 {
1184 const char* result_;
1185 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*);
1186 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(47);
1187 char* error = function(pimpl_, &result_, tag.c_str());
1188 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1189 return std::string(result_);
1190 }
1191 inline float Instance::GetTagAsFloat(const ::std::string& tag) const
1192 {
1193 float result_;
1194 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, float*, const char*);
1195 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(48);
1196 char* error = function(pimpl_, &result_, tag.c_str());
1197 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1198 return result_;
1199 }
1200 inline LAAW_INT32 Instance::GetTagAsInt(const ::std::string& tag) const
1201 {
1202 LAAW_INT32 result_;
1203 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*, const char*);
1204 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(49);
1205 char* error = function(pimpl_, &result_, tag.c_str());
1206 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1207 return result_;
1208 }
1209 inline LAAW_UINT32 Instance::GetWidth()
1210 {
1211 LAAW_UINT32 result_;
1212 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1213 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(50);
1214 char* error = function(pimpl_, &result_);
1215 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1216 return result_;
1217 }
1218 inline LAAW_UINT32 Instance::GetHeight()
1219 {
1220 LAAW_UINT32 result_;
1221 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1222 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(51);
1223 char* error = function(pimpl_, &result_);
1224 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1225 return result_;
1226 }
1227 inline LAAW_UINT32 Instance::GetPitch()
1228 {
1229 LAAW_UINT32 result_;
1230 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1231 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(52);
1232 char* error = function(pimpl_, &result_);
1233 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1234 return result_;
1235 }
1236 inline ::Orthanc::PixelFormat Instance::GetPixelFormat()
1237 {
1238 LAAW_INT32 result_;
1239 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
1240 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(53);
1241 char* error = function(pimpl_, &result_);
1242 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1243 return static_cast< ::Orthanc::PixelFormat >(result_);
1244 }
1245 inline const void* Instance::GetBuffer()
1246 {
1247 const void* result_;
1248 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1249 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(54);
1250 char* error = function(pimpl_, &result_);
1251 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1252 return reinterpret_cast< const void* >(result_);
1253 }
1254 inline const void* Instance::GetBuffer(LAAW_UINT32 y)
1255 {
1256 const void* result_;
1257 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**, LAAW_UINT32);
1258 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(55);
1259 char* error = function(pimpl_, &result_, y);
1260 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1261 return reinterpret_cast< const void* >(result_);
1262 }
1263 inline void Instance::DiscardImage()
1264 {
1265 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1266 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(56);
1267 char* error = function(pimpl_);
1268 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1269 }
1270 inline void Instance::DiscardDicom()
1271 {
1272 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1273 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(57);
1274 char* error = function(pimpl_);
1275 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1276 }
1277 inline LAAW_UINT64 Instance::GetDicomSize()
1278 {
1279 LAAW_UINT64 result_;
1280 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT64*);
1281 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(58);
1282 char* error = function(pimpl_, &result_);
1283 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1284 return result_;
1285 }
1286 inline const void* Instance::GetDicom()
1287 {
1288 const void* result_;
1289 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1290 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(59);
1291 char* error = function(pimpl_, &result_);
1292 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1293 return reinterpret_cast< const void* >(result_);
1294 }
1295 }
1296