comparison OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h @ 540:eaca3d38b2aa laaw

many fixes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Sep 2013 12:55:07 +0200
parents
children ffedcc8f0938
comparison
equal deleted inserted replaced
537:2890721b0f57 540:eaca3d38b2aa
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_Linux64.so.1.0"
85 #else
86 #define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient_Linux32.so.1.0"
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_[59 + 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(59);
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(), "1.0"))
385 {
386 throw ::OrthancClient::OrthancClientException("Mismatch between the C++ header and the library version");
387 }
388
389 functionsIndex_[59] = 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_[19] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342", "12");
423 functionsIndex_[20] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0", "4");
424 functionsIndex_[36] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7", "4");
425 functionsIndex_[37] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321", "8");
426 functionsIndex_[38] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05", "12");
427 functionsIndex_[39] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7", "8");
428 functionsIndex_[40] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654", "16");
429 functionsIndex_[34] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678", "12");
430 functionsIndex_[35] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376", "4");
431 functionsIndex_[43] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb", "8");
432 functionsIndex_[44] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146", "8");
433 functionsIndex_[45] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda", "8");
434 functionsIndex_[46] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484", "12");
435 functionsIndex_[47] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb", "12");
436 functionsIndex_[48] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1729a067d902771517388eedd7346b23", "12");
437 functionsIndex_[49] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745", "8");
438 functionsIndex_[50] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0", "8");
439 functionsIndex_[51] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8", "8");
440 functionsIndex_[52] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c", "8");
441 functionsIndex_[53] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b", "8");
442 functionsIndex_[54] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef", "12");
443 functionsIndex_[55] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a", "4");
444 functionsIndex_[56] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c", "4");
445 functionsIndex_[57] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91", "8");
446 functionsIndex_[58] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e", "8");
447 functionsIndex_[41] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d", "12");
448 functionsIndex_[42] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207", "4");
449
450 /* Check whether the functions were properly loaded */
451 for (unsigned int i = 0; i <= 59; i++)
452 {
453 if (functionsIndex_[i] == (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) NULL)
454 {
455 throw ::OrthancClient::OrthancClientException("Unable to load the functions of the shared library");
456 }
457 }
458 }
459 namespace OrthancClient
460 {
461 class OrthancConnection;
462 }
463
464 namespace OrthancClient
465 {
466 class Patient;
467 }
468
469 namespace OrthancClient
470 {
471 class Series;
472 }
473
474 namespace OrthancClient
475 {
476 class Study;
477 }
478
479 namespace OrthancClient
480 {
481 class Instance;
482 }
483
484 namespace Orthanc
485 {
486 enum PixelFormat
487 {
488 PixelFormat_SignedGrayscale16 = 3,
489 PixelFormat_RGB24 = 0,
490 PixelFormat_Grayscale8 = 1,
491 PixelFormat_Grayscale16 = 2
492 };
493 }
494
495 namespace Orthanc
496 {
497 enum ImageExtractionMode
498 {
499 ImageExtractionMode_Int16 = 3,
500 ImageExtractionMode_Preview = 0,
501 ImageExtractionMode_UInt8 = 1,
502 ImageExtractionMode_UInt16 = 2
503 };
504 }
505
506 namespace OrthancClient
507 {
508 class OrthancConnection
509 {
510 private:
511 bool isReference_;
512 public:
513 void* pimpl_;
514 OrthancConnection(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
515 OrthancConnection(const OrthancConnection& other) { *this = other; }
516 void operator= (const OrthancConnection& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
517 inline OrthancConnection(const ::std::string& orthancUrl);
518 inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password);
519 inline ~OrthancConnection();
520 inline LAAW_UINT32 GetThreadCount() const;
521 inline void SetThreadCount(LAAW_UINT32 threadCount);
522 inline void Refresh();
523 inline ::std::string GetOrthancUrl() const;
524 inline LAAW_UINT32 GetPatientCount();
525 inline ::OrthancClient::Patient GetPatient(LAAW_UINT32 index);
526 inline void DeletePatient(LAAW_UINT32 index);
527 inline void StoreFile(const ::std::string& filename);
528 inline void Store(const void* dicom, LAAW_UINT64 size);
529 };
530 }
531
532 namespace OrthancClient
533 {
534 class Patient
535 {
536 private:
537 bool isReference_;
538 public:
539 void* pimpl_;
540 Patient(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
541 Patient(const Patient& other) { *this = other; }
542 void operator= (const Patient& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
543 inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
544 inline ~Patient();
545 inline void Reload();
546 inline LAAW_UINT32 GetStudyCount();
547 inline ::OrthancClient::Study GetStudy(LAAW_UINT32 index);
548 inline ::std::string GetId() const;
549 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
550 };
551 }
552
553 namespace OrthancClient
554 {
555 class Series
556 {
557 private:
558 bool isReference_;
559 public:
560 void* pimpl_;
561 Series(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
562 Series(const Series& other) { *this = other; }
563 void operator= (const Series& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
564 inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
565 inline ~Series();
566 inline void Reload();
567 inline bool Is3DImage();
568 inline LAAW_UINT32 GetInstanceCount();
569 inline ::OrthancClient::Instance GetInstance(LAAW_UINT32 index);
570 inline ::std::string GetId() const;
571 inline ::std::string GetUrl() const;
572 inline LAAW_UINT32 GetWidth();
573 inline LAAW_UINT32 GetHeight();
574 inline float GetVoxelSizeX();
575 inline float GetVoxelSizeY();
576 inline float GetVoxelSizeZ();
577 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
578 inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride);
579 };
580 }
581
582 namespace OrthancClient
583 {
584 class Study
585 {
586 private:
587 bool isReference_;
588 public:
589 void* pimpl_;
590 Study(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
591 Study(const Study& other) { *this = other; }
592 void operator= (const Study& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
593 inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
594 inline ~Study();
595 inline void Reload();
596 inline LAAW_UINT32 GetSeriesCount();
597 inline ::OrthancClient::Series GetSeries(LAAW_UINT32 index);
598 inline ::std::string GetId() const;
599 inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const;
600 };
601 }
602
603 namespace OrthancClient
604 {
605 class Instance
606 {
607 private:
608 bool isReference_;
609 public:
610 void* pimpl_;
611 Instance(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
612 Instance(const Instance& other) { *this = other; }
613 void operator= (const Instance& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true; }
614 inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
615 inline ~Instance();
616 inline ::std::string GetId() const;
617 inline void SetImageExtractionMode(::Orthanc::ImageExtractionMode mode);
618 inline ::Orthanc::ImageExtractionMode GetImageExtractionMode() const;
619 inline ::std::string GetTagAsString(const ::std::string& tag) const;
620 inline float GetTagAsFloat(const ::std::string& tag) const;
621 inline LAAW_INT32 GetTagAsInt(const ::std::string& tag) const;
622 inline LAAW_UINT32 GetWidth();
623 inline LAAW_UINT32 GetHeight();
624 inline LAAW_UINT32 GetPitch();
625 inline ::Orthanc::PixelFormat GetPixelFormat();
626 inline const void* GetBuffer();
627 inline const void* GetBuffer(LAAW_UINT32 y);
628 inline void DiscardImage();
629 inline void DiscardDicom();
630 inline LAAW_UINT64 GetDicomSize();
631 inline const void* GetDicom();
632 };
633 }
634
635 namespace OrthancClient
636 {
637 inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl)
638 {
639 isReference_ = false;
640 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*);
641 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(0);
642 char* error = function(&pimpl_, orthancUrl.c_str());
643 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
644 }
645 inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password)
646 {
647 isReference_ = false;
648 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*, const char*, const char*);
649 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(1);
650 char* error = function(&pimpl_, orthancUrl.c_str(), username.c_str(), password.c_str());
651 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
652 }
653 /**
654 * @brief Destructs the object.
655 *
656 * Destructs the object.
657 *
658 **/
659 inline OrthancConnection::~OrthancConnection()
660 {
661 if (isReference_) return;
662 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
663 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(2);
664 char* error = function(pimpl_);
665 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
666 }
667 inline LAAW_UINT32 OrthancConnection::GetThreadCount() const
668 {
669 LAAW_UINT32 result_;
670 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_UINT32*);
671 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(3);
672 char* error = function(pimpl_, &result_);
673 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
674 return result_;
675 }
676 inline void OrthancConnection::SetThreadCount(LAAW_UINT32 threadCount)
677 {
678 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
679 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(4);
680 char* error = function(pimpl_, threadCount);
681 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
682 }
683 inline void OrthancConnection::Refresh()
684 {
685 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
686 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(5);
687 char* error = function(pimpl_);
688 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
689 }
690 inline ::std::string OrthancConnection::GetOrthancUrl() const
691 {
692 const char* result_;
693 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
694 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(6);
695 char* error = function(pimpl_, &result_);
696 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
697 return std::string(result_);
698 }
699 inline LAAW_UINT32 OrthancConnection::GetPatientCount()
700 {
701 LAAW_UINT32 result_;
702 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
703 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(7);
704 char* error = function(pimpl_, &result_);
705 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
706 return result_;
707 }
708 inline ::OrthancClient::Patient OrthancConnection::GetPatient(LAAW_UINT32 index)
709 {
710 void* result_;
711 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
712 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(8);
713 char* error = function(pimpl_, &result_, index);
714 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
715 return ::OrthancClient::Patient(result_);
716 }
717 inline void OrthancConnection::DeletePatient(LAAW_UINT32 index)
718 {
719 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32);
720 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(9);
721 char* error = function(pimpl_, index);
722 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
723 }
724 inline void OrthancConnection::StoreFile(const ::std::string& filename)
725 {
726 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const char*);
727 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(10);
728 char* error = function(pimpl_, filename.c_str());
729 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
730 }
731 inline void OrthancConnection::Store(const void* dicom, LAAW_UINT64 size)
732 {
733 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void*, LAAW_UINT64);
734 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(11);
735 char* error = function(pimpl_, dicom, size);
736 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
737 }
738 }
739
740 namespace OrthancClient
741 {
742 inline Patient::Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
743 {
744 isReference_ = false;
745 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
746 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(12);
747 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
748 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
749 }
750 /**
751 * @brief Destructs the object.
752 *
753 * Destructs the object.
754 *
755 **/
756 inline Patient::~Patient()
757 {
758 if (isReference_) return;
759 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
760 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(13);
761 char* error = function(pimpl_);
762 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
763 }
764 inline void Patient::Reload()
765 {
766 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
767 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(14);
768 char* error = function(pimpl_);
769 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
770 }
771 inline LAAW_UINT32 Patient::GetStudyCount()
772 {
773 LAAW_UINT32 result_;
774 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
775 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(15);
776 char* error = function(pimpl_, &result_);
777 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
778 return result_;
779 }
780 inline ::OrthancClient::Study Patient::GetStudy(LAAW_UINT32 index)
781 {
782 void* result_;
783 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
784 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(16);
785 char* error = function(pimpl_, &result_, index);
786 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
787 return ::OrthancClient::Study(result_);
788 }
789 inline ::std::string Patient::GetId() const
790 {
791 const char* result_;
792 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
793 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(17);
794 char* error = function(pimpl_, &result_);
795 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
796 return std::string(result_);
797 }
798 inline ::std::string Patient::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
799 {
800 const char* result_;
801 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
802 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(18);
803 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
804 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
805 return std::string(result_);
806 }
807 }
808
809 namespace OrthancClient
810 {
811 inline Series::Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
812 {
813 isReference_ = false;
814 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
815 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(19);
816 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
817 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
818 }
819 /**
820 * @brief Destructs the object.
821 *
822 * Destructs the object.
823 *
824 **/
825 inline Series::~Series()
826 {
827 if (isReference_) return;
828 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
829 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(20);
830 char* error = function(pimpl_);
831 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
832 }
833 inline void Series::Reload()
834 {
835 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
836 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(21);
837 char* error = function(pimpl_);
838 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
839 }
840 inline bool Series::Is3DImage()
841 {
842 LAAW_INT32 result_;
843 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
844 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(22);
845 char* error = function(pimpl_, &result_);
846 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
847 return result_ != 0;
848 }
849 inline LAAW_UINT32 Series::GetInstanceCount()
850 {
851 LAAW_UINT32 result_;
852 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
853 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(23);
854 char* error = function(pimpl_, &result_);
855 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
856 return result_;
857 }
858 inline ::OrthancClient::Instance Series::GetInstance(LAAW_UINT32 index)
859 {
860 void* result_;
861 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
862 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(24);
863 char* error = function(pimpl_, &result_, index);
864 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
865 return ::OrthancClient::Instance(result_);
866 }
867 inline ::std::string Series::GetId() const
868 {
869 const char* result_;
870 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
871 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(25);
872 char* error = function(pimpl_, &result_);
873 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
874 return std::string(result_);
875 }
876 inline ::std::string Series::GetUrl() const
877 {
878 const char* result_;
879 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
880 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(26);
881 char* error = function(pimpl_, &result_);
882 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
883 return std::string(result_);
884 }
885 inline LAAW_UINT32 Series::GetWidth()
886 {
887 LAAW_UINT32 result_;
888 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
889 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(27);
890 char* error = function(pimpl_, &result_);
891 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
892 return result_;
893 }
894 inline LAAW_UINT32 Series::GetHeight()
895 {
896 LAAW_UINT32 result_;
897 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
898 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(28);
899 char* error = function(pimpl_, &result_);
900 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
901 return result_;
902 }
903 inline float Series::GetVoxelSizeX()
904 {
905 float result_;
906 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
907 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(29);
908 char* error = function(pimpl_, &result_);
909 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
910 return result_;
911 }
912 inline float Series::GetVoxelSizeY()
913 {
914 float result_;
915 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
916 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(30);
917 char* error = function(pimpl_, &result_);
918 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
919 return result_;
920 }
921 inline float Series::GetVoxelSizeZ()
922 {
923 float result_;
924 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*);
925 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(31);
926 char* error = function(pimpl_, &result_);
927 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
928 return result_;
929 }
930 inline ::std::string Series::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
931 {
932 const char* result_;
933 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
934 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(32);
935 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
936 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
937 return std::string(result_);
938 }
939 inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride)
940 {
941 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64);
942 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(33);
943 char* error = function(pimpl_, target, format, lineStride, stackStride);
944 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
945 }
946 }
947
948 namespace OrthancClient
949 {
950 inline Study::Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
951 {
952 isReference_ = false;
953 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
954 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(34);
955 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
956 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
957 }
958 /**
959 * @brief Destructs the object.
960 *
961 * Destructs the object.
962 *
963 **/
964 inline Study::~Study()
965 {
966 if (isReference_) return;
967 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
968 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(35);
969 char* error = function(pimpl_);
970 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
971 }
972 inline void Study::Reload()
973 {
974 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
975 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(36);
976 char* error = function(pimpl_);
977 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
978 }
979 inline LAAW_UINT32 Study::GetSeriesCount()
980 {
981 LAAW_UINT32 result_;
982 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
983 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(37);
984 char* error = function(pimpl_, &result_);
985 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
986 return result_;
987 }
988 inline ::OrthancClient::Series Study::GetSeries(LAAW_UINT32 index)
989 {
990 void* result_;
991 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32);
992 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(38);
993 char* error = function(pimpl_, &result_, index);
994 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
995 return ::OrthancClient::Series(result_);
996 }
997 inline ::std::string Study::GetId() const
998 {
999 const char* result_;
1000 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1001 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(39);
1002 char* error = function(pimpl_, &result_);
1003 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1004 return std::string(result_);
1005 }
1006 inline ::std::string Study::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const
1007 {
1008 const char* result_;
1009 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*);
1010 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(40);
1011 char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str());
1012 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1013 return std::string(result_);
1014 }
1015 }
1016
1017 namespace OrthancClient
1018 {
1019 inline Instance::Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id)
1020 {
1021 isReference_ = false;
1022 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*);
1023 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(41);
1024 char* error = function(&pimpl_, connection.pimpl_, id.c_str());
1025 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1026 }
1027 /**
1028 * @brief Destructs the object.
1029 *
1030 * Destructs the object.
1031 *
1032 **/
1033 inline Instance::~Instance()
1034 {
1035 if (isReference_) return;
1036 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1037 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(42);
1038 char* error = function(pimpl_);
1039 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1040 }
1041 inline ::std::string Instance::GetId() const
1042 {
1043 const char* result_;
1044 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**);
1045 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(43);
1046 char* error = function(pimpl_, &result_);
1047 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1048 return std::string(result_);
1049 }
1050 inline void Instance::SetImageExtractionMode(::Orthanc::ImageExtractionMode mode)
1051 {
1052 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32);
1053 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(44);
1054 char* error = function(pimpl_, mode);
1055 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1056 }
1057 inline ::Orthanc::ImageExtractionMode Instance::GetImageExtractionMode() const
1058 {
1059 LAAW_INT32 result_;
1060 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*);
1061 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(45);
1062 char* error = function(pimpl_, &result_);
1063 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1064 return static_cast< ::Orthanc::ImageExtractionMode >(result_);
1065 }
1066 inline ::std::string Instance::GetTagAsString(const ::std::string& tag) const
1067 {
1068 const char* result_;
1069 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*);
1070 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(46);
1071 char* error = function(pimpl_, &result_, tag.c_str());
1072 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1073 return std::string(result_);
1074 }
1075 inline float Instance::GetTagAsFloat(const ::std::string& tag) const
1076 {
1077 float result_;
1078 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, float*, const char*);
1079 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(47);
1080 char* error = function(pimpl_, &result_, tag.c_str());
1081 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1082 return result_;
1083 }
1084 inline LAAW_INT32 Instance::GetTagAsInt(const ::std::string& tag) const
1085 {
1086 LAAW_INT32 result_;
1087 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*, const char*);
1088 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(48);
1089 char* error = function(pimpl_, &result_, tag.c_str());
1090 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1091 return result_;
1092 }
1093 inline LAAW_UINT32 Instance::GetWidth()
1094 {
1095 LAAW_UINT32 result_;
1096 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1097 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(49);
1098 char* error = function(pimpl_, &result_);
1099 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1100 return result_;
1101 }
1102 inline LAAW_UINT32 Instance::GetHeight()
1103 {
1104 LAAW_UINT32 result_;
1105 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1106 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(50);
1107 char* error = function(pimpl_, &result_);
1108 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1109 return result_;
1110 }
1111 inline LAAW_UINT32 Instance::GetPitch()
1112 {
1113 LAAW_UINT32 result_;
1114 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*);
1115 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(51);
1116 char* error = function(pimpl_, &result_);
1117 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1118 return result_;
1119 }
1120 inline ::Orthanc::PixelFormat Instance::GetPixelFormat()
1121 {
1122 LAAW_INT32 result_;
1123 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*);
1124 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(52);
1125 char* error = function(pimpl_, &result_);
1126 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1127 return static_cast< ::Orthanc::PixelFormat >(result_);
1128 }
1129 inline const void* Instance::GetBuffer()
1130 {
1131 const void* result_;
1132 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1133 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(53);
1134 char* error = function(pimpl_, &result_);
1135 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1136 return reinterpret_cast< const void* >(result_);
1137 }
1138 inline const void* Instance::GetBuffer(LAAW_UINT32 y)
1139 {
1140 const void* result_;
1141 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**, LAAW_UINT32);
1142 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(54);
1143 char* error = function(pimpl_, &result_, y);
1144 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1145 return reinterpret_cast< const void* >(result_);
1146 }
1147 inline void Instance::DiscardImage()
1148 {
1149 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1150 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(55);
1151 char* error = function(pimpl_);
1152 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1153 }
1154 inline void Instance::DiscardDicom()
1155 {
1156 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*);
1157 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(56);
1158 char* error = function(pimpl_);
1159 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1160 }
1161 inline LAAW_UINT64 Instance::GetDicomSize()
1162 {
1163 LAAW_UINT64 result_;
1164 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT64*);
1165 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(57);
1166 char* error = function(pimpl_, &result_);
1167 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1168 return result_;
1169 }
1170 inline const void* Instance::GetDicom()
1171 {
1172 const void* result_;
1173 typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**);
1174 Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(58);
1175 char* error = function(pimpl_, &result_);
1176 ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error);
1177 return reinterpret_cast< const void* >(result_);
1178 }
1179 }
1180