Mercurial > hg > orthanc
comparison Plugins/Include/OrthancCDatabasePlugin.h @ 1309:8f4487d8f79e db-changes
new files for custom database back-end
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 11 Feb 2015 10:36:22 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1308:f7966e9950e4 | 1309:8f4487d8f79e |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
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 #pragma once | |
35 | |
36 #include "OrthancCPlugin.h" | |
37 | |
38 | |
39 /** @{ */ | |
40 | |
41 #ifdef __cplusplus | |
42 extern "C" | |
43 { | |
44 #endif | |
45 | |
46 typedef struct _OrthancPluginDatabaseContext_t OrthancPluginDatabaseContext; | |
47 | |
48 | |
49 typedef enum | |
50 { | |
51 _OrthancPluginDatabaseAnswerType_None = 0, | |
52 | |
53 /* Events */ | |
54 _OrthancPluginDatabaseAnswerType_DeletedAttachment = 1, | |
55 _OrthancPluginDatabaseAnswerType_DeletedResource = 2, | |
56 _OrthancPluginDatabaseAnswerType_RemainingAncestor = 3, | |
57 | |
58 /* Return value */ | |
59 _OrthancPluginDatabaseAnswerType_Attachment = 10, | |
60 _OrthancPluginDatabaseAnswerType_Change = 11, | |
61 _OrthancPluginDatabaseAnswerType_DicomTag = 12, | |
62 _OrthancPluginDatabaseAnswerType_ExportedResource = 13, | |
63 _OrthancPluginDatabaseAnswerType_Int32 = 14, | |
64 _OrthancPluginDatabaseAnswerType_Int64 = 15, | |
65 _OrthancPluginDatabaseAnswerType_Resource = 16, | |
66 _OrthancPluginDatabaseAnswerType_String = 17 | |
67 } _OrthancPluginDatabaseAnswerType; | |
68 | |
69 | |
70 typedef struct | |
71 { | |
72 const char* uuid; | |
73 int32_t contentType; | |
74 uint64_t uncompressedSize; | |
75 const char* uncompressedHash; | |
76 int32_t compressionType; | |
77 uint64_t compressedSize; | |
78 const char* compressedHash; | |
79 } OrthancPluginAttachment; | |
80 | |
81 typedef struct | |
82 { | |
83 uint16_t group; | |
84 uint16_t element; | |
85 const char* value; | |
86 } OrthancPluginDicomTag; | |
87 | |
88 typedef struct | |
89 { | |
90 int64_t seq; | |
91 int32_t changeType; | |
92 OrthancPluginResourceType resourceType; | |
93 const char* publicId; | |
94 const char* date; | |
95 } OrthancPluginChange; | |
96 | |
97 typedef struct | |
98 { | |
99 int64_t seq; | |
100 OrthancPluginResourceType resourceType; | |
101 const char* publicId; | |
102 const char* modality; | |
103 const char* date; | |
104 const char* patientId; | |
105 const char* studyInstanceUid; | |
106 const char* seriesInstanceUid; | |
107 const char* sopInstanceUid; | |
108 } OrthancPluginExportedResource; | |
109 | |
110 | |
111 typedef struct | |
112 { | |
113 OrthancPluginDatabaseContext* database; | |
114 _OrthancPluginDatabaseAnswerType type; | |
115 int32_t valueInt32; | |
116 uint32_t valueUint32; | |
117 int64_t valueInt64; | |
118 const char *valueString; | |
119 const void *valueGeneric; | |
120 } _OrthancPluginDatabaseAnswer; | |
121 | |
122 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerString( | |
123 OrthancPluginContext* context, | |
124 OrthancPluginDatabaseContext* database, | |
125 const char* value) | |
126 { | |
127 _OrthancPluginDatabaseAnswer params; | |
128 memset(¶ms, 0, sizeof(params)); | |
129 params.database = database; | |
130 params.type = _OrthancPluginDatabaseAnswerType_String; | |
131 params.valueString = value; | |
132 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
133 } | |
134 | |
135 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerChange( | |
136 OrthancPluginContext* context, | |
137 OrthancPluginDatabaseContext* database, | |
138 const OrthancPluginChange* change) | |
139 { | |
140 _OrthancPluginDatabaseAnswer params; | |
141 memset(¶ms, 0, sizeof(params)); | |
142 | |
143 params.database = database; | |
144 params.type = _OrthancPluginDatabaseAnswerType_Change; | |
145 params.valueUint32 = 0; | |
146 params.valueGeneric = change; | |
147 | |
148 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
149 } | |
150 | |
151 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerChangesDone( | |
152 OrthancPluginContext* context, | |
153 OrthancPluginDatabaseContext* database) | |
154 { | |
155 _OrthancPluginDatabaseAnswer params; | |
156 memset(¶ms, 0, sizeof(params)); | |
157 | |
158 params.database = database; | |
159 params.type = _OrthancPluginDatabaseAnswerType_Change; | |
160 params.valueUint32 = 1; | |
161 params.valueGeneric = NULL; | |
162 | |
163 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
164 } | |
165 | |
166 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerInt32( | |
167 OrthancPluginContext* context, | |
168 OrthancPluginDatabaseContext* database, | |
169 int32_t value) | |
170 { | |
171 _OrthancPluginDatabaseAnswer params; | |
172 memset(¶ms, 0, sizeof(params)); | |
173 params.database = database; | |
174 params.type = _OrthancPluginDatabaseAnswerType_Int32; | |
175 params.valueInt32 = value; | |
176 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
177 } | |
178 | |
179 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerInt64( | |
180 OrthancPluginContext* context, | |
181 OrthancPluginDatabaseContext* database, | |
182 int64_t value) | |
183 { | |
184 _OrthancPluginDatabaseAnswer params; | |
185 memset(¶ms, 0, sizeof(params)); | |
186 params.database = database; | |
187 params.type = _OrthancPluginDatabaseAnswerType_Int64; | |
188 params.valueInt64 = value; | |
189 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
190 } | |
191 | |
192 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerExportedResource( | |
193 OrthancPluginContext* context, | |
194 OrthancPluginDatabaseContext* database, | |
195 const OrthancPluginExportedResource* exported) | |
196 { | |
197 _OrthancPluginDatabaseAnswer params; | |
198 memset(¶ms, 0, sizeof(params)); | |
199 | |
200 params.database = database; | |
201 params.type = _OrthancPluginDatabaseAnswerType_ExportedResource; | |
202 params.valueUint32 = 0; | |
203 params.valueGeneric = exported; | |
204 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
205 } | |
206 | |
207 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerExportedResourcesDone( | |
208 OrthancPluginContext* context, | |
209 OrthancPluginDatabaseContext* database) | |
210 { | |
211 _OrthancPluginDatabaseAnswer params; | |
212 memset(¶ms, 0, sizeof(params)); | |
213 | |
214 params.database = database; | |
215 params.type = _OrthancPluginDatabaseAnswerType_ExportedResource; | |
216 params.valueUint32 = 1; | |
217 params.valueGeneric = NULL; | |
218 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
219 } | |
220 | |
221 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerDicomTag( | |
222 OrthancPluginContext* context, | |
223 OrthancPluginDatabaseContext* database, | |
224 const OrthancPluginDicomTag* tag) | |
225 { | |
226 _OrthancPluginDatabaseAnswer params; | |
227 memset(¶ms, 0, sizeof(params)); | |
228 params.database = database; | |
229 params.type = _OrthancPluginDatabaseAnswerType_DicomTag; | |
230 params.valueGeneric = tag; | |
231 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
232 } | |
233 | |
234 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerAttachment( | |
235 OrthancPluginContext* context, | |
236 OrthancPluginDatabaseContext* database, | |
237 const OrthancPluginAttachment* attachment) | |
238 { | |
239 _OrthancPluginDatabaseAnswer params; | |
240 memset(¶ms, 0, sizeof(params)); | |
241 params.database = database; | |
242 params.type = _OrthancPluginDatabaseAnswerType_Attachment; | |
243 params.valueGeneric = attachment; | |
244 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
245 } | |
246 | |
247 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseAnswerResource( | |
248 OrthancPluginContext* context, | |
249 OrthancPluginDatabaseContext* database, | |
250 int64_t id, | |
251 OrthancPluginResourceType resourceType) | |
252 { | |
253 _OrthancPluginDatabaseAnswer params; | |
254 memset(¶ms, 0, sizeof(params)); | |
255 params.database = database; | |
256 params.type = _OrthancPluginDatabaseAnswerType_Resource; | |
257 params.valueInt64 = id; | |
258 params.valueInt32 = (int32_t) resourceType; | |
259 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
260 } | |
261 | |
262 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseSignalDeletedAttachment( | |
263 OrthancPluginContext* context, | |
264 OrthancPluginDatabaseContext* database, | |
265 const OrthancPluginAttachment* attachment) | |
266 { | |
267 _OrthancPluginDatabaseAnswer params; | |
268 memset(¶ms, 0, sizeof(params)); | |
269 params.database = database; | |
270 params.type = _OrthancPluginDatabaseAnswerType_DeletedAttachment; | |
271 params.valueGeneric = attachment; | |
272 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
273 } | |
274 | |
275 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseSignalDeletedResource( | |
276 OrthancPluginContext* context, | |
277 OrthancPluginDatabaseContext* database, | |
278 const char* publicId, | |
279 OrthancPluginResourceType resourceType) | |
280 { | |
281 _OrthancPluginDatabaseAnswer params; | |
282 memset(¶ms, 0, sizeof(params)); | |
283 params.database = database; | |
284 params.type = _OrthancPluginDatabaseAnswerType_DeletedResource; | |
285 params.valueString = publicId; | |
286 params.valueInt32 = (int32_t) resourceType; | |
287 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
288 } | |
289 | |
290 ORTHANC_PLUGIN_INLINE void OrthancPluginDatabaseSignalRemainingAncestor( | |
291 OrthancPluginContext* context, | |
292 OrthancPluginDatabaseContext* database, | |
293 const char* ancestorId, | |
294 OrthancPluginResourceType ancestorType) | |
295 { | |
296 _OrthancPluginDatabaseAnswer params; | |
297 memset(¶ms, 0, sizeof(params)); | |
298 params.database = database; | |
299 params.type = _OrthancPluginDatabaseAnswerType_RemainingAncestor; | |
300 params.valueString = ancestorId; | |
301 params.valueInt32 = (int32_t) ancestorType; | |
302 context->InvokeService(context, _OrthancPluginService_DatabaseAnswer, ¶ms); | |
303 } | |
304 | |
305 | |
306 | |
307 | |
308 | |
309 typedef struct | |
310 { | |
311 int32_t (*addAttachment) ( | |
312 /* inputs */ | |
313 void* payload, | |
314 int64_t id, | |
315 const OrthancPluginAttachment* attachment); | |
316 | |
317 int32_t (*attachChild) ( | |
318 /* inputs */ | |
319 void* payload, | |
320 int64_t parent, | |
321 int64_t child); | |
322 | |
323 int32_t (*clearChanges) ( | |
324 /* inputs */ | |
325 void* payload); | |
326 | |
327 int32_t (*clearExportedResources) ( | |
328 /* inputs */ | |
329 void* payload); | |
330 | |
331 int32_t (*createResource) ( | |
332 /* outputs */ | |
333 int64_t* id, | |
334 /* inputs */ | |
335 void* payload, | |
336 const char* publicId, | |
337 OrthancPluginResourceType resourceType); | |
338 | |
339 int32_t (*deleteAttachment) ( | |
340 /* inputs */ | |
341 void* payload, | |
342 int64_t id, | |
343 int32_t contentType); | |
344 | |
345 int32_t (*deleteMetadata) ( | |
346 /* inputs */ | |
347 void* payload, | |
348 int64_t id, | |
349 int32_t metadataType); | |
350 | |
351 int32_t (*deleteResource) ( | |
352 /* inputs */ | |
353 void* payload, | |
354 int64_t id); | |
355 | |
356 /* Output: Use OrthancPluginDatabaseAnswerString() */ | |
357 int32_t (*getAllPublicIds) ( | |
358 /* outputs */ | |
359 OrthancPluginDatabaseContext* context, | |
360 /* inputs */ | |
361 void* payload, | |
362 OrthancPluginResourceType resourceType); | |
363 | |
364 /* Output: Use OrthancPluginDatabaseAnswerChange() and | |
365 * OrthancPluginDatabaseAnswerChangesDone() */ | |
366 int32_t (*getChanges) ( | |
367 /* outputs */ | |
368 OrthancPluginDatabaseContext* context, | |
369 /* inputs */ | |
370 void* payload, | |
371 int64_t since, | |
372 uint32_t maxResult); | |
373 | |
374 /* Output: Use OrthancPluginDatabaseAnswerInt64() */ | |
375 int32_t (*getChildrenInternalId) ( | |
376 /* outputs */ | |
377 OrthancPluginDatabaseContext* context, | |
378 /* inputs */ | |
379 void* payload, | |
380 int64_t id); | |
381 | |
382 /* Output: Use OrthancPluginDatabaseAnswerString() */ | |
383 int32_t (*getChildrenPublicId) ( | |
384 /* outputs */ | |
385 OrthancPluginDatabaseContext* context, | |
386 /* inputs */ | |
387 void* payload, | |
388 int64_t id); | |
389 | |
390 /* Output: Use OrthancPluginDatabaseAnswerExportedResource() and | |
391 * OrthancPluginDatabaseAnswerExportedResourcesDone() */ | |
392 int32_t (*getExportedResources) ( | |
393 /* outputs */ | |
394 OrthancPluginDatabaseContext* context, | |
395 /* inputs */ | |
396 void* payload, | |
397 int64_t since, | |
398 uint32_t maxResult); | |
399 | |
400 /* Output: Use OrthancPluginDatabaseAnswerChange() */ | |
401 int32_t (*getLastChange) ( | |
402 /* outputs */ | |
403 OrthancPluginDatabaseContext* context, | |
404 /* inputs */ | |
405 void* payload); | |
406 | |
407 /* Output: Use OrthancPluginDatabaseAnswerExportedResource() */ | |
408 int32_t (*getLastExportedResource) ( | |
409 /* outputs */ | |
410 OrthancPluginDatabaseContext* context, | |
411 /* inputs */ | |
412 void* payload); | |
413 | |
414 /* Output: Use OrthancPluginDatabaseAnswerDicomTag() */ | |
415 int32_t (*getMainDicomTags) ( | |
416 /* outputs */ | |
417 OrthancPluginDatabaseContext* context, | |
418 /* inputs */ | |
419 void* payload, | |
420 int64_t id); | |
421 | |
422 /* Output: Use OrthancPluginDatabaseAnswerString() */ | |
423 int32_t (*getPublicId) ( | |
424 /* outputs */ | |
425 OrthancPluginDatabaseContext* context, | |
426 /* inputs */ | |
427 void* payload, | |
428 int64_t id); | |
429 | |
430 int32_t (*getResourceCount) ( | |
431 /* outputs */ | |
432 uint64_t* target, | |
433 /* inputs */ | |
434 void* payload, | |
435 OrthancPluginResourceType resourceType); | |
436 | |
437 int32_t (*getResourceType) ( | |
438 /* outputs */ | |
439 OrthancPluginResourceType* resourceType, | |
440 /* inputs */ | |
441 void* payload, | |
442 int64_t id); | |
443 | |
444 int32_t (*getTotalCompressedSize) ( | |
445 /* outputs */ | |
446 uint64_t* target, | |
447 /* inputs */ | |
448 void* payload); | |
449 | |
450 int32_t (*getTotalUncompressedSize) ( | |
451 /* outputs */ | |
452 uint64_t* target, | |
453 /* inputs */ | |
454 void* payload); | |
455 | |
456 int32_t (*isExistingResource) ( | |
457 /* outputs */ | |
458 int32_t* existing, | |
459 /* inputs */ | |
460 void* payload, | |
461 int64_t id); | |
462 | |
463 int32_t (*isProtectedPatient) ( | |
464 /* outputs */ | |
465 int32_t* isProtected, | |
466 /* inputs */ | |
467 void* payload, | |
468 int64_t id); | |
469 | |
470 /* Output: Use OrthancPluginDatabaseAnswerInt32() */ | |
471 int32_t (*listAvailableMetadata) ( | |
472 /* outputs */ | |
473 OrthancPluginDatabaseContext* context, | |
474 /* inputs */ | |
475 void* payload, | |
476 int64_t id); | |
477 | |
478 /* Output: Use OrthancPluginDatabaseAnswerInt32() */ | |
479 int32_t (*listAvailableAttachments) ( | |
480 /* outputs */ | |
481 OrthancPluginDatabaseContext* context, | |
482 /* inputs */ | |
483 void* payload, | |
484 int64_t id); | |
485 | |
486 int32_t (*logChange) ( | |
487 /* inputs */ | |
488 void* payload, | |
489 const OrthancPluginChange* change); | |
490 | |
491 int32_t (*logExportedResource) ( | |
492 /* inputs */ | |
493 void* payload, | |
494 const OrthancPluginExportedResource* exported); | |
495 | |
496 /* Output: Use OrthancPluginDatabaseAnswerAttachment() */ | |
497 int32_t (*lookupAttachment) ( | |
498 /* outputs */ | |
499 OrthancPluginDatabaseContext* context, | |
500 /* inputs */ | |
501 void* payload, | |
502 int64_t id, | |
503 int32_t contentType); | |
504 | |
505 /* Output: Use OrthancPluginDatabaseAnswerString() */ | |
506 int32_t (*lookupGlobalProperty) ( | |
507 /* outputs */ | |
508 OrthancPluginDatabaseContext* context, | |
509 /* inputs */ | |
510 void* payload, | |
511 int32_t property); | |
512 | |
513 /* Output: Use OrthancPluginDatabaseAnswerInt64() */ | |
514 int32_t (*lookupIdentifier) ( | |
515 /* outputs */ | |
516 OrthancPluginDatabaseContext* context, | |
517 /* inputs */ | |
518 void* payload, | |
519 const OrthancPluginDicomTag* tag); | |
520 | |
521 /* Output: Use OrthancPluginDatabaseAnswerInt64() */ | |
522 int32_t (*lookupIdentifier2) ( | |
523 /* outputs */ | |
524 OrthancPluginDatabaseContext* context, | |
525 /* inputs */ | |
526 void* payload, | |
527 const char* value); | |
528 | |
529 /* Output: Use OrthancPluginDatabaseAnswerString() */ | |
530 int32_t (*lookupMetadata) ( | |
531 /* outputs */ | |
532 OrthancPluginDatabaseContext* context, | |
533 /* inputs */ | |
534 void* payload, | |
535 int64_t id, | |
536 int32_t metadata); | |
537 | |
538 /* Output: Use OrthancPluginDatabaseAnswerInt64() */ | |
539 int32_t (*lookupParent) ( | |
540 /* outputs */ | |
541 OrthancPluginDatabaseContext* context, | |
542 /* inputs */ | |
543 void* payload, | |
544 int64_t id); | |
545 | |
546 /* Output: Use OrthancPluginDatabaseAnswerResource() */ | |
547 int32_t (*lookupResource) ( | |
548 /* outputs */ | |
549 OrthancPluginDatabaseContext* context, | |
550 /* inputs */ | |
551 void* payload, | |
552 const char* publicId); | |
553 | |
554 /* Output: Use OrthancPluginDatabaseAnswerInt64() */ | |
555 int32_t (*selectPatientToRecycle) ( | |
556 /* outputs */ | |
557 OrthancPluginDatabaseContext* context, | |
558 /* inputs */ | |
559 void* payload); | |
560 | |
561 /* Output: Use OrthancPluginDatabaseAnswerInt64() */ | |
562 int32_t (*selectPatientToRecycle2) ( | |
563 /* outputs */ | |
564 OrthancPluginDatabaseContext* context, | |
565 /* inputs */ | |
566 void* payload, | |
567 int64_t patientIdToAvoid); | |
568 | |
569 int32_t (*setGlobalProperty) ( | |
570 /* inputs */ | |
571 void* payload, | |
572 int32_t property, | |
573 const char* value); | |
574 | |
575 int32_t (*setMainDicomTag) ( | |
576 /* inputs */ | |
577 void* payload, | |
578 int64_t id, | |
579 const OrthancPluginDicomTag* tag); | |
580 | |
581 int32_t (*setIdentifierTag) ( | |
582 /* inputs */ | |
583 void* payload, | |
584 int64_t id, | |
585 const OrthancPluginDicomTag* tag); | |
586 | |
587 int32_t (*setMetadata) ( | |
588 /* inputs */ | |
589 void* payload, | |
590 int64_t id, | |
591 int32_t metadata, | |
592 const char* value); | |
593 | |
594 int32_t (*setProtectedPatient) ( | |
595 /* inputs */ | |
596 void* payload, | |
597 int64_t id, | |
598 int32_t isProtected); | |
599 | |
600 int32_t (*startTransaction) ( | |
601 /* inputs */ | |
602 void* payload); | |
603 | |
604 int32_t (*rollbackTransaction) ( | |
605 /* inputs */ | |
606 void* payload); | |
607 | |
608 int32_t (*commitTransaction) ( | |
609 /* inputs */ | |
610 void* payload); | |
611 | |
612 int32_t (*open) ( | |
613 /* inputs */ | |
614 void* payload); | |
615 | |
616 int32_t (*close) ( | |
617 /* inputs */ | |
618 void* payload); | |
619 | |
620 } OrthancPluginDatabaseBackend; | |
621 | |
622 | |
623 | |
624 typedef struct | |
625 { | |
626 OrthancPluginDatabaseContext** result; | |
627 const OrthancPluginDatabaseBackend* backend; | |
628 void* payload; | |
629 } _OrthancPluginRegisterDatabaseBackend; | |
630 | |
631 ORTHANC_PLUGIN_INLINE OrthancPluginDatabaseContext* OrthancPluginRegisterDatabaseBackend( | |
632 OrthancPluginContext* context, | |
633 const OrthancPluginDatabaseBackend* backend, | |
634 void* payload) | |
635 { | |
636 OrthancPluginDatabaseContext* result = NULL; | |
637 | |
638 _OrthancPluginRegisterDatabaseBackend params; | |
639 memset(¶ms, 0, sizeof(params)); | |
640 params.backend = backend; | |
641 params.result = &result; | |
642 params.payload = payload; | |
643 | |
644 if (context->InvokeService(context, _OrthancPluginService_RegisterDatabaseBackend, ¶ms) || | |
645 result == NULL) | |
646 { | |
647 /* Error */ | |
648 return NULL; | |
649 } | |
650 else | |
651 { | |
652 return result; | |
653 } | |
654 } | |
655 | |
656 | |
657 | |
658 #ifdef __cplusplus | |
659 } | |
660 #endif | |
661 | |
662 | |
663 /** @} */ | |
664 |