0
|
1 /**
|
|
2 * @ingroup CInterface
|
|
3 **/
|
|
4
|
|
5 /**
|
|
6 * Orthanc - A Lightweight, RESTful DICOM Store
|
|
7 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
|
|
8 * Department, University Hospital of Liege, Belgium
|
|
9 *
|
|
10 * This program is free software: you can redistribute it and/or
|
|
11 * modify it under the terms of the GNU General Public License as
|
|
12 * published by the Free Software Foundation, either version 3 of the
|
|
13 * License, or (at your option) any later version.
|
|
14 *
|
|
15 * In addition, as a special exception, the copyright holders of this
|
|
16 * program give permission to link the code of its release with the
|
|
17 * OpenSSL project's "OpenSSL" library (or with modified versions of it
|
|
18 * that use the same license as the "OpenSSL" library), and distribute
|
|
19 * the linked executables. You must obey the GNU General Public License
|
|
20 * in all respects for all of the code used other than "OpenSSL". If you
|
|
21 * modify file(s) with this exception, you may extend this exception to
|
|
22 * your version of the file(s), but you are not obligated to do so. If
|
|
23 * you do not wish to do so, delete this exception statement from your
|
|
24 * version. If you delete this exception statement from all source files
|
|
25 * in the program, then also delete it here.
|
|
26 *
|
|
27 * This program is distributed in the hope that it will be useful, but
|
|
28 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
30 * General Public License for more details.
|
|
31 *
|
|
32 * You should have received a copy of the GNU General Public License
|
|
33 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
34 **/
|
|
35
|
|
36
|
|
37
|
|
38 #pragma once
|
|
39
|
|
40 #include "OrthancCPlugin.h"
|
|
41
|
|
42
|
|
43 /** @{ */
|
|
44
|
|
45 #ifdef __cplusplus
|
|
46 extern "C"
|
|
47 {
|
|
48 #endif
|
|
49
|
|
50
|
|
51 /**
|
|
52 * Opaque structure that represents the context of a custom database engine.
|
|
53 * @ingroup Callbacks
|
|
54 **/
|
|
55 typedef struct _OrthancPluginDatabaseContext_t OrthancPluginDatabaseContext;
|
|
56
|
|
57
|
|
58 /*<! @cond Doxygen_Suppress */
|
|
59 typedef enum
|
|
60 {
|
|
61 _OrthancPluginDatabaseAnswerType_None = 0,
|
|
62
|
|
63 /* Events */
|
|
64 _OrthancPluginDatabaseAnswerType_DeletedAttachment = 1,
|
|
65 _OrthancPluginDatabaseAnswerType_DeletedResource = 2,
|
|
66 _OrthancPluginDatabaseAnswerType_RemainingAncestor = 3,
|
|
67
|
|
68 /* Return value */
|
|
69 _OrthancPluginDatabaseAnswerType_Attachment = 10,
|
|
70 _OrthancPluginDatabaseAnswerType_Change = 11,
|
|
71 _OrthancPluginDatabaseAnswerType_DicomTag = 12,
|
|
72 _OrthancPluginDatabaseAnswerType_ExportedResource = 13,
|
|
73 _OrthancPluginDatabaseAnswerType_Int32 = 14,
|
|
74 _OrthancPluginDatabaseAnswerType_Int64 = 15,
|
|
75 _OrthancPluginDatabaseAnswerType_Resource = 16,
|
|
76 _OrthancPluginDatabaseAnswerType_String = 17,
|
|
77
|
|
78 _OrthancPluginDatabaseAnswerType_INTERNAL = 0x7fffffff
|
|
79 } _OrthancPluginDatabaseAnswerType;
|
|
80
|
|
81
|
|
82 typedef struct
|
|
83 {
|
|
84 const char* uuid;
|
|
85 int32_t contentType;
|
|
86 uint64_t uncompressedSize;
|
|
87 const char* uncompressedHash;
|
|
88 int32_t compressionType;
|
|
89 uint64_t compressedSize;
|
|
90 const char* compressedHash;
|
|
91 } OrthancPluginAttachment;
|
|
92
|
|
93 typedef struct
|
|
94 {
|
|
95 uint16_t group;
|
|
96 uint16_t element;
|
|
97 const char* value;
|
|
98 } OrthancPluginDicomTag;
|
|
99
|
|
100 typedef struct
|
|
101 {
|
|
102 int64_t seq;
|
|
103 int32_t changeType;
|
|
104 OrthancPluginResourceType resourceType;
|
|
105 const char* publicId;
|
|
106 const char* date;
|
|
107 } OrthancPluginChange;
|
|
108
|
|
109 typedef struct
|
|
110 {
|
|
111 int64_t seq;
|
|
112 OrthancPluginResourceType resourceType;
|
|
113 const char* publicId;
|
|
114 const char* modality;
|
|
115 const char* date;
|
|
116 const char* patientId;
|
|
117 const char* studyInstanceUid;
|
|
118 const char* seriesInstanceUid;
|
|
119 const char* sopInstanceUid;
|
|
120 } OrthancPluginExportedResource;
|
|
121
|
|
122
|
|
123 typedef struct
|
|
124 {
|
|
125 OrthancPluginDatabaseContext* database;
|
|
126 _OrthancPluginDatabaseAnswerType type;
|
|
127 int32_t valueInt32;
|
|
128 uint32_t valueUint32;
|
|
129 int64_t valueInt64;
|
|
130 const char *valueString;
|
|
131 const void *valueGeneric;
|
|
132 } _OrthancPluginDatabaseAnswer;
|
|
133
|
|
134 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerString(
|
|
135 OrthancPluginContext* context,
|
|
136 OrthancPluginDatabaseContext* database,
|
|
137 const char* value)
|
|
138 {
|
|
139 _OrthancPluginDatabaseAnswer params;
|
|
140 memset(¶ms, 0, sizeof(params));
|
|
141 params.database = database;
|
|
142 params.type = _OrthancPluginDatabaseAnswerType_String;
|
|
143 params.valueString = value;
|
|
144 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
145 }
|
|
146
|
|
147 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerChange(
|
|
148 OrthancPluginContext* context,
|
|
149 OrthancPluginDatabaseContext* database,
|
|
150 const OrthancPluginChange* change)
|
|
151 {
|
|
152 _OrthancPluginDatabaseAnswer params;
|
|
153 memset(¶ms, 0, sizeof(params));
|
|
154
|
|
155 params.database = database;
|
|
156 params.type = _OrthancPluginDatabaseAnswerType_Change;
|
|
157 params.valueUint32 = 0;
|
|
158 params.valueGeneric = change;
|
|
159
|
|
160 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
161 }
|
|
162
|
|
163 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerChangesDone(
|
|
164 OrthancPluginContext* context,
|
|
165 OrthancPluginDatabaseContext* database)
|
|
166 {
|
|
167 _OrthancPluginDatabaseAnswer params;
|
|
168 memset(¶ms, 0, sizeof(params));
|
|
169
|
|
170 params.database = database;
|
|
171 params.type = _OrthancPluginDatabaseAnswerType_Change;
|
|
172 params.valueUint32 = 1;
|
|
173 params.valueGeneric = NULL;
|
|
174
|
|
175 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
176 }
|
|
177
|
|
178 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerInt32(
|
|
179 OrthancPluginContext* context,
|
|
180 OrthancPluginDatabaseContext* database,
|
|
181 int32_t value)
|
|
182 {
|
|
183 _OrthancPluginDatabaseAnswer params;
|
|
184 memset(¶ms, 0, sizeof(params));
|
|
185 params.database = database;
|
|
186 params.type = _OrthancPluginDatabaseAnswerType_Int32;
|
|
187 params.valueInt32 = value;
|
|
188 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
189 }
|
|
190
|
|
191 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerInt64(
|
|
192 OrthancPluginContext* context,
|
|
193 OrthancPluginDatabaseContext* database,
|
|
194 int64_t value)
|
|
195 {
|
|
196 _OrthancPluginDatabaseAnswer params;
|
|
197 memset(¶ms, 0, sizeof(params));
|
|
198 params.database = database;
|
|
199 params.type = _OrthancPluginDatabaseAnswerType_Int64;
|
|
200 params.valueInt64 = value;
|
|
201 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
202 }
|
|
203
|
|
204 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerExportedResource(
|
|
205 OrthancPluginContext* context,
|
|
206 OrthancPluginDatabaseContext* database,
|
|
207 const OrthancPluginExportedResource* exported)
|
|
208 {
|
|
209 _OrthancPluginDatabaseAnswer params;
|
|
210 memset(¶ms, 0, sizeof(params));
|
|
211
|
|
212 params.database = database;
|
|
213 params.type = _OrthancPluginDatabaseAnswerType_ExportedResource;
|
|
214 params.valueUint32 = 0;
|
|
215 params.valueGeneric = exported;
|
|
216 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
217 }
|
|
218
|
|
219 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerExportedResourcesDone(
|
|
220 OrthancPluginContext* context,
|
|
221 OrthancPluginDatabaseContext* database)
|
|
222 {
|
|
223 _OrthancPluginDatabaseAnswer params;
|
|
224 memset(¶ms, 0, sizeof(params));
|
|
225
|
|
226 params.database = database;
|
|
227 params.type = _OrthancPluginDatabaseAnswerType_ExportedResource;
|
|
228 params.valueUint32 = 1;
|
|
229 params.valueGeneric = NULL;
|
|
230 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
231 }
|
|
232
|
|
233 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerDicomTag(
|
|
234 OrthancPluginContext* context,
|
|
235 OrthancPluginDatabaseContext* database,
|
|
236 const OrthancPluginDicomTag* tag)
|
|
237 {
|
|
238 _OrthancPluginDatabaseAnswer params;
|
|
239 memset(¶ms, 0, sizeof(params));
|
|
240 params.database = database;
|
|
241 params.type = _OrthancPluginDatabaseAnswerType_DicomTag;
|
|
242 params.valueGeneric = tag;
|
|
243 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
244 }
|
|
245
|
|
246 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerAttachment(
|
|
247 OrthancPluginContext* context,
|
|
248 OrthancPluginDatabaseContext* database,
|
|
249 const OrthancPluginAttachment* attachment)
|
|
250 {
|
|
251 _OrthancPluginDatabaseAnswer params;
|
|
252 memset(¶ms, 0, sizeof(params));
|
|
253 params.database = database;
|
|
254 params.type = _OrthancPluginDatabaseAnswerType_Attachment;
|
|
255 params.valueGeneric = attachment;
|
|
256 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
257 }
|
|
258
|
|
259 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerResource(
|
|
260 OrthancPluginContext* context,
|
|
261 OrthancPluginDatabaseContext* database,
|
|
262 int64_t id,
|
|
263 OrthancPluginResourceType resourceType)
|
|
264 {
|
|
265 _OrthancPluginDatabaseAnswer params;
|
|
266 memset(¶ms, 0, sizeof(params));
|
|
267 params.database = database;
|
|
268 params.type = _OrthancPluginDatabaseAnswerType_Resource;
|
|
269 params.valueInt64 = id;
|
|
270 params.valueInt32 = (int32_t) resourceType;
|
|
271 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
272 }
|
|
273
|
|
274 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseSignalDeletedAttachment(
|
|
275 OrthancPluginContext* context,
|
|
276 OrthancPluginDatabaseContext* database,
|
|
277 const OrthancPluginAttachment* attachment)
|
|
278 {
|
|
279 _OrthancPluginDatabaseAnswer params;
|
|
280 memset(¶ms, 0, sizeof(params));
|
|
281 params.database = database;
|
|
282 params.type = _OrthancPluginDatabaseAnswerType_DeletedAttachment;
|
|
283 params.valueGeneric = attachment;
|
|
284 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
285 }
|
|
286
|
|
287 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseSignalDeletedResource(
|
|
288 OrthancPluginContext* context,
|
|
289 OrthancPluginDatabaseContext* database,
|
|
290 const char* publicId,
|
|
291 OrthancPluginResourceType resourceType)
|
|
292 {
|
|
293 _OrthancPluginDatabaseAnswer params;
|
|
294 memset(¶ms, 0, sizeof(params));
|
|
295 params.database = database;
|
|
296 params.type = _OrthancPluginDatabaseAnswerType_DeletedResource;
|
|
297 params.valueString = publicId;
|
|
298 params.valueInt32 = (int32_t) resourceType;
|
|
299 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
300 }
|
|
301
|
|
302 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseSignalRemainingAncestor(
|
|
303 OrthancPluginContext* context,
|
|
304 OrthancPluginDatabaseContext* database,
|
|
305 const char* ancestorId,
|
|
306 OrthancPluginResourceType ancestorType)
|
|
307 {
|
|
308 _OrthancPluginDatabaseAnswer params;
|
|
309 memset(¶ms, 0, sizeof(params));
|
|
310 params.database = database;
|
|
311 params.type = _OrthancPluginDatabaseAnswerType_RemainingAncestor;
|
|
312 params.valueString = ancestorId;
|
|
313 params.valueInt32 = (int32_t) ancestorType;
|
|
314 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms);
|
|
315 }
|
|
316
|
|
317
|
|
318
|
|
319
|
|
320
|
|
321 typedef struct
|
|
322 {
|
|
323 OrthancPluginErrorCode (*addAttachment) (
|
|
324 /* inputs */
|
|
325 void* payload,
|
|
326 int64_t id,
|
|
327 const OrthancPluginAttachment* attachment);
|
|
328
|
|
329 OrthancPluginErrorCode (*attachChild) (
|
|
330 /* inputs */
|
|
331 void* payload,
|
|
332 int64_t parent,
|
|
333 int64_t child);
|
|
334
|
|
335 OrthancPluginErrorCode (*clearChanges) (
|
|
336 /* inputs */
|
|
337 void* payload);
|
|
338
|
|
339 OrthancPluginErrorCode (*clearExportedResources) (
|
|
340 /* inputs */
|
|
341 void* payload);
|
|
342
|
|
343 OrthancPluginErrorCode (*createResource) (
|
|
344 /* outputs */
|
|
345 int64_t* id,
|
|
346 /* inputs */
|
|
347 void* payload,
|
|
348 const char* publicId,
|
|
349 OrthancPluginResourceType resourceType);
|
|
350
|
|
351 OrthancPluginErrorCode (*deleteAttachment) (
|
|
352 /* inputs */
|
|
353 void* payload,
|
|
354 int64_t id,
|
|
355 int32_t contentType);
|
|
356
|
|
357 OrthancPluginErrorCode (*deleteMetadata) (
|
|
358 /* inputs */
|
|
359 void* payload,
|
|
360 int64_t id,
|
|
361 int32_t metadataType);
|
|
362
|
|
363 OrthancPluginErrorCode (*deleteResource) (
|
|
364 /* inputs */
|
|
365 void* payload,
|
|
366 int64_t id);
|
|
367
|
|
368 /* Output: Use OrthancPluginDatabaseAnswerString() */
|
|
369 OrthancPluginErrorCode (*getAllPublicIds) (
|
|
370 /* outputs */
|
|
371 OrthancPluginDatabaseContext* context,
|
|
372 /* inputs */
|
|
373 void* payload,
|
|
374 OrthancPluginResourceType resourceType);
|
|
375
|
|
376 /* Output: Use OrthancPluginDatabaseAnswerChange() and
|
|
377 * OrthancPluginDatabaseAnswerChangesDone() */
|
|
378 OrthancPluginErrorCode (*getChanges) (
|
|
379 /* outputs */
|
|
380 OrthancPluginDatabaseContext* context,
|
|
381 /* inputs */
|
|
382 void* payload,
|
|
383 int64_t since,
|
|
384 uint32_t maxResult);
|
|
385
|
|
386 /* Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
387 OrthancPluginErrorCode (*getChildrenInternalId) (
|
|
388 /* outputs */
|
|
389 OrthancPluginDatabaseContext* context,
|
|
390 /* inputs */
|
|
391 void* payload,
|
|
392 int64_t id);
|
|
393
|
|
394 /* Output: Use OrthancPluginDatabaseAnswerString() */
|
|
395 OrthancPluginErrorCode (*getChildrenPublicId) (
|
|
396 /* outputs */
|
|
397 OrthancPluginDatabaseContext* context,
|
|
398 /* inputs */
|
|
399 void* payload,
|
|
400 int64_t id);
|
|
401
|
|
402 /* Output: Use OrthancPluginDatabaseAnswerExportedResource() and
|
|
403 * OrthancPluginDatabaseAnswerExportedResourcesDone() */
|
|
404 OrthancPluginErrorCode (*getExportedResources) (
|
|
405 /* outputs */
|
|
406 OrthancPluginDatabaseContext* context,
|
|
407 /* inputs */
|
|
408 void* payload,
|
|
409 int64_t since,
|
|
410 uint32_t maxResult);
|
|
411
|
|
412 /* Output: Use OrthancPluginDatabaseAnswerChange() */
|
|
413 OrthancPluginErrorCode (*getLastChange) (
|
|
414 /* outputs */
|
|
415 OrthancPluginDatabaseContext* context,
|
|
416 /* inputs */
|
|
417 void* payload);
|
|
418
|
|
419 /* Output: Use OrthancPluginDatabaseAnswerExportedResource() */
|
|
420 OrthancPluginErrorCode (*getLastExportedResource) (
|
|
421 /* outputs */
|
|
422 OrthancPluginDatabaseContext* context,
|
|
423 /* inputs */
|
|
424 void* payload);
|
|
425
|
|
426 /* Output: Use OrthancPluginDatabaseAnswerDicomTag() */
|
|
427 OrthancPluginErrorCode (*getMainDicomTags) (
|
|
428 /* outputs */
|
|
429 OrthancPluginDatabaseContext* context,
|
|
430 /* inputs */
|
|
431 void* payload,
|
|
432 int64_t id);
|
|
433
|
|
434 /* Output: Use OrthancPluginDatabaseAnswerString() */
|
|
435 OrthancPluginErrorCode (*getPublicId) (
|
|
436 /* outputs */
|
|
437 OrthancPluginDatabaseContext* context,
|
|
438 /* inputs */
|
|
439 void* payload,
|
|
440 int64_t id);
|
|
441
|
|
442 OrthancPluginErrorCode (*getResourceCount) (
|
|
443 /* outputs */
|
|
444 uint64_t* target,
|
|
445 /* inputs */
|
|
446 void* payload,
|
|
447 OrthancPluginResourceType resourceType);
|
|
448
|
|
449 OrthancPluginErrorCode (*getResourceType) (
|
|
450 /* outputs */
|
|
451 OrthancPluginResourceType* resourceType,
|
|
452 /* inputs */
|
|
453 void* payload,
|
|
454 int64_t id);
|
|
455
|
|
456 OrthancPluginErrorCode (*getTotalCompressedSize) (
|
|
457 /* outputs */
|
|
458 uint64_t* target,
|
|
459 /* inputs */
|
|
460 void* payload);
|
|
461
|
|
462 OrthancPluginErrorCode (*getTotalUncompressedSize) (
|
|
463 /* outputs */
|
|
464 uint64_t* target,
|
|
465 /* inputs */
|
|
466 void* payload);
|
|
467
|
|
468 OrthancPluginErrorCode (*isExistingResource) (
|
|
469 /* outputs */
|
|
470 int32_t* existing,
|
|
471 /* inputs */
|
|
472 void* payload,
|
|
473 int64_t id);
|
|
474
|
|
475 OrthancPluginErrorCode (*isProtectedPatient) (
|
|
476 /* outputs */
|
|
477 int32_t* isProtected,
|
|
478 /* inputs */
|
|
479 void* payload,
|
|
480 int64_t id);
|
|
481
|
|
482 /* Output: Use OrthancPluginDatabaseAnswerInt32() */
|
|
483 OrthancPluginErrorCode (*listAvailableMetadata) (
|
|
484 /* outputs */
|
|
485 OrthancPluginDatabaseContext* context,
|
|
486 /* inputs */
|
|
487 void* payload,
|
|
488 int64_t id);
|
|
489
|
|
490 /* Output: Use OrthancPluginDatabaseAnswerInt32() */
|
|
491 OrthancPluginErrorCode (*listAvailableAttachments) (
|
|
492 /* outputs */
|
|
493 OrthancPluginDatabaseContext* context,
|
|
494 /* inputs */
|
|
495 void* payload,
|
|
496 int64_t id);
|
|
497
|
|
498 OrthancPluginErrorCode (*logChange) (
|
|
499 /* inputs */
|
|
500 void* payload,
|
|
501 const OrthancPluginChange* change);
|
|
502
|
|
503 OrthancPluginErrorCode (*logExportedResource) (
|
|
504 /* inputs */
|
|
505 void* payload,
|
|
506 const OrthancPluginExportedResource* exported);
|
|
507
|
|
508 /* Output: Use OrthancPluginDatabaseAnswerAttachment() */
|
|
509 OrthancPluginErrorCode (*lookupAttachment) (
|
|
510 /* outputs */
|
|
511 OrthancPluginDatabaseContext* context,
|
|
512 /* inputs */
|
|
513 void* payload,
|
|
514 int64_t id,
|
|
515 int32_t contentType);
|
|
516
|
|
517 /* Output: Use OrthancPluginDatabaseAnswerString() */
|
|
518 OrthancPluginErrorCode (*lookupGlobalProperty) (
|
|
519 /* outputs */
|
|
520 OrthancPluginDatabaseContext* context,
|
|
521 /* inputs */
|
|
522 void* payload,
|
|
523 int32_t property);
|
|
524
|
|
525 /* Use "OrthancPluginDatabaseExtensions::lookupIdentifier3"
|
|
526 instead of this function as of Orthanc 0.9.5 (db v6), can be set to NULL.
|
|
527 Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
528 OrthancPluginErrorCode (*lookupIdentifier) (
|
|
529 /* outputs */
|
|
530 OrthancPluginDatabaseContext* context,
|
|
531 /* inputs */
|
|
532 void* payload,
|
|
533 const OrthancPluginDicomTag* tag);
|
|
534
|
|
535 /* Unused starting with Orthanc 0.9.5 (db v6), can be set to NULL.
|
|
536 Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
537 OrthancPluginErrorCode (*lookupIdentifier2) (
|
|
538 /* outputs */
|
|
539 OrthancPluginDatabaseContext* context,
|
|
540 /* inputs */
|
|
541 void* payload,
|
|
542 const char* value);
|
|
543
|
|
544 /* Output: Use OrthancPluginDatabaseAnswerString() */
|
|
545 OrthancPluginErrorCode (*lookupMetadata) (
|
|
546 /* outputs */
|
|
547 OrthancPluginDatabaseContext* context,
|
|
548 /* inputs */
|
|
549 void* payload,
|
|
550 int64_t id,
|
|
551 int32_t metadata);
|
|
552
|
|
553 /* Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
554 OrthancPluginErrorCode (*lookupParent) (
|
|
555 /* outputs */
|
|
556 OrthancPluginDatabaseContext* context,
|
|
557 /* inputs */
|
|
558 void* payload,
|
|
559 int64_t id);
|
|
560
|
|
561 /* Output: Use OrthancPluginDatabaseAnswerResource() */
|
|
562 OrthancPluginErrorCode (*lookupResource) (
|
|
563 /* outputs */
|
|
564 OrthancPluginDatabaseContext* context,
|
|
565 /* inputs */
|
|
566 void* payload,
|
|
567 const char* publicId);
|
|
568
|
|
569 /* Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
570 OrthancPluginErrorCode (*selectPatientToRecycle) (
|
|
571 /* outputs */
|
|
572 OrthancPluginDatabaseContext* context,
|
|
573 /* inputs */
|
|
574 void* payload);
|
|
575
|
|
576 /* Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
577 OrthancPluginErrorCode (*selectPatientToRecycle2) (
|
|
578 /* outputs */
|
|
579 OrthancPluginDatabaseContext* context,
|
|
580 /* inputs */
|
|
581 void* payload,
|
|
582 int64_t patientIdToAvoid);
|
|
583
|
|
584 OrthancPluginErrorCode (*setGlobalProperty) (
|
|
585 /* inputs */
|
|
586 void* payload,
|
|
587 int32_t property,
|
|
588 const char* value);
|
|
589
|
|
590 OrthancPluginErrorCode (*setMainDicomTag) (
|
|
591 /* inputs */
|
|
592 void* payload,
|
|
593 int64_t id,
|
|
594 const OrthancPluginDicomTag* tag);
|
|
595
|
|
596 OrthancPluginErrorCode (*setIdentifierTag) (
|
|
597 /* inputs */
|
|
598 void* payload,
|
|
599 int64_t id,
|
|
600 const OrthancPluginDicomTag* tag);
|
|
601
|
|
602 OrthancPluginErrorCode (*setMetadata) (
|
|
603 /* inputs */
|
|
604 void* payload,
|
|
605 int64_t id,
|
|
606 int32_t metadata,
|
|
607 const char* value);
|
|
608
|
|
609 OrthancPluginErrorCode (*setProtectedPatient) (
|
|
610 /* inputs */
|
|
611 void* payload,
|
|
612 int64_t id,
|
|
613 int32_t isProtected);
|
|
614
|
|
615 OrthancPluginErrorCode (*startTransaction) (
|
|
616 /* inputs */
|
|
617 void* payload);
|
|
618
|
|
619 OrthancPluginErrorCode (*rollbackTransaction) (
|
|
620 /* inputs */
|
|
621 void* payload);
|
|
622
|
|
623 OrthancPluginErrorCode (*commitTransaction) (
|
|
624 /* inputs */
|
|
625 void* payload);
|
|
626
|
|
627 OrthancPluginErrorCode (*open) (
|
|
628 /* inputs */
|
|
629 void* payload);
|
|
630
|
|
631 OrthancPluginErrorCode (*close) (
|
|
632 /* inputs */
|
|
633 void* payload);
|
|
634
|
|
635 } OrthancPluginDatabaseBackend;
|
|
636
|
|
637
|
|
638 typedef struct
|
|
639 {
|
|
640 /* Output: Use OrthancPluginDatabaseAnswerString() */
|
|
641 OrthancPluginErrorCode (*getAllPublicIdsWithLimit) (
|
|
642 /* outputs */
|
|
643 OrthancPluginDatabaseContext* context,
|
|
644 /* inputs */
|
|
645 void* payload,
|
|
646 OrthancPluginResourceType resourceType,
|
|
647 uint64_t since,
|
|
648 uint64_t limit);
|
|
649
|
|
650 OrthancPluginErrorCode (*getDatabaseVersion) (
|
|
651 /* outputs */
|
|
652 uint32_t* version,
|
|
653 /* inputs */
|
|
654 void* payload);
|
|
655
|
|
656 OrthancPluginErrorCode (*upgradeDatabase) (
|
|
657 /* inputs */
|
|
658 void* payload,
|
|
659 uint32_t targetVersion,
|
|
660 OrthancPluginStorageArea* storageArea);
|
|
661
|
|
662 OrthancPluginErrorCode (*clearMainDicomTags) (
|
|
663 /* inputs */
|
|
664 void* payload,
|
|
665 int64_t id);
|
|
666
|
|
667 /* Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
668 OrthancPluginErrorCode (*getAllInternalIds) (
|
|
669 /* outputs */
|
|
670 OrthancPluginDatabaseContext* context,
|
|
671 /* inputs */
|
|
672 void* payload,
|
|
673 OrthancPluginResourceType resourceType);
|
|
674
|
|
675 /* Output: Use OrthancPluginDatabaseAnswerInt64() */
|
|
676 OrthancPluginErrorCode (*lookupIdentifier3) (
|
|
677 /* outputs */
|
|
678 OrthancPluginDatabaseContext* context,
|
|
679 /* inputs */
|
|
680 void* payload,
|
|
681 OrthancPluginResourceType resourceType,
|
|
682 const OrthancPluginDicomTag* tag,
|
|
683 OrthancPluginIdentifierConstraint constraint);
|
|
684 } OrthancPluginDatabaseExtensions;
|
|
685
|
|
686 /*<! @endcond */
|
|
687
|
|
688
|
|
689 typedef struct
|
|
690 {
|
|
691 OrthancPluginDatabaseContext** result;
|
|
692 const OrthancPluginDatabaseBackend* backend;
|
|
693 void* payload;
|
|
694 } _OrthancPluginRegisterDatabaseBackend;
|
|
695
|
|
696 /**
|
|
697 * Register a custom database back-end.
|
|
698 *
|
|
699 * Instead of manually filling the OrthancPluginDatabaseBackend
|
|
700 * structure, you should instead implement a concrete C++ class
|
|
701 * deriving from ::OrthancPlugins::IDatabaseBackend, and register it
|
|
702 * using ::OrthancPlugins::DatabaseBackendAdapter::Register().
|
|
703 *
|
|
704 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
|
|
705 * @param backend The callbacks of the custom database engine.
|
|
706 * @param payload Pointer containing private information for the database engine.
|
|
707 * @return The context of the database engine (it must not be manually freed).
|
|
708 * @ingroup Callbacks
|
|
709 * @deprecated
|
|
710 * @see OrthancPluginRegisterDatabaseBackendV2
|
|
711 **/
|
|
712 ORTHANC_PLUGIN_INLINE OrthancPluginDatabaseContext* OrthancPluginRegisterDatabaseBackend(
|
|
713 OrthancPluginContext* context,
|
|
714 const OrthancPluginDatabaseBackend* backend,
|
|
715 void* payload)
|
|
716 {
|
|
717 OrthancPluginDatabaseContext* result = NULL;
|
|
718 _OrthancPluginRegisterDatabaseBackend params;
|
|
719
|
|
720 if (sizeof(int32_t) != sizeof(_OrthancPluginDatabaseAnswerType))
|
|
721 {
|
|
722 return NULL;
|
|
723 }
|
|
724
|
|
725 memset(¶ms, 0, sizeof(params));
|
|
726 params.backend = backend;
|
|
727 params.result = &result;
|
|
728 params.payload = payload;
|
|
729
|
|
730 if (context->InvokeService(context, _OrthancPluginService_RegisterDatabaseBackend, ¶ms) ||
|
|
731 result == NULL)
|
|
732 {
|
|
733 /* Error */
|
|
734 return NULL;
|
|
735 }
|
|
736 else
|
|
737 {
|
|
738 return result;
|
|
739 }
|
|
740 }
|
|
741
|
|
742
|
|
743 typedef struct
|
|
744 {
|
|
745 OrthancPluginDatabaseContext** result;
|
|
746 const OrthancPluginDatabaseBackend* backend;
|
|
747 void* payload;
|
|
748 const OrthancPluginDatabaseExtensions* extensions;
|
|
749 uint32_t extensionsSize;
|
|
750 } _OrthancPluginRegisterDatabaseBackendV2;
|
|
751
|
|
752
|
|
753 /**
|
|
754 * Register a custom database back-end.
|
|
755 *
|
|
756 * Instead of manually filling the OrthancPluginDatabaseBackendV2
|
|
757 * structure, you should instead implement a concrete C++ class
|
|
758 * deriving from ::OrthancPlugins::IDatabaseBackend, and register it
|
|
759 * using ::OrthancPlugins::DatabaseBackendAdapter::Register().
|
|
760 *
|
|
761 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
|
|
762 * @param backend The callbacks of the custom database engine.
|
|
763 * @param payload Pointer containing private information for the database engine.
|
|
764 * @param extensions Extensions to the base database SDK that was shipped until Orthanc 0.9.3.
|
|
765 * @return The context of the database engine (it must not be manually freed).
|
|
766 * @ingroup Callbacks
|
|
767 **/
|
|
768 ORTHANC_PLUGIN_INLINE OrthancPluginDatabaseContext* OrthancPluginRegisterDatabaseBackendV2(
|
|
769 OrthancPluginContext* context,
|
|
770 const OrthancPluginDatabaseBackend* backend,
|
|
771 const OrthancPluginDatabaseExtensions* extensions,
|
|
772 void* payload)
|
|
773 {
|
|
774 OrthancPluginDatabaseContext* result = NULL;
|
|
775 _OrthancPluginRegisterDatabaseBackendV2 params;
|
|
776
|
|
777 if (sizeof(int32_t) != sizeof(_OrthancPluginDatabaseAnswerType))
|
|
778 {
|
|
779 return NULL;
|
|
780 }
|
|
781
|
|
782 memset(¶ms, 0, sizeof(params));
|
|
783 params.backend = backend;
|
|
784 params.result = &result;
|
|
785 params.payload = payload;
|
|
786 params.extensions = extensions;
|
|
787 params.extensionsSize = sizeof(OrthancPluginDatabaseExtensions);
|
|
788
|
|
789 if (context->InvokeService(context, _OrthancPluginService_RegisterDatabaseBackendV2, ¶ms) ||
|
|
790 result == NULL)
|
|
791 {
|
|
792 /* Error */
|
|
793 return NULL;
|
|
794 }
|
|
795 else
|
|
796 {
|
|
797 return result;
|
|
798 }
|
|
799 }
|
|
800
|
|
801
|
|
802 #ifdef __cplusplus
|
|
803 }
|
|
804 #endif
|
|
805
|
|
806
|
|
807 /** @} */
|
|
808
|