comparison Plugin/NativeSDK.cpp @ 0:3ecef5782f2c

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Oct 2023 17:59:44 +0200
parents
children c8f19e93ff99
comparison
equal deleted inserted replaced
-1:000000000000 0:3ecef5782f2c
1 /**
2 * SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
3 * SPDX-License-Identifier: GPL-3.0-or-later
4 */
5
6 /**
7 * Java plugin for Orthanc
8 * Copyright (C) 2023 Sebastien Jodogne, UCLouvain, 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 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 **/
23
24
25
26 JNIEXPORT jint JNI_OrthancPluginCheckVersionAdvanced(JNIEnv* env, jobject sdkObject, jint arg0, jint arg1, jint arg2)
27 {
28 try
29 {
30 return OrthancPluginCheckVersionAdvanced(context_
31 , arg0, arg1, arg2);
32 }
33 catch (std::runtime_error& e)
34 {
35 JavaEnvironment::ThrowException(env, e.what());
36 return 0;
37 }
38 catch (...)
39 {
40 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
41 return 0;
42 }
43 }
44
45
46 JNIEXPORT jint JNI_OrthancPluginCheckVersion(JNIEnv* env, jobject sdkObject)
47 {
48 try
49 {
50 return OrthancPluginCheckVersion(context_
51 );
52 }
53 catch (std::runtime_error& e)
54 {
55 JavaEnvironment::ThrowException(env, e.what());
56 return 0;
57 }
58 catch (...)
59 {
60 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
61 return 0;
62 }
63 }
64
65
66 JNIEXPORT void JNI_OrthancPluginLogError(JNIEnv* env, jobject sdkObject, jstring arg0)
67 {
68 try
69 {
70 JavaString c_arg0(env, arg0);
71 OrthancPluginLogError(context_
72 , c_arg0.GetValue());
73 }
74 catch (std::runtime_error& e)
75 {
76 JavaEnvironment::ThrowException(env, e.what());
77 }
78 catch (...)
79 {
80 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
81 }
82 }
83
84
85 JNIEXPORT void JNI_OrthancPluginLogWarning(JNIEnv* env, jobject sdkObject, jstring arg0)
86 {
87 try
88 {
89 JavaString c_arg0(env, arg0);
90 OrthancPluginLogWarning(context_
91 , c_arg0.GetValue());
92 }
93 catch (std::runtime_error& e)
94 {
95 JavaEnvironment::ThrowException(env, e.what());
96 }
97 catch (...)
98 {
99 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
100 }
101 }
102
103
104 JNIEXPORT void JNI_OrthancPluginLogInfo(JNIEnv* env, jobject sdkObject, jstring arg0)
105 {
106 try
107 {
108 JavaString c_arg0(env, arg0);
109 OrthancPluginLogInfo(context_
110 , c_arg0.GetValue());
111 }
112 catch (std::runtime_error& e)
113 {
114 JavaEnvironment::ThrowException(env, e.what());
115 }
116 catch (...)
117 {
118 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
119 }
120 }
121
122
123 JNIEXPORT jbyteArray JNI_OrthancPluginGetDicomForInstance(JNIEnv* env, jobject sdkObject, jstring arg0)
124 {
125 try
126 {
127 JavaString c_arg0(env, arg0);
128 OrthancBytes b;
129 OrthancPluginErrorCode code = OrthancPluginGetDicomForInstance(context_, b.GetMemoryBuffer()
130 , c_arg0.GetValue());
131 if (code == OrthancPluginErrorCode_Success)
132 {
133 jbyteArray answer = env->NewByteArray(b.GetSize());
134 if (answer == NULL)
135 {
136 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
137 return NULL;
138 }
139 else
140 {
141 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
142 return answer;
143 }
144 }
145 else
146 {
147 JavaEnvironment::ThrowException(env, code);
148 return NULL;
149 }
150 }
151 catch (std::runtime_error& e)
152 {
153 JavaEnvironment::ThrowException(env, e.what());
154 return NULL;
155 }
156 catch (...)
157 {
158 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
159 return NULL;
160 }
161 }
162
163
164 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiGet(JNIEnv* env, jobject sdkObject, jstring arg0)
165 {
166 try
167 {
168 JavaString c_arg0(env, arg0);
169 OrthancBytes b;
170 OrthancPluginErrorCode code = OrthancPluginRestApiGet(context_, b.GetMemoryBuffer()
171 , c_arg0.GetValue());
172 if (code == OrthancPluginErrorCode_Success)
173 {
174 jbyteArray answer = env->NewByteArray(b.GetSize());
175 if (answer == NULL)
176 {
177 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
178 return NULL;
179 }
180 else
181 {
182 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
183 return answer;
184 }
185 }
186 else
187 {
188 JavaEnvironment::ThrowException(env, code);
189 return NULL;
190 }
191 }
192 catch (std::runtime_error& e)
193 {
194 JavaEnvironment::ThrowException(env, e.what());
195 return NULL;
196 }
197 catch (...)
198 {
199 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
200 return NULL;
201 }
202 }
203
204
205 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiGetAfterPlugins(JNIEnv* env, jobject sdkObject, jstring arg0)
206 {
207 try
208 {
209 JavaString c_arg0(env, arg0);
210 OrthancBytes b;
211 OrthancPluginErrorCode code = OrthancPluginRestApiGetAfterPlugins(context_, b.GetMemoryBuffer()
212 , c_arg0.GetValue());
213 if (code == OrthancPluginErrorCode_Success)
214 {
215 jbyteArray answer = env->NewByteArray(b.GetSize());
216 if (answer == NULL)
217 {
218 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
219 return NULL;
220 }
221 else
222 {
223 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
224 return answer;
225 }
226 }
227 else
228 {
229 JavaEnvironment::ThrowException(env, code);
230 return NULL;
231 }
232 }
233 catch (std::runtime_error& e)
234 {
235 JavaEnvironment::ThrowException(env, e.what());
236 return NULL;
237 }
238 catch (...)
239 {
240 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
241 return NULL;
242 }
243 }
244
245
246 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiPost(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1)
247 {
248 try
249 {
250 JavaString c_arg0(env, arg0);
251 JavaBytes c_arg1(env, arg1);
252 OrthancBytes b;
253 OrthancPluginErrorCode code = OrthancPluginRestApiPost(context_, b.GetMemoryBuffer()
254 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize());
255 if (code == OrthancPluginErrorCode_Success)
256 {
257 jbyteArray answer = env->NewByteArray(b.GetSize());
258 if (answer == NULL)
259 {
260 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
261 return NULL;
262 }
263 else
264 {
265 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
266 return answer;
267 }
268 }
269 else
270 {
271 JavaEnvironment::ThrowException(env, code);
272 return NULL;
273 }
274 }
275 catch (std::runtime_error& e)
276 {
277 JavaEnvironment::ThrowException(env, e.what());
278 return NULL;
279 }
280 catch (...)
281 {
282 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
283 return NULL;
284 }
285 }
286
287
288 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiPostAfterPlugins(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1)
289 {
290 try
291 {
292 JavaString c_arg0(env, arg0);
293 JavaBytes c_arg1(env, arg1);
294 OrthancBytes b;
295 OrthancPluginErrorCode code = OrthancPluginRestApiPostAfterPlugins(context_, b.GetMemoryBuffer()
296 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize());
297 if (code == OrthancPluginErrorCode_Success)
298 {
299 jbyteArray answer = env->NewByteArray(b.GetSize());
300 if (answer == NULL)
301 {
302 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
303 return NULL;
304 }
305 else
306 {
307 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
308 return answer;
309 }
310 }
311 else
312 {
313 JavaEnvironment::ThrowException(env, code);
314 return NULL;
315 }
316 }
317 catch (std::runtime_error& e)
318 {
319 JavaEnvironment::ThrowException(env, e.what());
320 return NULL;
321 }
322 catch (...)
323 {
324 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
325 return NULL;
326 }
327 }
328
329
330 JNIEXPORT void JNI_OrthancPluginRestApiDelete(JNIEnv* env, jobject sdkObject, jstring arg0)
331 {
332 try
333 {
334 JavaString c_arg0(env, arg0);
335 OrthancPluginErrorCode code = OrthancPluginRestApiDelete(context_
336 , c_arg0.GetValue());
337 if (code != OrthancPluginErrorCode_Success)
338 {
339 JavaEnvironment::ThrowException(env, code);
340 }
341 }
342 catch (std::runtime_error& e)
343 {
344 JavaEnvironment::ThrowException(env, e.what());
345 }
346 catch (...)
347 {
348 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
349 }
350 }
351
352
353 JNIEXPORT void JNI_OrthancPluginRestApiDeleteAfterPlugins(JNIEnv* env, jobject sdkObject, jstring arg0)
354 {
355 try
356 {
357 JavaString c_arg0(env, arg0);
358 OrthancPluginErrorCode code = OrthancPluginRestApiDeleteAfterPlugins(context_
359 , c_arg0.GetValue());
360 if (code != OrthancPluginErrorCode_Success)
361 {
362 JavaEnvironment::ThrowException(env, code);
363 }
364 }
365 catch (std::runtime_error& e)
366 {
367 JavaEnvironment::ThrowException(env, e.what());
368 }
369 catch (...)
370 {
371 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
372 }
373 }
374
375
376 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiPut(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1)
377 {
378 try
379 {
380 JavaString c_arg0(env, arg0);
381 JavaBytes c_arg1(env, arg1);
382 OrthancBytes b;
383 OrthancPluginErrorCode code = OrthancPluginRestApiPut(context_, b.GetMemoryBuffer()
384 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize());
385 if (code == OrthancPluginErrorCode_Success)
386 {
387 jbyteArray answer = env->NewByteArray(b.GetSize());
388 if (answer == NULL)
389 {
390 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
391 return NULL;
392 }
393 else
394 {
395 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
396 return answer;
397 }
398 }
399 else
400 {
401 JavaEnvironment::ThrowException(env, code);
402 return NULL;
403 }
404 }
405 catch (std::runtime_error& e)
406 {
407 JavaEnvironment::ThrowException(env, e.what());
408 return NULL;
409 }
410 catch (...)
411 {
412 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
413 return NULL;
414 }
415 }
416
417
418 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiPutAfterPlugins(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1)
419 {
420 try
421 {
422 JavaString c_arg0(env, arg0);
423 JavaBytes c_arg1(env, arg1);
424 OrthancBytes b;
425 OrthancPluginErrorCode code = OrthancPluginRestApiPutAfterPlugins(context_, b.GetMemoryBuffer()
426 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize());
427 if (code == OrthancPluginErrorCode_Success)
428 {
429 jbyteArray answer = env->NewByteArray(b.GetSize());
430 if (answer == NULL)
431 {
432 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
433 return NULL;
434 }
435 else
436 {
437 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
438 return answer;
439 }
440 }
441 else
442 {
443 JavaEnvironment::ThrowException(env, code);
444 return NULL;
445 }
446 }
447 catch (std::runtime_error& e)
448 {
449 JavaEnvironment::ThrowException(env, e.what());
450 return NULL;
451 }
452 catch (...)
453 {
454 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
455 return NULL;
456 }
457 }
458
459
460 JNIEXPORT jstring JNI_OrthancPluginLookupPatient(JNIEnv* env, jobject sdkObject, jstring arg0)
461 {
462 try
463 {
464 JavaString c_arg0(env, arg0);
465 OrthancString s(OrthancPluginLookupPatient(context_
466 , c_arg0.GetValue()));
467 if (s.GetValue() == NULL)
468 {
469 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
470 return NULL;
471 }
472 else
473 {
474 jstring t = env->NewStringUTF(s.GetValue());
475 if (t == NULL)
476 {
477 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
478 return NULL;
479 }
480 else
481 {
482 return t;
483 }
484 }
485 }
486 catch (std::runtime_error& e)
487 {
488 JavaEnvironment::ThrowException(env, e.what());
489 return NULL;
490 }
491 catch (...)
492 {
493 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
494 return NULL;
495 }
496 }
497
498
499 JNIEXPORT jstring JNI_OrthancPluginLookupStudy(JNIEnv* env, jobject sdkObject, jstring arg0)
500 {
501 try
502 {
503 JavaString c_arg0(env, arg0);
504 OrthancString s(OrthancPluginLookupStudy(context_
505 , c_arg0.GetValue()));
506 if (s.GetValue() == NULL)
507 {
508 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
509 return NULL;
510 }
511 else
512 {
513 jstring t = env->NewStringUTF(s.GetValue());
514 if (t == NULL)
515 {
516 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
517 return NULL;
518 }
519 else
520 {
521 return t;
522 }
523 }
524 }
525 catch (std::runtime_error& e)
526 {
527 JavaEnvironment::ThrowException(env, e.what());
528 return NULL;
529 }
530 catch (...)
531 {
532 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
533 return NULL;
534 }
535 }
536
537
538 JNIEXPORT jstring JNI_OrthancPluginLookupStudyWithAccessionNumber(JNIEnv* env, jobject sdkObject, jstring arg0)
539 {
540 try
541 {
542 JavaString c_arg0(env, arg0);
543 OrthancString s(OrthancPluginLookupStudyWithAccessionNumber(context_
544 , c_arg0.GetValue()));
545 if (s.GetValue() == NULL)
546 {
547 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
548 return NULL;
549 }
550 else
551 {
552 jstring t = env->NewStringUTF(s.GetValue());
553 if (t == NULL)
554 {
555 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
556 return NULL;
557 }
558 else
559 {
560 return t;
561 }
562 }
563 }
564 catch (std::runtime_error& e)
565 {
566 JavaEnvironment::ThrowException(env, e.what());
567 return NULL;
568 }
569 catch (...)
570 {
571 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
572 return NULL;
573 }
574 }
575
576
577 JNIEXPORT jstring JNI_OrthancPluginLookupSeries(JNIEnv* env, jobject sdkObject, jstring arg0)
578 {
579 try
580 {
581 JavaString c_arg0(env, arg0);
582 OrthancString s(OrthancPluginLookupSeries(context_
583 , c_arg0.GetValue()));
584 if (s.GetValue() == NULL)
585 {
586 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
587 return NULL;
588 }
589 else
590 {
591 jstring t = env->NewStringUTF(s.GetValue());
592 if (t == NULL)
593 {
594 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
595 return NULL;
596 }
597 else
598 {
599 return t;
600 }
601 }
602 }
603 catch (std::runtime_error& e)
604 {
605 JavaEnvironment::ThrowException(env, e.what());
606 return NULL;
607 }
608 catch (...)
609 {
610 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
611 return NULL;
612 }
613 }
614
615
616 JNIEXPORT jstring JNI_OrthancPluginLookupInstance(JNIEnv* env, jobject sdkObject, jstring arg0)
617 {
618 try
619 {
620 JavaString c_arg0(env, arg0);
621 OrthancString s(OrthancPluginLookupInstance(context_
622 , c_arg0.GetValue()));
623 if (s.GetValue() == NULL)
624 {
625 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
626 return NULL;
627 }
628 else
629 {
630 jstring t = env->NewStringUTF(s.GetValue());
631 if (t == NULL)
632 {
633 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
634 return NULL;
635 }
636 else
637 {
638 return t;
639 }
640 }
641 }
642 catch (std::runtime_error& e)
643 {
644 JavaEnvironment::ThrowException(env, e.what());
645 return NULL;
646 }
647 catch (...)
648 {
649 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
650 return NULL;
651 }
652 }
653
654
655 JNIEXPORT jstring JNI_OrthancPluginGetOrthancPath(JNIEnv* env, jobject sdkObject)
656 {
657 try
658 {
659 OrthancString s(OrthancPluginGetOrthancPath(context_
660 ));
661 if (s.GetValue() == NULL)
662 {
663 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
664 return NULL;
665 }
666 else
667 {
668 jstring t = env->NewStringUTF(s.GetValue());
669 if (t == NULL)
670 {
671 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
672 return NULL;
673 }
674 else
675 {
676 return t;
677 }
678 }
679 }
680 catch (std::runtime_error& e)
681 {
682 JavaEnvironment::ThrowException(env, e.what());
683 return NULL;
684 }
685 catch (...)
686 {
687 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
688 return NULL;
689 }
690 }
691
692
693 JNIEXPORT jstring JNI_OrthancPluginGetOrthancDirectory(JNIEnv* env, jobject sdkObject)
694 {
695 try
696 {
697 OrthancString s(OrthancPluginGetOrthancDirectory(context_
698 ));
699 if (s.GetValue() == NULL)
700 {
701 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
702 return NULL;
703 }
704 else
705 {
706 jstring t = env->NewStringUTF(s.GetValue());
707 if (t == NULL)
708 {
709 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
710 return NULL;
711 }
712 else
713 {
714 return t;
715 }
716 }
717 }
718 catch (std::runtime_error& e)
719 {
720 JavaEnvironment::ThrowException(env, e.what());
721 return NULL;
722 }
723 catch (...)
724 {
725 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
726 return NULL;
727 }
728 }
729
730
731 JNIEXPORT jstring JNI_OrthancPluginGetConfigurationPath(JNIEnv* env, jobject sdkObject)
732 {
733 try
734 {
735 OrthancString s(OrthancPluginGetConfigurationPath(context_
736 ));
737 if (s.GetValue() == NULL)
738 {
739 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
740 return NULL;
741 }
742 else
743 {
744 jstring t = env->NewStringUTF(s.GetValue());
745 if (t == NULL)
746 {
747 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
748 return NULL;
749 }
750 else
751 {
752 return t;
753 }
754 }
755 }
756 catch (std::runtime_error& e)
757 {
758 JavaEnvironment::ThrowException(env, e.what());
759 return NULL;
760 }
761 catch (...)
762 {
763 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
764 return NULL;
765 }
766 }
767
768
769 JNIEXPORT void JNI_OrthancPluginSetRootUri(JNIEnv* env, jobject sdkObject, jstring arg0)
770 {
771 try
772 {
773 JavaString c_arg0(env, arg0);
774 OrthancPluginSetRootUri(context_
775 , c_arg0.GetValue());
776 }
777 catch (std::runtime_error& e)
778 {
779 JavaEnvironment::ThrowException(env, e.what());
780 }
781 catch (...)
782 {
783 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
784 }
785 }
786
787
788 JNIEXPORT void JNI_OrthancPluginSetDescription(JNIEnv* env, jobject sdkObject, jstring arg0)
789 {
790 try
791 {
792 JavaString c_arg0(env, arg0);
793 OrthancPluginSetDescription(context_
794 , c_arg0.GetValue());
795 }
796 catch (std::runtime_error& e)
797 {
798 JavaEnvironment::ThrowException(env, e.what());
799 }
800 catch (...)
801 {
802 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
803 }
804 }
805
806
807 JNIEXPORT void JNI_OrthancPluginExtendOrthancExplorer(JNIEnv* env, jobject sdkObject, jstring arg0)
808 {
809 try
810 {
811 JavaString c_arg0(env, arg0);
812 OrthancPluginExtendOrthancExplorer(context_
813 , c_arg0.GetValue());
814 }
815 catch (std::runtime_error& e)
816 {
817 JavaEnvironment::ThrowException(env, e.what());
818 }
819 catch (...)
820 {
821 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
822 }
823 }
824
825
826 JNIEXPORT jstring JNI_OrthancPluginGetGlobalProperty(JNIEnv* env, jobject sdkObject, jint arg0, jstring arg1)
827 {
828 try
829 {
830 JavaString c_arg1(env, arg1);
831 OrthancString s(OrthancPluginGetGlobalProperty(context_
832 , arg0, c_arg1.GetValue()));
833 if (s.GetValue() == NULL)
834 {
835 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
836 return NULL;
837 }
838 else
839 {
840 jstring t = env->NewStringUTF(s.GetValue());
841 if (t == NULL)
842 {
843 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
844 return NULL;
845 }
846 else
847 {
848 return t;
849 }
850 }
851 }
852 catch (std::runtime_error& e)
853 {
854 JavaEnvironment::ThrowException(env, e.what());
855 return NULL;
856 }
857 catch (...)
858 {
859 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
860 return NULL;
861 }
862 }
863
864
865 JNIEXPORT void JNI_OrthancPluginSetGlobalProperty(JNIEnv* env, jobject sdkObject, jint arg0, jstring arg1)
866 {
867 try
868 {
869 JavaString c_arg1(env, arg1);
870 OrthancPluginErrorCode code = OrthancPluginSetGlobalProperty(context_
871 , arg0, c_arg1.GetValue());
872 if (code != OrthancPluginErrorCode_Success)
873 {
874 JavaEnvironment::ThrowException(env, code);
875 }
876 }
877 catch (std::runtime_error& e)
878 {
879 JavaEnvironment::ThrowException(env, e.what());
880 }
881 catch (...)
882 {
883 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
884 }
885 }
886
887
888 JNIEXPORT jint JNI_OrthancPluginGetCommandLineArgumentsCount(JNIEnv* env, jobject sdkObject)
889 {
890 try
891 {
892 return OrthancPluginGetCommandLineArgumentsCount(context_
893 );
894 }
895 catch (std::runtime_error& e)
896 {
897 JavaEnvironment::ThrowException(env, e.what());
898 return 0;
899 }
900 catch (...)
901 {
902 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
903 return 0;
904 }
905 }
906
907
908 JNIEXPORT jstring JNI_OrthancPluginGetCommandLineArgument(JNIEnv* env, jobject sdkObject, jint arg0)
909 {
910 try
911 {
912 OrthancString s(OrthancPluginGetCommandLineArgument(context_
913 , arg0));
914 if (s.GetValue() == NULL)
915 {
916 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
917 return NULL;
918 }
919 else
920 {
921 jstring t = env->NewStringUTF(s.GetValue());
922 if (t == NULL)
923 {
924 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
925 return NULL;
926 }
927 else
928 {
929 return t;
930 }
931 }
932 }
933 catch (std::runtime_error& e)
934 {
935 JavaEnvironment::ThrowException(env, e.what());
936 return NULL;
937 }
938 catch (...)
939 {
940 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
941 return NULL;
942 }
943 }
944
945
946 JNIEXPORT jint JNI_OrthancPluginGetExpectedDatabaseVersion(JNIEnv* env, jobject sdkObject)
947 {
948 try
949 {
950 return OrthancPluginGetExpectedDatabaseVersion(context_
951 );
952 }
953 catch (std::runtime_error& e)
954 {
955 JavaEnvironment::ThrowException(env, e.what());
956 return 0;
957 }
958 catch (...)
959 {
960 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
961 return 0;
962 }
963 }
964
965
966 JNIEXPORT jstring JNI_OrthancPluginGetConfiguration(JNIEnv* env, jobject sdkObject)
967 {
968 try
969 {
970 OrthancString s(OrthancPluginGetConfiguration(context_
971 ));
972 if (s.GetValue() == NULL)
973 {
974 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
975 return NULL;
976 }
977 else
978 {
979 jstring t = env->NewStringUTF(s.GetValue());
980 if (t == NULL)
981 {
982 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
983 return NULL;
984 }
985 else
986 {
987 return t;
988 }
989 }
990 }
991 catch (std::runtime_error& e)
992 {
993 JavaEnvironment::ThrowException(env, e.what());
994 return NULL;
995 }
996 catch (...)
997 {
998 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
999 return NULL;
1000 }
1001 }
1002
1003
1004 JNIEXPORT jbyteArray JNI_OrthancPluginBufferCompression(JNIEnv* env, jobject sdkObject, jbyteArray arg0, jint arg2, jbyte arg3)
1005 {
1006 try
1007 {
1008 JavaBytes c_arg0(env, arg0);
1009 OrthancBytes b;
1010 OrthancPluginErrorCode code = OrthancPluginBufferCompression(context_, b.GetMemoryBuffer()
1011 , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginCompressionType>(arg2), arg3);
1012 if (code == OrthancPluginErrorCode_Success)
1013 {
1014 jbyteArray answer = env->NewByteArray(b.GetSize());
1015 if (answer == NULL)
1016 {
1017 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1018 return NULL;
1019 }
1020 else
1021 {
1022 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1023 return answer;
1024 }
1025 }
1026 else
1027 {
1028 JavaEnvironment::ThrowException(env, code);
1029 return NULL;
1030 }
1031 }
1032 catch (std::runtime_error& e)
1033 {
1034 JavaEnvironment::ThrowException(env, e.what());
1035 return NULL;
1036 }
1037 catch (...)
1038 {
1039 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1040 return NULL;
1041 }
1042 }
1043
1044
1045 JNIEXPORT jbyteArray JNI_OrthancPluginReadFile(JNIEnv* env, jobject sdkObject, jstring arg0)
1046 {
1047 try
1048 {
1049 JavaString c_arg0(env, arg0);
1050 OrthancBytes b;
1051 OrthancPluginErrorCode code = OrthancPluginReadFile(context_, b.GetMemoryBuffer()
1052 , c_arg0.GetValue());
1053 if (code == OrthancPluginErrorCode_Success)
1054 {
1055 jbyteArray answer = env->NewByteArray(b.GetSize());
1056 if (answer == NULL)
1057 {
1058 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1059 return NULL;
1060 }
1061 else
1062 {
1063 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1064 return answer;
1065 }
1066 }
1067 else
1068 {
1069 JavaEnvironment::ThrowException(env, code);
1070 return NULL;
1071 }
1072 }
1073 catch (std::runtime_error& e)
1074 {
1075 JavaEnvironment::ThrowException(env, e.what());
1076 return NULL;
1077 }
1078 catch (...)
1079 {
1080 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1081 return NULL;
1082 }
1083 }
1084
1085
1086 JNIEXPORT void JNI_OrthancPluginWriteFile(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1)
1087 {
1088 try
1089 {
1090 JavaString c_arg0(env, arg0);
1091 JavaBytes c_arg1(env, arg1);
1092 OrthancPluginErrorCode code = OrthancPluginWriteFile(context_
1093 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize());
1094 if (code != OrthancPluginErrorCode_Success)
1095 {
1096 JavaEnvironment::ThrowException(env, code);
1097 }
1098 }
1099 catch (std::runtime_error& e)
1100 {
1101 JavaEnvironment::ThrowException(env, e.what());
1102 }
1103 catch (...)
1104 {
1105 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1106 }
1107 }
1108
1109
1110 JNIEXPORT jstring JNI_OrthancPluginGetErrorDescription(JNIEnv* env, jobject sdkObject, jint arg0)
1111 {
1112 try
1113 {
1114 const char* s = OrthancPluginGetErrorDescription(context_
1115 , static_cast<OrthancPluginErrorCode>(arg0));
1116 if (s == NULL)
1117 {
1118 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1119 return NULL;
1120 }
1121 else
1122 {
1123 return env->NewStringUTF(s);
1124 }
1125 }
1126 catch (std::runtime_error& e)
1127 {
1128 JavaEnvironment::ThrowException(env, e.what());
1129 return NULL;
1130 }
1131 catch (...)
1132 {
1133 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1134 return NULL;
1135 }
1136 }
1137
1138
1139 JNIEXPORT jlong JNI_OrthancPluginUncompressImage(JNIEnv* env, jobject sdkObject, jbyteArray arg0, jint arg2)
1140 {
1141 try
1142 {
1143 JavaBytes c_arg0(env, arg0);
1144 OrthancPluginImage* answer = OrthancPluginUncompressImage(context_
1145 , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginImageFormat>(arg2));
1146 if (answer == NULL)
1147 {
1148 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1149 return 0;
1150 }
1151 else
1152 {
1153 return reinterpret_cast<intptr_t>(answer);
1154 }
1155 }
1156 catch (std::runtime_error& e)
1157 {
1158 JavaEnvironment::ThrowException(env, e.what());
1159 return 0;
1160 }
1161 catch (...)
1162 {
1163 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1164 return 0;
1165 }
1166 }
1167
1168
1169 JNIEXPORT jbyteArray JNI_OrthancPluginCompressPngImage(JNIEnv* env, jobject sdkObject, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4)
1170 {
1171 try
1172 {
1173 JavaBytes c_arg4(env, arg4);
1174 OrthancBytes b;
1175 OrthancPluginErrorCode code = OrthancPluginCompressPngImage(context_, b.GetMemoryBuffer()
1176 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData());
1177 if (code == OrthancPluginErrorCode_Success)
1178 {
1179 jbyteArray answer = env->NewByteArray(b.GetSize());
1180 if (answer == NULL)
1181 {
1182 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1183 return NULL;
1184 }
1185 else
1186 {
1187 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1188 return answer;
1189 }
1190 }
1191 else
1192 {
1193 JavaEnvironment::ThrowException(env, code);
1194 return NULL;
1195 }
1196 }
1197 catch (std::runtime_error& e)
1198 {
1199 JavaEnvironment::ThrowException(env, e.what());
1200 return NULL;
1201 }
1202 catch (...)
1203 {
1204 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1205 return NULL;
1206 }
1207 }
1208
1209
1210 JNIEXPORT jbyteArray JNI_OrthancPluginCompressJpegImage(JNIEnv* env, jobject sdkObject, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4, jbyte arg5)
1211 {
1212 try
1213 {
1214 JavaBytes c_arg4(env, arg4);
1215 OrthancBytes b;
1216 OrthancPluginErrorCode code = OrthancPluginCompressJpegImage(context_, b.GetMemoryBuffer()
1217 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData(), arg5);
1218 if (code == OrthancPluginErrorCode_Success)
1219 {
1220 jbyteArray answer = env->NewByteArray(b.GetSize());
1221 if (answer == NULL)
1222 {
1223 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1224 return NULL;
1225 }
1226 else
1227 {
1228 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1229 return answer;
1230 }
1231 }
1232 else
1233 {
1234 JavaEnvironment::ThrowException(env, code);
1235 return NULL;
1236 }
1237 }
1238 catch (std::runtime_error& e)
1239 {
1240 JavaEnvironment::ThrowException(env, e.what());
1241 return NULL;
1242 }
1243 catch (...)
1244 {
1245 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1246 return NULL;
1247 }
1248 }
1249
1250
1251 JNIEXPORT jbyteArray JNI_OrthancPluginHttpGet(JNIEnv* env, jobject sdkObject, jstring arg0, jstring arg1, jstring arg2)
1252 {
1253 try
1254 {
1255 JavaString c_arg0(env, arg0);
1256 JavaString c_arg1(env, arg1);
1257 JavaString c_arg2(env, arg2);
1258 OrthancBytes b;
1259 OrthancPluginErrorCode code = OrthancPluginHttpGet(context_, b.GetMemoryBuffer()
1260 , c_arg0.GetValue(), c_arg1.GetValue(), c_arg2.GetValue());
1261 if (code == OrthancPluginErrorCode_Success)
1262 {
1263 jbyteArray answer = env->NewByteArray(b.GetSize());
1264 if (answer == NULL)
1265 {
1266 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1267 return NULL;
1268 }
1269 else
1270 {
1271 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1272 return answer;
1273 }
1274 }
1275 else
1276 {
1277 JavaEnvironment::ThrowException(env, code);
1278 return NULL;
1279 }
1280 }
1281 catch (std::runtime_error& e)
1282 {
1283 JavaEnvironment::ThrowException(env, e.what());
1284 return NULL;
1285 }
1286 catch (...)
1287 {
1288 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1289 return NULL;
1290 }
1291 }
1292
1293
1294 JNIEXPORT jbyteArray JNI_OrthancPluginHttpPost(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1, jstring arg3, jstring arg4)
1295 {
1296 try
1297 {
1298 JavaString c_arg0(env, arg0);
1299 JavaBytes c_arg1(env, arg1);
1300 JavaString c_arg3(env, arg3);
1301 JavaString c_arg4(env, arg4);
1302 OrthancBytes b;
1303 OrthancPluginErrorCode code = OrthancPluginHttpPost(context_, b.GetMemoryBuffer()
1304 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize(), c_arg3.GetValue(), c_arg4.GetValue());
1305 if (code == OrthancPluginErrorCode_Success)
1306 {
1307 jbyteArray answer = env->NewByteArray(b.GetSize());
1308 if (answer == NULL)
1309 {
1310 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1311 return NULL;
1312 }
1313 else
1314 {
1315 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1316 return answer;
1317 }
1318 }
1319 else
1320 {
1321 JavaEnvironment::ThrowException(env, code);
1322 return NULL;
1323 }
1324 }
1325 catch (std::runtime_error& e)
1326 {
1327 JavaEnvironment::ThrowException(env, e.what());
1328 return NULL;
1329 }
1330 catch (...)
1331 {
1332 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1333 return NULL;
1334 }
1335 }
1336
1337
1338 JNIEXPORT jbyteArray JNI_OrthancPluginHttpPut(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1, jstring arg3, jstring arg4)
1339 {
1340 try
1341 {
1342 JavaString c_arg0(env, arg0);
1343 JavaBytes c_arg1(env, arg1);
1344 JavaString c_arg3(env, arg3);
1345 JavaString c_arg4(env, arg4);
1346 OrthancBytes b;
1347 OrthancPluginErrorCode code = OrthancPluginHttpPut(context_, b.GetMemoryBuffer()
1348 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize(), c_arg3.GetValue(), c_arg4.GetValue());
1349 if (code == OrthancPluginErrorCode_Success)
1350 {
1351 jbyteArray answer = env->NewByteArray(b.GetSize());
1352 if (answer == NULL)
1353 {
1354 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1355 return NULL;
1356 }
1357 else
1358 {
1359 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1360 return answer;
1361 }
1362 }
1363 else
1364 {
1365 JavaEnvironment::ThrowException(env, code);
1366 return NULL;
1367 }
1368 }
1369 catch (std::runtime_error& e)
1370 {
1371 JavaEnvironment::ThrowException(env, e.what());
1372 return NULL;
1373 }
1374 catch (...)
1375 {
1376 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1377 return NULL;
1378 }
1379 }
1380
1381
1382 JNIEXPORT void JNI_OrthancPluginHttpDelete(JNIEnv* env, jobject sdkObject, jstring arg0, jstring arg1, jstring arg2)
1383 {
1384 try
1385 {
1386 JavaString c_arg0(env, arg0);
1387 JavaString c_arg1(env, arg1);
1388 JavaString c_arg2(env, arg2);
1389 OrthancPluginErrorCode code = OrthancPluginHttpDelete(context_
1390 , c_arg0.GetValue(), c_arg1.GetValue(), c_arg2.GetValue());
1391 if (code != OrthancPluginErrorCode_Success)
1392 {
1393 JavaEnvironment::ThrowException(env, code);
1394 }
1395 }
1396 catch (std::runtime_error& e)
1397 {
1398 JavaEnvironment::ThrowException(env, e.what());
1399 }
1400 catch (...)
1401 {
1402 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1403 }
1404 }
1405
1406
1407 JNIEXPORT jint JNI_OrthancPluginGetFontsCount(JNIEnv* env, jobject sdkObject)
1408 {
1409 try
1410 {
1411 return OrthancPluginGetFontsCount(context_
1412 );
1413 }
1414 catch (std::runtime_error& e)
1415 {
1416 JavaEnvironment::ThrowException(env, e.what());
1417 return 0;
1418 }
1419 catch (...)
1420 {
1421 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1422 return 0;
1423 }
1424 }
1425
1426
1427 JNIEXPORT jstring JNI_OrthancPluginGetFontName(JNIEnv* env, jobject sdkObject, jint arg0)
1428 {
1429 try
1430 {
1431 const char* s = OrthancPluginGetFontName(context_
1432 , arg0);
1433 if (s == NULL)
1434 {
1435 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1436 return NULL;
1437 }
1438 else
1439 {
1440 return env->NewStringUTF(s);
1441 }
1442 }
1443 catch (std::runtime_error& e)
1444 {
1445 JavaEnvironment::ThrowException(env, e.what());
1446 return NULL;
1447 }
1448 catch (...)
1449 {
1450 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1451 return NULL;
1452 }
1453 }
1454
1455
1456 JNIEXPORT jint JNI_OrthancPluginGetFontSize(JNIEnv* env, jobject sdkObject, jint arg0)
1457 {
1458 try
1459 {
1460 return OrthancPluginGetFontSize(context_
1461 , arg0);
1462 }
1463 catch (std::runtime_error& e)
1464 {
1465 JavaEnvironment::ThrowException(env, e.what());
1466 return 0;
1467 }
1468 catch (...)
1469 {
1470 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1471 return 0;
1472 }
1473 }
1474
1475
1476 JNIEXPORT void JNI_OrthancPluginRegisterErrorCode(JNIEnv* env, jobject sdkObject, jint arg0, jshort arg1, jstring arg2)
1477 {
1478 try
1479 {
1480 JavaString c_arg2(env, arg2);
1481 OrthancPluginErrorCode code = OrthancPluginRegisterErrorCode(context_
1482 , arg0, arg1, c_arg2.GetValue());
1483 if (code != OrthancPluginErrorCode_Success)
1484 {
1485 JavaEnvironment::ThrowException(env, code);
1486 }
1487 }
1488 catch (std::runtime_error& e)
1489 {
1490 JavaEnvironment::ThrowException(env, e.what());
1491 }
1492 catch (...)
1493 {
1494 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1495 }
1496 }
1497
1498
1499 JNIEXPORT void JNI_OrthancPluginRegisterDictionaryTag(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jint arg2, jstring arg3, jint arg4, jint arg5)
1500 {
1501 try
1502 {
1503 JavaString c_arg3(env, arg3);
1504 OrthancPluginErrorCode code = OrthancPluginRegisterDictionaryTag(context_
1505 , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5);
1506 if (code != OrthancPluginErrorCode_Success)
1507 {
1508 JavaEnvironment::ThrowException(env, code);
1509 }
1510 }
1511 catch (std::runtime_error& e)
1512 {
1513 JavaEnvironment::ThrowException(env, e.what());
1514 }
1515 catch (...)
1516 {
1517 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1518 }
1519 }
1520
1521
1522 JNIEXPORT void JNI_OrthancPluginRegisterPrivateDictionaryTag(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jint arg2, jstring arg3, jint arg4, jint arg5, jstring arg6)
1523 {
1524 try
1525 {
1526 JavaString c_arg3(env, arg3);
1527 JavaString c_arg6(env, arg6);
1528 OrthancPluginErrorCode code = OrthancPluginRegisterPrivateDictionaryTag(context_
1529 , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5, c_arg6.GetValue());
1530 if (code != OrthancPluginErrorCode_Success)
1531 {
1532 JavaEnvironment::ThrowException(env, code);
1533 }
1534 }
1535 catch (std::runtime_error& e)
1536 {
1537 JavaEnvironment::ThrowException(env, e.what());
1538 }
1539 catch (...)
1540 {
1541 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1542 }
1543 }
1544
1545
1546 JNIEXPORT jstring JNI_OrthancPluginDicomBufferToJson(JNIEnv* env, jobject sdkObject, jbyteArray arg0, jint arg2, jint arg3, jint arg4)
1547 {
1548 try
1549 {
1550 JavaBytes c_arg0(env, arg0);
1551 OrthancString s(OrthancPluginDicomBufferToJson(context_
1552 , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4));
1553 if (s.GetValue() == NULL)
1554 {
1555 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1556 return NULL;
1557 }
1558 else
1559 {
1560 jstring t = env->NewStringUTF(s.GetValue());
1561 if (t == NULL)
1562 {
1563 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1564 return NULL;
1565 }
1566 else
1567 {
1568 return t;
1569 }
1570 }
1571 }
1572 catch (std::runtime_error& e)
1573 {
1574 JavaEnvironment::ThrowException(env, e.what());
1575 return NULL;
1576 }
1577 catch (...)
1578 {
1579 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1580 return NULL;
1581 }
1582 }
1583
1584
1585 JNIEXPORT jstring JNI_OrthancPluginDicomInstanceToJson(JNIEnv* env, jobject sdkObject, jstring arg0, jint arg1, jint arg2, jint arg3)
1586 {
1587 try
1588 {
1589 JavaString c_arg0(env, arg0);
1590 OrthancString s(OrthancPluginDicomInstanceToJson(context_
1591 , c_arg0.GetValue(), static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3));
1592 if (s.GetValue() == NULL)
1593 {
1594 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1595 return NULL;
1596 }
1597 else
1598 {
1599 jstring t = env->NewStringUTF(s.GetValue());
1600 if (t == NULL)
1601 {
1602 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1603 return NULL;
1604 }
1605 else
1606 {
1607 return t;
1608 }
1609 }
1610 }
1611 catch (std::runtime_error& e)
1612 {
1613 JavaEnvironment::ThrowException(env, e.what());
1614 return NULL;
1615 }
1616 catch (...)
1617 {
1618 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1619 return NULL;
1620 }
1621 }
1622
1623
1624 JNIEXPORT jbyteArray JNI_OrthancPluginCreateDicom(JNIEnv* env, jobject sdkObject, jstring arg0, jlong arg1, jint arg2)
1625 {
1626 try
1627 {
1628 JavaString c_arg0(env, arg0);
1629 OrthancBytes b;
1630 OrthancPluginErrorCode code = OrthancPluginCreateDicom(context_, b.GetMemoryBuffer()
1631 , c_arg0.GetValue(), reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(arg1)), static_cast<OrthancPluginCreateDicomFlags>(arg2));
1632 if (code == OrthancPluginErrorCode_Success)
1633 {
1634 jbyteArray answer = env->NewByteArray(b.GetSize());
1635 if (answer == NULL)
1636 {
1637 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1638 return NULL;
1639 }
1640 else
1641 {
1642 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
1643 return answer;
1644 }
1645 }
1646 else
1647 {
1648 JavaEnvironment::ThrowException(env, code);
1649 return NULL;
1650 }
1651 }
1652 catch (std::runtime_error& e)
1653 {
1654 JavaEnvironment::ThrowException(env, e.what());
1655 return NULL;
1656 }
1657 catch (...)
1658 {
1659 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1660 return NULL;
1661 }
1662 }
1663
1664
1665 JNIEXPORT jlong JNI_OrthancPluginCreateImage(JNIEnv* env, jobject sdkObject, jint arg0, jint arg1, jint arg2)
1666 {
1667 try
1668 {
1669 OrthancPluginImage* answer = OrthancPluginCreateImage(context_
1670 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2);
1671 if (answer == NULL)
1672 {
1673 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1674 return 0;
1675 }
1676 else
1677 {
1678 return reinterpret_cast<intptr_t>(answer);
1679 }
1680 }
1681 catch (std::runtime_error& e)
1682 {
1683 JavaEnvironment::ThrowException(env, e.what());
1684 return 0;
1685 }
1686 catch (...)
1687 {
1688 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1689 return 0;
1690 }
1691 }
1692
1693
1694 JNIEXPORT jlong JNI_OrthancPluginDecodeDicomImage(JNIEnv* env, jobject sdkObject, jbyteArray arg0, jint arg2)
1695 {
1696 try
1697 {
1698 JavaBytes c_arg0(env, arg0);
1699 OrthancPluginImage* answer = OrthancPluginDecodeDicomImage(context_
1700 , c_arg0.GetData(), c_arg0.GetSize(), arg2);
1701 if (answer == NULL)
1702 {
1703 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1704 return 0;
1705 }
1706 else
1707 {
1708 return reinterpret_cast<intptr_t>(answer);
1709 }
1710 }
1711 catch (std::runtime_error& e)
1712 {
1713 JavaEnvironment::ThrowException(env, e.what());
1714 return 0;
1715 }
1716 catch (...)
1717 {
1718 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1719 return 0;
1720 }
1721 }
1722
1723
1724 JNIEXPORT jstring JNI_OrthancPluginComputeMd5(JNIEnv* env, jobject sdkObject, jbyteArray arg0)
1725 {
1726 try
1727 {
1728 JavaBytes c_arg0(env, arg0);
1729 OrthancString s(OrthancPluginComputeMd5(context_
1730 , c_arg0.GetData(), c_arg0.GetSize()));
1731 if (s.GetValue() == NULL)
1732 {
1733 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1734 return NULL;
1735 }
1736 else
1737 {
1738 jstring t = env->NewStringUTF(s.GetValue());
1739 if (t == NULL)
1740 {
1741 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1742 return NULL;
1743 }
1744 else
1745 {
1746 return t;
1747 }
1748 }
1749 }
1750 catch (std::runtime_error& e)
1751 {
1752 JavaEnvironment::ThrowException(env, e.what());
1753 return NULL;
1754 }
1755 catch (...)
1756 {
1757 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1758 return NULL;
1759 }
1760 }
1761
1762
1763 JNIEXPORT jstring JNI_OrthancPluginComputeSha1(JNIEnv* env, jobject sdkObject, jbyteArray arg0)
1764 {
1765 try
1766 {
1767 JavaBytes c_arg0(env, arg0);
1768 OrthancString s(OrthancPluginComputeSha1(context_
1769 , c_arg0.GetData(), c_arg0.GetSize()));
1770 if (s.GetValue() == NULL)
1771 {
1772 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1773 return NULL;
1774 }
1775 else
1776 {
1777 jstring t = env->NewStringUTF(s.GetValue());
1778 if (t == NULL)
1779 {
1780 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1781 return NULL;
1782 }
1783 else
1784 {
1785 return t;
1786 }
1787 }
1788 }
1789 catch (std::runtime_error& e)
1790 {
1791 JavaEnvironment::ThrowException(env, e.what());
1792 return NULL;
1793 }
1794 catch (...)
1795 {
1796 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1797 return NULL;
1798 }
1799 }
1800
1801
1802 JNIEXPORT jstring JNI_OrthancPluginGenerateUuid(JNIEnv* env, jobject sdkObject)
1803 {
1804 try
1805 {
1806 OrthancString s(OrthancPluginGenerateUuid(context_
1807 ));
1808 if (s.GetValue() == NULL)
1809 {
1810 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1811 return NULL;
1812 }
1813 else
1814 {
1815 jstring t = env->NewStringUTF(s.GetValue());
1816 if (t == NULL)
1817 {
1818 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1819 return NULL;
1820 }
1821 else
1822 {
1823 return t;
1824 }
1825 }
1826 }
1827 catch (std::runtime_error& e)
1828 {
1829 JavaEnvironment::ThrowException(env, e.what());
1830 return NULL;
1831 }
1832 catch (...)
1833 {
1834 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1835 return NULL;
1836 }
1837 }
1838
1839
1840 JNIEXPORT jlong JNI_OrthancPluginCreateFindMatcher(JNIEnv* env, jobject sdkObject, jbyteArray arg0)
1841 {
1842 try
1843 {
1844 JavaBytes c_arg0(env, arg0);
1845 OrthancPluginFindMatcher* answer = OrthancPluginCreateFindMatcher(context_
1846 , c_arg0.GetData(), c_arg0.GetSize());
1847 if (answer == NULL)
1848 {
1849 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1850 return 0;
1851 }
1852 else
1853 {
1854 return reinterpret_cast<intptr_t>(answer);
1855 }
1856 }
1857 catch (std::runtime_error& e)
1858 {
1859 JavaEnvironment::ThrowException(env, e.what());
1860 return 0;
1861 }
1862 catch (...)
1863 {
1864 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1865 return 0;
1866 }
1867 }
1868
1869
1870 JNIEXPORT jlong JNI_OrthancPluginGetPeers(JNIEnv* env, jobject sdkObject)
1871 {
1872 try
1873 {
1874 OrthancPluginPeers* answer = OrthancPluginGetPeers(context_
1875 );
1876 if (answer == NULL)
1877 {
1878 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1879 return 0;
1880 }
1881 else
1882 {
1883 return reinterpret_cast<intptr_t>(answer);
1884 }
1885 }
1886 catch (std::runtime_error& e)
1887 {
1888 JavaEnvironment::ThrowException(env, e.what());
1889 return 0;
1890 }
1891 catch (...)
1892 {
1893 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1894 return 0;
1895 }
1896 }
1897
1898
1899 JNIEXPORT jstring JNI_OrthancPluginAutodetectMimeType(JNIEnv* env, jobject sdkObject, jstring arg0)
1900 {
1901 try
1902 {
1903 JavaString c_arg0(env, arg0);
1904 const char* s = OrthancPluginAutodetectMimeType(context_
1905 , c_arg0.GetValue());
1906 if (s == NULL)
1907 {
1908 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1909 return NULL;
1910 }
1911 else
1912 {
1913 return env->NewStringUTF(s);
1914 }
1915 }
1916 catch (std::runtime_error& e)
1917 {
1918 JavaEnvironment::ThrowException(env, e.what());
1919 return NULL;
1920 }
1921 catch (...)
1922 {
1923 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1924 return NULL;
1925 }
1926 }
1927
1928
1929 JNIEXPORT void JNI_OrthancPluginSetMetricsValue(JNIEnv* env, jobject sdkObject, jstring arg0, jfloat arg1, jint arg2)
1930 {
1931 try
1932 {
1933 JavaString c_arg0(env, arg0);
1934 OrthancPluginSetMetricsValue(context_
1935 , c_arg0.GetValue(), arg1, static_cast<OrthancPluginMetricsType>(arg2));
1936 }
1937 catch (std::runtime_error& e)
1938 {
1939 JavaEnvironment::ThrowException(env, e.what());
1940 }
1941 catch (...)
1942 {
1943 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1944 }
1945 }
1946
1947
1948 JNIEXPORT jstring JNI_OrthancPluginGetTagName(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jstring arg2)
1949 {
1950 try
1951 {
1952 JavaString c_arg2(env, arg2);
1953 OrthancString s(OrthancPluginGetTagName(context_
1954 , arg0, arg1, c_arg2.GetValue()));
1955 if (s.GetValue() == NULL)
1956 {
1957 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1958 return NULL;
1959 }
1960 else
1961 {
1962 jstring t = env->NewStringUTF(s.GetValue());
1963 if (t == NULL)
1964 {
1965 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
1966 return NULL;
1967 }
1968 else
1969 {
1970 return t;
1971 }
1972 }
1973 }
1974 catch (std::runtime_error& e)
1975 {
1976 JavaEnvironment::ThrowException(env, e.what());
1977 return NULL;
1978 }
1979 catch (...)
1980 {
1981 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1982 return NULL;
1983 }
1984 }
1985
1986
1987 JNIEXPORT jlong JNI_OrthancPluginCreateDicomInstance(JNIEnv* env, jobject sdkObject, jbyteArray arg0)
1988 {
1989 try
1990 {
1991 JavaBytes c_arg0(env, arg0);
1992 OrthancPluginDicomInstance* answer = OrthancPluginCreateDicomInstance(context_
1993 , c_arg0.GetData(), c_arg0.GetSize());
1994 if (answer == NULL)
1995 {
1996 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
1997 return 0;
1998 }
1999 else
2000 {
2001 return reinterpret_cast<intptr_t>(answer);
2002 }
2003 }
2004 catch (std::runtime_error& e)
2005 {
2006 JavaEnvironment::ThrowException(env, e.what());
2007 return 0;
2008 }
2009 catch (...)
2010 {
2011 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2012 return 0;
2013 }
2014 }
2015
2016
2017 JNIEXPORT jlong JNI_OrthancPluginTranscodeDicomInstance(JNIEnv* env, jobject sdkObject, jbyteArray arg0, jstring arg2)
2018 {
2019 try
2020 {
2021 JavaBytes c_arg0(env, arg0);
2022 JavaString c_arg2(env, arg2);
2023 OrthancPluginDicomInstance* answer = OrthancPluginTranscodeDicomInstance(context_
2024 , c_arg0.GetData(), c_arg0.GetSize(), c_arg2.GetValue());
2025 if (answer == NULL)
2026 {
2027 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2028 return 0;
2029 }
2030 else
2031 {
2032 return reinterpret_cast<intptr_t>(answer);
2033 }
2034 }
2035 catch (std::runtime_error& e)
2036 {
2037 JavaEnvironment::ThrowException(env, e.what());
2038 return 0;
2039 }
2040 catch (...)
2041 {
2042 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2043 return 0;
2044 }
2045 }
2046
2047
2048 JNIEXPORT jstring JNI_OrthancPluginGenerateRestApiAuthorizationToken(JNIEnv* env, jobject sdkObject)
2049 {
2050 try
2051 {
2052 OrthancString s(OrthancPluginGenerateRestApiAuthorizationToken(context_
2053 ));
2054 if (s.GetValue() == NULL)
2055 {
2056 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2057 return NULL;
2058 }
2059 else
2060 {
2061 jstring t = env->NewStringUTF(s.GetValue());
2062 if (t == NULL)
2063 {
2064 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2065 return NULL;
2066 }
2067 else
2068 {
2069 return t;
2070 }
2071 }
2072 }
2073 catch (std::runtime_error& e)
2074 {
2075 JavaEnvironment::ThrowException(env, e.what());
2076 return NULL;
2077 }
2078 catch (...)
2079 {
2080 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2081 return NULL;
2082 }
2083 }
2084
2085
2086 JNIEXPORT jbyteArray JNI_OrthancPluginCreateDicom2(JNIEnv* env, jobject sdkObject, jstring arg0, jlong arg1, jint arg2, jstring arg3)
2087 {
2088 try
2089 {
2090 JavaString c_arg0(env, arg0);
2091 JavaString c_arg3(env, arg3);
2092 OrthancBytes b;
2093 OrthancPluginErrorCode code = OrthancPluginCreateDicom2(context_, b.GetMemoryBuffer()
2094 , c_arg0.GetValue(), reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(arg1)), static_cast<OrthancPluginCreateDicomFlags>(arg2), c_arg3.GetValue());
2095 if (code == OrthancPluginErrorCode_Success)
2096 {
2097 jbyteArray answer = env->NewByteArray(b.GetSize());
2098 if (answer == NULL)
2099 {
2100 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2101 return NULL;
2102 }
2103 else
2104 {
2105 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
2106 return answer;
2107 }
2108 }
2109 else
2110 {
2111 JavaEnvironment::ThrowException(env, code);
2112 return NULL;
2113 }
2114 }
2115 catch (std::runtime_error& e)
2116 {
2117 JavaEnvironment::ThrowException(env, e.what());
2118 return NULL;
2119 }
2120 catch (...)
2121 {
2122 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2123 return NULL;
2124 }
2125 }
2126
2127
2128 JNIEXPORT void JNI_OrthancPluginFreeDicomInstance(JNIEnv* env, jobject sdkObject, jlong self)
2129 {
2130 try
2131 {
2132 OrthancPluginFreeDicomInstance(context_
2133 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2134 );
2135 }
2136 catch (std::runtime_error& e)
2137 {
2138 JavaEnvironment::ThrowException(env, e.what());
2139 }
2140 catch (...)
2141 {
2142 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2143 }
2144 }
2145
2146
2147 JNIEXPORT jstring JNI_OrthancPluginGetInstanceRemoteAet(JNIEnv* env, jobject sdkObject, jlong self)
2148 {
2149 try
2150 {
2151 const char* s = OrthancPluginGetInstanceRemoteAet(context_
2152 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2153 );
2154 if (s == NULL)
2155 {
2156 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2157 return NULL;
2158 }
2159 else
2160 {
2161 return env->NewStringUTF(s);
2162 }
2163 }
2164 catch (std::runtime_error& e)
2165 {
2166 JavaEnvironment::ThrowException(env, e.what());
2167 return NULL;
2168 }
2169 catch (...)
2170 {
2171 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2172 return NULL;
2173 }
2174 }
2175
2176
2177 JNIEXPORT jlong JNI_OrthancPluginGetInstanceSize(JNIEnv* env, jobject sdkObject, jlong self)
2178 {
2179 try
2180 {
2181 return OrthancPluginGetInstanceSize(context_
2182 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2183 );
2184 }
2185 catch (std::runtime_error& e)
2186 {
2187 JavaEnvironment::ThrowException(env, e.what());
2188 return 0;
2189 }
2190 catch (...)
2191 {
2192 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2193 return 0;
2194 }
2195 }
2196
2197
2198 JNIEXPORT jstring JNI_OrthancPluginGetInstanceJson(JNIEnv* env, jobject sdkObject, jlong self)
2199 {
2200 try
2201 {
2202 OrthancString s(OrthancPluginGetInstanceJson(context_
2203 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2204 ));
2205 if (s.GetValue() == NULL)
2206 {
2207 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2208 return NULL;
2209 }
2210 else
2211 {
2212 jstring t = env->NewStringUTF(s.GetValue());
2213 if (t == NULL)
2214 {
2215 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2216 return NULL;
2217 }
2218 else
2219 {
2220 return t;
2221 }
2222 }
2223 }
2224 catch (std::runtime_error& e)
2225 {
2226 JavaEnvironment::ThrowException(env, e.what());
2227 return NULL;
2228 }
2229 catch (...)
2230 {
2231 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2232 return NULL;
2233 }
2234 }
2235
2236
2237 JNIEXPORT jstring JNI_OrthancPluginGetInstanceSimplifiedJson(JNIEnv* env, jobject sdkObject, jlong self)
2238 {
2239 try
2240 {
2241 OrthancString s(OrthancPluginGetInstanceSimplifiedJson(context_
2242 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2243 ));
2244 if (s.GetValue() == NULL)
2245 {
2246 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2247 return NULL;
2248 }
2249 else
2250 {
2251 jstring t = env->NewStringUTF(s.GetValue());
2252 if (t == NULL)
2253 {
2254 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2255 return NULL;
2256 }
2257 else
2258 {
2259 return t;
2260 }
2261 }
2262 }
2263 catch (std::runtime_error& e)
2264 {
2265 JavaEnvironment::ThrowException(env, e.what());
2266 return NULL;
2267 }
2268 catch (...)
2269 {
2270 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2271 return NULL;
2272 }
2273 }
2274
2275
2276 JNIEXPORT jint JNI_OrthancPluginHasInstanceMetadata(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0)
2277 {
2278 try
2279 {
2280 JavaString c_arg0(env, arg0);
2281 return OrthancPluginHasInstanceMetadata(context_
2282 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2283 , c_arg0.GetValue());
2284 }
2285 catch (std::runtime_error& e)
2286 {
2287 JavaEnvironment::ThrowException(env, e.what());
2288 return 0;
2289 }
2290 catch (...)
2291 {
2292 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2293 return 0;
2294 }
2295 }
2296
2297
2298 JNIEXPORT jstring JNI_OrthancPluginGetInstanceMetadata(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0)
2299 {
2300 try
2301 {
2302 JavaString c_arg0(env, arg0);
2303 const char* s = OrthancPluginGetInstanceMetadata(context_
2304 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2305 , c_arg0.GetValue());
2306 if (s == NULL)
2307 {
2308 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2309 return NULL;
2310 }
2311 else
2312 {
2313 return env->NewStringUTF(s);
2314 }
2315 }
2316 catch (std::runtime_error& e)
2317 {
2318 JavaEnvironment::ThrowException(env, e.what());
2319 return NULL;
2320 }
2321 catch (...)
2322 {
2323 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2324 return NULL;
2325 }
2326 }
2327
2328
2329 JNIEXPORT jint JNI_OrthancPluginGetInstanceOrigin(JNIEnv* env, jobject sdkObject, jlong self)
2330 {
2331 try
2332 {
2333 return OrthancPluginGetInstanceOrigin(context_
2334 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2335 );
2336 }
2337 catch (std::runtime_error& e)
2338 {
2339 JavaEnvironment::ThrowException(env, e.what());
2340 return 0;
2341 }
2342 catch (...)
2343 {
2344 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2345 return 0;
2346 }
2347 }
2348
2349
2350 JNIEXPORT jstring JNI_OrthancPluginGetInstanceTransferSyntaxUid(JNIEnv* env, jobject sdkObject, jlong self)
2351 {
2352 try
2353 {
2354 OrthancString s(OrthancPluginGetInstanceTransferSyntaxUid(context_
2355 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2356 ));
2357 if (s.GetValue() == NULL)
2358 {
2359 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2360 return NULL;
2361 }
2362 else
2363 {
2364 jstring t = env->NewStringUTF(s.GetValue());
2365 if (t == NULL)
2366 {
2367 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2368 return NULL;
2369 }
2370 else
2371 {
2372 return t;
2373 }
2374 }
2375 }
2376 catch (std::runtime_error& e)
2377 {
2378 JavaEnvironment::ThrowException(env, e.what());
2379 return NULL;
2380 }
2381 catch (...)
2382 {
2383 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2384 return NULL;
2385 }
2386 }
2387
2388
2389 JNIEXPORT jint JNI_OrthancPluginHasInstancePixelData(JNIEnv* env, jobject sdkObject, jlong self)
2390 {
2391 try
2392 {
2393 return OrthancPluginHasInstancePixelData(context_
2394 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2395 );
2396 }
2397 catch (std::runtime_error& e)
2398 {
2399 JavaEnvironment::ThrowException(env, e.what());
2400 return 0;
2401 }
2402 catch (...)
2403 {
2404 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2405 return 0;
2406 }
2407 }
2408
2409
2410 JNIEXPORT jint JNI_OrthancPluginGetInstanceFramesCount(JNIEnv* env, jobject sdkObject, jlong self)
2411 {
2412 try
2413 {
2414 return OrthancPluginGetInstanceFramesCount(context_
2415 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2416 );
2417 }
2418 catch (std::runtime_error& e)
2419 {
2420 JavaEnvironment::ThrowException(env, e.what());
2421 return 0;
2422 }
2423 catch (...)
2424 {
2425 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2426 return 0;
2427 }
2428 }
2429
2430
2431 JNIEXPORT jbyteArray JNI_OrthancPluginGetInstanceRawFrame(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
2432 {
2433 try
2434 {
2435 OrthancBytes b;
2436 OrthancPluginErrorCode code = OrthancPluginGetInstanceRawFrame(context_, b.GetMemoryBuffer()
2437 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2438 , arg0);
2439 if (code == OrthancPluginErrorCode_Success)
2440 {
2441 jbyteArray answer = env->NewByteArray(b.GetSize());
2442 if (answer == NULL)
2443 {
2444 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2445 return NULL;
2446 }
2447 else
2448 {
2449 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
2450 return answer;
2451 }
2452 }
2453 else
2454 {
2455 JavaEnvironment::ThrowException(env, code);
2456 return NULL;
2457 }
2458 }
2459 catch (std::runtime_error& e)
2460 {
2461 JavaEnvironment::ThrowException(env, e.what());
2462 return NULL;
2463 }
2464 catch (...)
2465 {
2466 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2467 return NULL;
2468 }
2469 }
2470
2471
2472 JNIEXPORT jlong JNI_OrthancPluginGetInstanceDecodedFrame(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
2473 {
2474 try
2475 {
2476 OrthancPluginImage* answer = OrthancPluginGetInstanceDecodedFrame(context_
2477 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2478 , arg0);
2479 if (answer == NULL)
2480 {
2481 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2482 return 0;
2483 }
2484 else
2485 {
2486 return reinterpret_cast<intptr_t>(answer);
2487 }
2488 }
2489 catch (std::runtime_error& e)
2490 {
2491 JavaEnvironment::ThrowException(env, e.what());
2492 return 0;
2493 }
2494 catch (...)
2495 {
2496 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2497 return 0;
2498 }
2499 }
2500
2501
2502 JNIEXPORT jbyteArray JNI_OrthancPluginSerializeDicomInstance(JNIEnv* env, jobject sdkObject, jlong self)
2503 {
2504 try
2505 {
2506 OrthancBytes b;
2507 OrthancPluginErrorCode code = OrthancPluginSerializeDicomInstance(context_, b.GetMemoryBuffer()
2508 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2509 );
2510 if (code == OrthancPluginErrorCode_Success)
2511 {
2512 jbyteArray answer = env->NewByteArray(b.GetSize());
2513 if (answer == NULL)
2514 {
2515 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2516 return NULL;
2517 }
2518 else
2519 {
2520 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
2521 return answer;
2522 }
2523 }
2524 else
2525 {
2526 JavaEnvironment::ThrowException(env, code);
2527 return NULL;
2528 }
2529 }
2530 catch (std::runtime_error& e)
2531 {
2532 JavaEnvironment::ThrowException(env, e.what());
2533 return NULL;
2534 }
2535 catch (...)
2536 {
2537 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2538 return NULL;
2539 }
2540 }
2541
2542
2543 JNIEXPORT jstring JNI_OrthancPluginGetInstanceAdvancedJson(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jint arg1, jint arg2)
2544 {
2545 try
2546 {
2547 OrthancString s(OrthancPluginGetInstanceAdvancedJson(context_
2548 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self))
2549 , static_cast<OrthancPluginDicomToJsonFormat>(arg0), static_cast<OrthancPluginDicomToJsonFlags>(arg1), arg2));
2550 if (s.GetValue() == NULL)
2551 {
2552 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2553 return NULL;
2554 }
2555 else
2556 {
2557 jstring t = env->NewStringUTF(s.GetValue());
2558 if (t == NULL)
2559 {
2560 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2561 return NULL;
2562 }
2563 else
2564 {
2565 return t;
2566 }
2567 }
2568 }
2569 catch (std::runtime_error& e)
2570 {
2571 JavaEnvironment::ThrowException(env, e.what());
2572 return NULL;
2573 }
2574 catch (...)
2575 {
2576 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2577 return NULL;
2578 }
2579 }
2580
2581
2582 JNIEXPORT void JNI_OrthancPluginFindAddAnswer(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0)
2583 {
2584 try
2585 {
2586 JavaBytes c_arg0(env, arg0);
2587 OrthancPluginErrorCode code = OrthancPluginFindAddAnswer(context_
2588 , reinterpret_cast<OrthancPluginFindAnswers*>(static_cast<intptr_t>(self))
2589 , c_arg0.GetData(), c_arg0.GetSize());
2590 if (code != OrthancPluginErrorCode_Success)
2591 {
2592 JavaEnvironment::ThrowException(env, code);
2593 }
2594 }
2595 catch (std::runtime_error& e)
2596 {
2597 JavaEnvironment::ThrowException(env, e.what());
2598 }
2599 catch (...)
2600 {
2601 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2602 }
2603 }
2604
2605
2606 JNIEXPORT void JNI_OrthancPluginFindMarkIncomplete(JNIEnv* env, jobject sdkObject, jlong self)
2607 {
2608 try
2609 {
2610 OrthancPluginErrorCode code = OrthancPluginFindMarkIncomplete(context_
2611 , reinterpret_cast<OrthancPluginFindAnswers*>(static_cast<intptr_t>(self))
2612 );
2613 if (code != OrthancPluginErrorCode_Success)
2614 {
2615 JavaEnvironment::ThrowException(env, code);
2616 }
2617 }
2618 catch (std::runtime_error& e)
2619 {
2620 JavaEnvironment::ThrowException(env, e.what());
2621 }
2622 catch (...)
2623 {
2624 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2625 }
2626 }
2627
2628
2629 JNIEXPORT void JNI_OrthancPluginFreeFindMatcher(JNIEnv* env, jobject sdkObject, jlong self)
2630 {
2631 try
2632 {
2633 OrthancPluginFreeFindMatcher(context_
2634 , reinterpret_cast<OrthancPluginFindMatcher*>(static_cast<intptr_t>(self))
2635 );
2636 }
2637 catch (std::runtime_error& e)
2638 {
2639 JavaEnvironment::ThrowException(env, e.what());
2640 }
2641 catch (...)
2642 {
2643 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2644 }
2645 }
2646
2647
2648 JNIEXPORT jint JNI_OrthancPluginFindMatcherIsMatch(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0)
2649 {
2650 try
2651 {
2652 JavaBytes c_arg0(env, arg0);
2653 return OrthancPluginFindMatcherIsMatch(context_
2654 , reinterpret_cast<OrthancPluginFindMatcher*>(static_cast<intptr_t>(self))
2655 , c_arg0.GetData(), c_arg0.GetSize());
2656 }
2657 catch (std::runtime_error& e)
2658 {
2659 JavaEnvironment::ThrowException(env, e.what());
2660 return 0;
2661 }
2662 catch (...)
2663 {
2664 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2665 return 0;
2666 }
2667 }
2668
2669
2670 JNIEXPORT jint JNI_OrthancPluginGetFindQuerySize(JNIEnv* env, jobject sdkObject, jlong self)
2671 {
2672 try
2673 {
2674 return OrthancPluginGetFindQuerySize(context_
2675 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self))
2676 );
2677 }
2678 catch (std::runtime_error& e)
2679 {
2680 JavaEnvironment::ThrowException(env, e.what());
2681 return 0;
2682 }
2683 catch (...)
2684 {
2685 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2686 return 0;
2687 }
2688 }
2689
2690
2691 JNIEXPORT jstring JNI_OrthancPluginGetFindQueryTagName(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
2692 {
2693 try
2694 {
2695 OrthancString s(OrthancPluginGetFindQueryTagName(context_
2696 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self))
2697 , arg0));
2698 if (s.GetValue() == NULL)
2699 {
2700 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2701 return NULL;
2702 }
2703 else
2704 {
2705 jstring t = env->NewStringUTF(s.GetValue());
2706 if (t == NULL)
2707 {
2708 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2709 return NULL;
2710 }
2711 else
2712 {
2713 return t;
2714 }
2715 }
2716 }
2717 catch (std::runtime_error& e)
2718 {
2719 JavaEnvironment::ThrowException(env, e.what());
2720 return NULL;
2721 }
2722 catch (...)
2723 {
2724 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2725 return NULL;
2726 }
2727 }
2728
2729
2730 JNIEXPORT jstring JNI_OrthancPluginGetFindQueryValue(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
2731 {
2732 try
2733 {
2734 OrthancString s(OrthancPluginGetFindQueryValue(context_
2735 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self))
2736 , arg0));
2737 if (s.GetValue() == NULL)
2738 {
2739 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2740 return NULL;
2741 }
2742 else
2743 {
2744 jstring t = env->NewStringUTF(s.GetValue());
2745 if (t == NULL)
2746 {
2747 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2748 return NULL;
2749 }
2750 else
2751 {
2752 return t;
2753 }
2754 }
2755 }
2756 catch (std::runtime_error& e)
2757 {
2758 JavaEnvironment::ThrowException(env, e.what());
2759 return NULL;
2760 }
2761 catch (...)
2762 {
2763 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2764 return NULL;
2765 }
2766 }
2767
2768
2769 JNIEXPORT void JNI_OrthancPluginFreeImage(JNIEnv* env, jobject sdkObject, jlong self)
2770 {
2771 try
2772 {
2773 OrthancPluginFreeImage(context_
2774 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self))
2775 );
2776 }
2777 catch (std::runtime_error& e)
2778 {
2779 JavaEnvironment::ThrowException(env, e.what());
2780 }
2781 catch (...)
2782 {
2783 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2784 }
2785 }
2786
2787
2788 JNIEXPORT jint JNI_OrthancPluginGetImagePixelFormat(JNIEnv* env, jobject sdkObject, jlong self)
2789 {
2790 try
2791 {
2792 return OrthancPluginGetImagePixelFormat(context_
2793 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self))
2794 );
2795 }
2796 catch (std::runtime_error& e)
2797 {
2798 JavaEnvironment::ThrowException(env, e.what());
2799 return 0;
2800 }
2801 catch (...)
2802 {
2803 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2804 return 0;
2805 }
2806 }
2807
2808
2809 JNIEXPORT jint JNI_OrthancPluginGetImageWidth(JNIEnv* env, jobject sdkObject, jlong self)
2810 {
2811 try
2812 {
2813 return OrthancPluginGetImageWidth(context_
2814 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self))
2815 );
2816 }
2817 catch (std::runtime_error& e)
2818 {
2819 JavaEnvironment::ThrowException(env, e.what());
2820 return 0;
2821 }
2822 catch (...)
2823 {
2824 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2825 return 0;
2826 }
2827 }
2828
2829
2830 JNIEXPORT jint JNI_OrthancPluginGetImageHeight(JNIEnv* env, jobject sdkObject, jlong self)
2831 {
2832 try
2833 {
2834 return OrthancPluginGetImageHeight(context_
2835 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self))
2836 );
2837 }
2838 catch (std::runtime_error& e)
2839 {
2840 JavaEnvironment::ThrowException(env, e.what());
2841 return 0;
2842 }
2843 catch (...)
2844 {
2845 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2846 return 0;
2847 }
2848 }
2849
2850
2851 JNIEXPORT jint JNI_OrthancPluginGetImagePitch(JNIEnv* env, jobject sdkObject, jlong self)
2852 {
2853 try
2854 {
2855 return OrthancPluginGetImagePitch(context_
2856 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self))
2857 );
2858 }
2859 catch (std::runtime_error& e)
2860 {
2861 JavaEnvironment::ThrowException(env, e.what());
2862 return 0;
2863 }
2864 catch (...)
2865 {
2866 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2867 return 0;
2868 }
2869 }
2870
2871
2872 JNIEXPORT jlong JNI_OrthancPluginConvertPixelFormat(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
2873 {
2874 try
2875 {
2876 OrthancPluginImage* answer = OrthancPluginConvertPixelFormat(context_
2877 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self))
2878 , static_cast<OrthancPluginPixelFormat>(arg0));
2879 if (answer == NULL)
2880 {
2881 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2882 return 0;
2883 }
2884 else
2885 {
2886 return reinterpret_cast<intptr_t>(answer);
2887 }
2888 }
2889 catch (std::runtime_error& e)
2890 {
2891 JavaEnvironment::ThrowException(env, e.what());
2892 return 0;
2893 }
2894 catch (...)
2895 {
2896 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2897 return 0;
2898 }
2899 }
2900
2901
2902 JNIEXPORT void JNI_OrthancPluginDrawText(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jstring arg1, jint arg2, jint arg3, jbyte arg4, jbyte arg5, jbyte arg6)
2903 {
2904 try
2905 {
2906 JavaString c_arg1(env, arg1);
2907 OrthancPluginErrorCode code = OrthancPluginDrawText(context_
2908 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self))
2909 , arg0, c_arg1.GetValue(), arg2, arg3, arg4, arg5, arg6);
2910 if (code != OrthancPluginErrorCode_Success)
2911 {
2912 JavaEnvironment::ThrowException(env, code);
2913 }
2914 }
2915 catch (std::runtime_error& e)
2916 {
2917 JavaEnvironment::ThrowException(env, e.what());
2918 }
2919 catch (...)
2920 {
2921 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2922 }
2923 }
2924
2925
2926 JNIEXPORT void JNI_OrthancPluginFreeJob(JNIEnv* env, jobject sdkObject, jlong self)
2927 {
2928 try
2929 {
2930 OrthancPluginFreeJob(context_
2931 , reinterpret_cast<OrthancPluginJob*>(static_cast<intptr_t>(self))
2932 );
2933 }
2934 catch (std::runtime_error& e)
2935 {
2936 JavaEnvironment::ThrowException(env, e.what());
2937 }
2938 catch (...)
2939 {
2940 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2941 }
2942 }
2943
2944
2945 JNIEXPORT jstring JNI_OrthancPluginSubmitJob(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
2946 {
2947 try
2948 {
2949 OrthancString s(OrthancPluginSubmitJob(context_
2950 , reinterpret_cast<OrthancPluginJob*>(static_cast<intptr_t>(self))
2951 , arg0));
2952 if (s.GetValue() == NULL)
2953 {
2954 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2955 return NULL;
2956 }
2957 else
2958 {
2959 jstring t = env->NewStringUTF(s.GetValue());
2960 if (t == NULL)
2961 {
2962 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
2963 return NULL;
2964 }
2965 else
2966 {
2967 return t;
2968 }
2969 }
2970 }
2971 catch (std::runtime_error& e)
2972 {
2973 JavaEnvironment::ThrowException(env, e.what());
2974 return NULL;
2975 }
2976 catch (...)
2977 {
2978 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2979 return NULL;
2980 }
2981 }
2982
2983
2984 JNIEXPORT void JNI_OrthancPluginFreePeers(JNIEnv* env, jobject sdkObject, jlong self)
2985 {
2986 try
2987 {
2988 OrthancPluginFreePeers(context_
2989 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self))
2990 );
2991 }
2992 catch (std::runtime_error& e)
2993 {
2994 JavaEnvironment::ThrowException(env, e.what());
2995 }
2996 catch (...)
2997 {
2998 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
2999 }
3000 }
3001
3002
3003 JNIEXPORT jint JNI_OrthancPluginGetPeersCount(JNIEnv* env, jobject sdkObject, jlong self)
3004 {
3005 try
3006 {
3007 return OrthancPluginGetPeersCount(context_
3008 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self))
3009 );
3010 }
3011 catch (std::runtime_error& e)
3012 {
3013 JavaEnvironment::ThrowException(env, e.what());
3014 return 0;
3015 }
3016 catch (...)
3017 {
3018 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3019 return 0;
3020 }
3021 }
3022
3023
3024 JNIEXPORT jstring JNI_OrthancPluginGetPeerName(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
3025 {
3026 try
3027 {
3028 const char* s = OrthancPluginGetPeerName(context_
3029 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self))
3030 , arg0);
3031 if (s == NULL)
3032 {
3033 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3034 return NULL;
3035 }
3036 else
3037 {
3038 return env->NewStringUTF(s);
3039 }
3040 }
3041 catch (std::runtime_error& e)
3042 {
3043 JavaEnvironment::ThrowException(env, e.what());
3044 return NULL;
3045 }
3046 catch (...)
3047 {
3048 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3049 return NULL;
3050 }
3051 }
3052
3053
3054 JNIEXPORT jstring JNI_OrthancPluginGetPeerUrl(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
3055 {
3056 try
3057 {
3058 const char* s = OrthancPluginGetPeerUrl(context_
3059 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self))
3060 , arg0);
3061 if (s == NULL)
3062 {
3063 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3064 return NULL;
3065 }
3066 else
3067 {
3068 return env->NewStringUTF(s);
3069 }
3070 }
3071 catch (std::runtime_error& e)
3072 {
3073 JavaEnvironment::ThrowException(env, e.what());
3074 return NULL;
3075 }
3076 catch (...)
3077 {
3078 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3079 return NULL;
3080 }
3081 }
3082
3083
3084 JNIEXPORT jstring JNI_OrthancPluginGetPeerUserProperty(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jstring arg1)
3085 {
3086 try
3087 {
3088 JavaString c_arg1(env, arg1);
3089 const char* s = OrthancPluginGetPeerUserProperty(context_
3090 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self))
3091 , arg0, c_arg1.GetValue());
3092 if (s == NULL)
3093 {
3094 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3095 return NULL;
3096 }
3097 else
3098 {
3099 return env->NewStringUTF(s);
3100 }
3101 }
3102 catch (std::runtime_error& e)
3103 {
3104 JavaEnvironment::ThrowException(env, e.what());
3105 return NULL;
3106 }
3107 catch (...)
3108 {
3109 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3110 return NULL;
3111 }
3112 }
3113
3114
3115 JNIEXPORT void JNI_OrthancPluginAnswerBuffer(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0, jstring arg2)
3116 {
3117 try
3118 {
3119 JavaBytes c_arg0(env, arg0);
3120 JavaString c_arg2(env, arg2);
3121 OrthancPluginAnswerBuffer(context_
3122 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3123 , c_arg0.GetData(), c_arg0.GetSize(), c_arg2.GetValue());
3124 }
3125 catch (std::runtime_error& e)
3126 {
3127 JavaEnvironment::ThrowException(env, e.what());
3128 }
3129 catch (...)
3130 {
3131 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3132 }
3133 }
3134
3135
3136 JNIEXPORT void JNI_OrthancPluginCompressAndAnswerPngImage(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4)
3137 {
3138 try
3139 {
3140 JavaBytes c_arg4(env, arg4);
3141 OrthancPluginCompressAndAnswerPngImage(context_
3142 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3143 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData());
3144 }
3145 catch (std::runtime_error& e)
3146 {
3147 JavaEnvironment::ThrowException(env, e.what());
3148 }
3149 catch (...)
3150 {
3151 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3152 }
3153 }
3154
3155
3156 JNIEXPORT void JNI_OrthancPluginRedirect(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0)
3157 {
3158 try
3159 {
3160 JavaString c_arg0(env, arg0);
3161 OrthancPluginRedirect(context_
3162 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3163 , c_arg0.GetValue());
3164 }
3165 catch (std::runtime_error& e)
3166 {
3167 JavaEnvironment::ThrowException(env, e.what());
3168 }
3169 catch (...)
3170 {
3171 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3172 }
3173 }
3174
3175
3176 JNIEXPORT void JNI_OrthancPluginSendHttpStatusCode(JNIEnv* env, jobject sdkObject, jlong self, jshort arg0)
3177 {
3178 try
3179 {
3180 OrthancPluginSendHttpStatusCode(context_
3181 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3182 , arg0);
3183 }
3184 catch (std::runtime_error& e)
3185 {
3186 JavaEnvironment::ThrowException(env, e.what());
3187 }
3188 catch (...)
3189 {
3190 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3191 }
3192 }
3193
3194
3195 JNIEXPORT void JNI_OrthancPluginSendUnauthorized(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0)
3196 {
3197 try
3198 {
3199 JavaString c_arg0(env, arg0);
3200 OrthancPluginSendUnauthorized(context_
3201 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3202 , c_arg0.GetValue());
3203 }
3204 catch (std::runtime_error& e)
3205 {
3206 JavaEnvironment::ThrowException(env, e.what());
3207 }
3208 catch (...)
3209 {
3210 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3211 }
3212 }
3213
3214
3215 JNIEXPORT void JNI_OrthancPluginSendMethodNotAllowed(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0)
3216 {
3217 try
3218 {
3219 JavaString c_arg0(env, arg0);
3220 OrthancPluginSendMethodNotAllowed(context_
3221 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3222 , c_arg0.GetValue());
3223 }
3224 catch (std::runtime_error& e)
3225 {
3226 JavaEnvironment::ThrowException(env, e.what());
3227 }
3228 catch (...)
3229 {
3230 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3231 }
3232 }
3233
3234
3235 JNIEXPORT void JNI_OrthancPluginSetCookie(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1)
3236 {
3237 try
3238 {
3239 JavaString c_arg0(env, arg0);
3240 JavaString c_arg1(env, arg1);
3241 OrthancPluginSetCookie(context_
3242 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3243 , c_arg0.GetValue(), c_arg1.GetValue());
3244 }
3245 catch (std::runtime_error& e)
3246 {
3247 JavaEnvironment::ThrowException(env, e.what());
3248 }
3249 catch (...)
3250 {
3251 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3252 }
3253 }
3254
3255
3256 JNIEXPORT void JNI_OrthancPluginSetHttpHeader(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1)
3257 {
3258 try
3259 {
3260 JavaString c_arg0(env, arg0);
3261 JavaString c_arg1(env, arg1);
3262 OrthancPluginSetHttpHeader(context_
3263 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3264 , c_arg0.GetValue(), c_arg1.GetValue());
3265 }
3266 catch (std::runtime_error& e)
3267 {
3268 JavaEnvironment::ThrowException(env, e.what());
3269 }
3270 catch (...)
3271 {
3272 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3273 }
3274 }
3275
3276
3277 JNIEXPORT void JNI_OrthancPluginStartMultipartAnswer(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1)
3278 {
3279 try
3280 {
3281 JavaString c_arg0(env, arg0);
3282 JavaString c_arg1(env, arg1);
3283 OrthancPluginErrorCode code = OrthancPluginStartMultipartAnswer(context_
3284 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3285 , c_arg0.GetValue(), c_arg1.GetValue());
3286 if (code != OrthancPluginErrorCode_Success)
3287 {
3288 JavaEnvironment::ThrowException(env, code);
3289 }
3290 }
3291 catch (std::runtime_error& e)
3292 {
3293 JavaEnvironment::ThrowException(env, e.what());
3294 }
3295 catch (...)
3296 {
3297 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3298 }
3299 }
3300
3301
3302 JNIEXPORT void JNI_OrthancPluginSendMultipartItem(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0)
3303 {
3304 try
3305 {
3306 JavaBytes c_arg0(env, arg0);
3307 OrthancPluginErrorCode code = OrthancPluginSendMultipartItem(context_
3308 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3309 , c_arg0.GetData(), c_arg0.GetSize());
3310 if (code != OrthancPluginErrorCode_Success)
3311 {
3312 JavaEnvironment::ThrowException(env, code);
3313 }
3314 }
3315 catch (std::runtime_error& e)
3316 {
3317 JavaEnvironment::ThrowException(env, e.what());
3318 }
3319 catch (...)
3320 {
3321 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3322 }
3323 }
3324
3325
3326 JNIEXPORT void JNI_OrthancPluginSendHttpStatus(JNIEnv* env, jobject sdkObject, jlong self, jshort arg0, jbyteArray arg1)
3327 {
3328 try
3329 {
3330 JavaBytes c_arg1(env, arg1);
3331 OrthancPluginSendHttpStatus(context_
3332 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3333 , arg0, c_arg1.GetData(), c_arg1.GetSize());
3334 }
3335 catch (std::runtime_error& e)
3336 {
3337 JavaEnvironment::ThrowException(env, e.what());
3338 }
3339 catch (...)
3340 {
3341 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3342 }
3343 }
3344
3345
3346 JNIEXPORT void JNI_OrthancPluginCompressAndAnswerJpegImage(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4, jbyte arg5)
3347 {
3348 try
3349 {
3350 JavaBytes c_arg4(env, arg4);
3351 OrthancPluginCompressAndAnswerJpegImage(context_
3352 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3353 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData(), arg5);
3354 }
3355 catch (std::runtime_error& e)
3356 {
3357 JavaEnvironment::ThrowException(env, e.what());
3358 }
3359 catch (...)
3360 {
3361 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3362 }
3363 }
3364
3365
3366 JNIEXPORT void JNI_OrthancPluginSetHttpErrorDetails(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jbyte arg1)
3367 {
3368 try
3369 {
3370 JavaString c_arg0(env, arg0);
3371 OrthancPluginSetHttpErrorDetails(context_
3372 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self))
3373 , c_arg0.GetValue(), arg1);
3374 }
3375 catch (std::runtime_error& e)
3376 {
3377 JavaEnvironment::ThrowException(env, e.what());
3378 }
3379 catch (...)
3380 {
3381 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3382 }
3383 }
3384
3385
3386 JNIEXPORT void JNI_OrthancPluginStorageAreaCreate(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jbyteArray arg1, jlong arg2, jint arg3)
3387 {
3388 try
3389 {
3390 JavaString c_arg0(env, arg0);
3391 JavaBytes c_arg1(env, arg1);
3392 OrthancPluginErrorCode code = OrthancPluginStorageAreaCreate(context_
3393 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self))
3394 , c_arg0.GetValue(), c_arg1.GetData(), arg2, static_cast<OrthancPluginContentType>(arg3));
3395 if (code != OrthancPluginErrorCode_Success)
3396 {
3397 JavaEnvironment::ThrowException(env, code);
3398 }
3399 }
3400 catch (std::runtime_error& e)
3401 {
3402 JavaEnvironment::ThrowException(env, e.what());
3403 }
3404 catch (...)
3405 {
3406 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3407 }
3408 }
3409
3410
3411 JNIEXPORT jbyteArray JNI_OrthancPluginStorageAreaRead(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jint arg1)
3412 {
3413 try
3414 {
3415 JavaString c_arg0(env, arg0);
3416 OrthancBytes b;
3417 OrthancPluginErrorCode code = OrthancPluginStorageAreaRead(context_, b.GetMemoryBuffer()
3418 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self))
3419 , c_arg0.GetValue(), static_cast<OrthancPluginContentType>(arg1));
3420 if (code == OrthancPluginErrorCode_Success)
3421 {
3422 jbyteArray answer = env->NewByteArray(b.GetSize());
3423 if (answer == NULL)
3424 {
3425 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
3426 return NULL;
3427 }
3428 else
3429 {
3430 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
3431 return answer;
3432 }
3433 }
3434 else
3435 {
3436 JavaEnvironment::ThrowException(env, code);
3437 return NULL;
3438 }
3439 }
3440 catch (std::runtime_error& e)
3441 {
3442 JavaEnvironment::ThrowException(env, e.what());
3443 return NULL;
3444 }
3445 catch (...)
3446 {
3447 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3448 return NULL;
3449 }
3450 }
3451
3452
3453 JNIEXPORT void JNI_OrthancPluginStorageAreaRemove(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jint arg1)
3454 {
3455 try
3456 {
3457 JavaString c_arg0(env, arg0);
3458 OrthancPluginErrorCode code = OrthancPluginStorageAreaRemove(context_
3459 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self))
3460 , c_arg0.GetValue(), static_cast<OrthancPluginContentType>(arg1));
3461 if (code != OrthancPluginErrorCode_Success)
3462 {
3463 JavaEnvironment::ThrowException(env, code);
3464 }
3465 }
3466 catch (std::runtime_error& e)
3467 {
3468 JavaEnvironment::ThrowException(env, e.what());
3469 }
3470 catch (...)
3471 {
3472 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3473 }
3474 }
3475
3476
3477 JNIEXPORT void JNI_OrthancPluginReconstructMainDicomTags(JNIEnv* env, jobject sdkObject, jlong self, jint arg0)
3478 {
3479 try
3480 {
3481 OrthancPluginErrorCode code = OrthancPluginReconstructMainDicomTags(context_
3482 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self))
3483 , static_cast<OrthancPluginResourceType>(arg0));
3484 if (code != OrthancPluginErrorCode_Success)
3485 {
3486 JavaEnvironment::ThrowException(env, code);
3487 }
3488 }
3489 catch (std::runtime_error& e)
3490 {
3491 JavaEnvironment::ThrowException(env, e.what());
3492 }
3493 catch (...)
3494 {
3495 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3496 }
3497 }
3498
3499
3500 JNIEXPORT void JNI_OrthancPluginWorklistAddAnswer(JNIEnv* env, jobject sdkObject, jlong self, jlong arg0, jbyteArray arg1)
3501 {
3502 try
3503 {
3504 JavaBytes c_arg1(env, arg1);
3505 OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer(context_
3506 , reinterpret_cast<OrthancPluginWorklistAnswers*>(static_cast<intptr_t>(self))
3507 , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(arg0)), c_arg1.GetData(), c_arg1.GetSize());
3508 if (code != OrthancPluginErrorCode_Success)
3509 {
3510 JavaEnvironment::ThrowException(env, code);
3511 }
3512 }
3513 catch (std::runtime_error& e)
3514 {
3515 JavaEnvironment::ThrowException(env, e.what());
3516 }
3517 catch (...)
3518 {
3519 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3520 }
3521 }
3522
3523
3524 JNIEXPORT void JNI_OrthancPluginWorklistMarkIncomplete(JNIEnv* env, jobject sdkObject, jlong self)
3525 {
3526 try
3527 {
3528 OrthancPluginErrorCode code = OrthancPluginWorklistMarkIncomplete(context_
3529 , reinterpret_cast<OrthancPluginWorklistAnswers*>(static_cast<intptr_t>(self))
3530 );
3531 if (code != OrthancPluginErrorCode_Success)
3532 {
3533 JavaEnvironment::ThrowException(env, code);
3534 }
3535 }
3536 catch (std::runtime_error& e)
3537 {
3538 JavaEnvironment::ThrowException(env, e.what());
3539 }
3540 catch (...)
3541 {
3542 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3543 }
3544 }
3545
3546
3547 JNIEXPORT jint JNI_OrthancPluginWorklistIsMatch(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0)
3548 {
3549 try
3550 {
3551 JavaBytes c_arg0(env, arg0);
3552 return OrthancPluginWorklistIsMatch(context_
3553 , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(self))
3554 , c_arg0.GetData(), c_arg0.GetSize());
3555 }
3556 catch (std::runtime_error& e)
3557 {
3558 JavaEnvironment::ThrowException(env, e.what());
3559 return 0;
3560 }
3561 catch (...)
3562 {
3563 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3564 return 0;
3565 }
3566 }
3567
3568
3569 JNIEXPORT jbyteArray JNI_OrthancPluginWorklistGetDicomQuery(JNIEnv* env, jobject sdkObject, jlong self)
3570 {
3571 try
3572 {
3573 OrthancBytes b;
3574 OrthancPluginErrorCode code = OrthancPluginWorklistGetDicomQuery(context_, b.GetMemoryBuffer()
3575 , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(self))
3576 );
3577 if (code == OrthancPluginErrorCode_Success)
3578 {
3579 jbyteArray answer = env->NewByteArray(b.GetSize());
3580 if (answer == NULL)
3581 {
3582 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory);
3583 return NULL;
3584 }
3585 else
3586 {
3587 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData()));
3588 return answer;
3589 }
3590 }
3591 else
3592 {
3593 JavaEnvironment::ThrowException(env, code);
3594 return NULL;
3595 }
3596 }
3597 catch (std::runtime_error& e)
3598 {
3599 JavaEnvironment::ThrowException(env, e.what());
3600 return NULL;
3601 }
3602 catch (...)
3603 {
3604 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin);
3605 return NULL;
3606 }
3607 }
3608
3609
3610 static void JNI_LoadNatives(std::vector<JNINativeMethod>& methods)
3611 {
3612 methods.clear();
3613
3614 methods.push_back((JNINativeMethod) {
3615 const_cast<char*>("OrthancPluginCheckVersionAdvanced"),
3616 const_cast<char*>("(III)I"),
3617 (void*) JNI_OrthancPluginCheckVersionAdvanced
3618 });
3619
3620 methods.push_back((JNINativeMethod) {
3621 const_cast<char*>("OrthancPluginCheckVersion"),
3622 const_cast<char*>("()I"),
3623 (void*) JNI_OrthancPluginCheckVersion
3624 });
3625
3626 methods.push_back((JNINativeMethod) {
3627 const_cast<char*>("OrthancPluginLogError"),
3628 const_cast<char*>("(Ljava/lang/String;)V"),
3629 (void*) JNI_OrthancPluginLogError
3630 });
3631
3632 methods.push_back((JNINativeMethod) {
3633 const_cast<char*>("OrthancPluginLogWarning"),
3634 const_cast<char*>("(Ljava/lang/String;)V"),
3635 (void*) JNI_OrthancPluginLogWarning
3636 });
3637
3638 methods.push_back((JNINativeMethod) {
3639 const_cast<char*>("OrthancPluginLogInfo"),
3640 const_cast<char*>("(Ljava/lang/String;)V"),
3641 (void*) JNI_OrthancPluginLogInfo
3642 });
3643
3644 methods.push_back((JNINativeMethod) {
3645 const_cast<char*>("OrthancPluginGetDicomForInstance"),
3646 const_cast<char*>("(Ljava/lang/String;)[B"),
3647 (void*) JNI_OrthancPluginGetDicomForInstance
3648 });
3649
3650 methods.push_back((JNINativeMethod) {
3651 const_cast<char*>("OrthancPluginRestApiGet"),
3652 const_cast<char*>("(Ljava/lang/String;)[B"),
3653 (void*) JNI_OrthancPluginRestApiGet
3654 });
3655
3656 methods.push_back((JNINativeMethod) {
3657 const_cast<char*>("OrthancPluginRestApiGetAfterPlugins"),
3658 const_cast<char*>("(Ljava/lang/String;)[B"),
3659 (void*) JNI_OrthancPluginRestApiGetAfterPlugins
3660 });
3661
3662 methods.push_back((JNINativeMethod) {
3663 const_cast<char*>("OrthancPluginRestApiPost"),
3664 const_cast<char*>("(Ljava/lang/String;[B)[B"),
3665 (void*) JNI_OrthancPluginRestApiPost
3666 });
3667
3668 methods.push_back((JNINativeMethod) {
3669 const_cast<char*>("OrthancPluginRestApiPostAfterPlugins"),
3670 const_cast<char*>("(Ljava/lang/String;[B)[B"),
3671 (void*) JNI_OrthancPluginRestApiPostAfterPlugins
3672 });
3673
3674 methods.push_back((JNINativeMethod) {
3675 const_cast<char*>("OrthancPluginRestApiDelete"),
3676 const_cast<char*>("(Ljava/lang/String;)V"),
3677 (void*) JNI_OrthancPluginRestApiDelete
3678 });
3679
3680 methods.push_back((JNINativeMethod) {
3681 const_cast<char*>("OrthancPluginRestApiDeleteAfterPlugins"),
3682 const_cast<char*>("(Ljava/lang/String;)V"),
3683 (void*) JNI_OrthancPluginRestApiDeleteAfterPlugins
3684 });
3685
3686 methods.push_back((JNINativeMethod) {
3687 const_cast<char*>("OrthancPluginRestApiPut"),
3688 const_cast<char*>("(Ljava/lang/String;[B)[B"),
3689 (void*) JNI_OrthancPluginRestApiPut
3690 });
3691
3692 methods.push_back((JNINativeMethod) {
3693 const_cast<char*>("OrthancPluginRestApiPutAfterPlugins"),
3694 const_cast<char*>("(Ljava/lang/String;[B)[B"),
3695 (void*) JNI_OrthancPluginRestApiPutAfterPlugins
3696 });
3697
3698 methods.push_back((JNINativeMethod) {
3699 const_cast<char*>("OrthancPluginLookupPatient"),
3700 const_cast<char*>("(Ljava/lang/String;)Ljava/lang/String;"),
3701 (void*) JNI_OrthancPluginLookupPatient
3702 });
3703
3704 methods.push_back((JNINativeMethod) {
3705 const_cast<char*>("OrthancPluginLookupStudy"),
3706 const_cast<char*>("(Ljava/lang/String;)Ljava/lang/String;"),
3707 (void*) JNI_OrthancPluginLookupStudy
3708 });
3709
3710 methods.push_back((JNINativeMethod) {
3711 const_cast<char*>("OrthancPluginLookupStudyWithAccessionNumber"),
3712 const_cast<char*>("(Ljava/lang/String;)Ljava/lang/String;"),
3713 (void*) JNI_OrthancPluginLookupStudyWithAccessionNumber
3714 });
3715
3716 methods.push_back((JNINativeMethod) {
3717 const_cast<char*>("OrthancPluginLookupSeries"),
3718 const_cast<char*>("(Ljava/lang/String;)Ljava/lang/String;"),
3719 (void*) JNI_OrthancPluginLookupSeries
3720 });
3721
3722 methods.push_back((JNINativeMethod) {
3723 const_cast<char*>("OrthancPluginLookupInstance"),
3724 const_cast<char*>("(Ljava/lang/String;)Ljava/lang/String;"),
3725 (void*) JNI_OrthancPluginLookupInstance
3726 });
3727
3728 methods.push_back((JNINativeMethod) {
3729 const_cast<char*>("OrthancPluginGetOrthancPath"),
3730 const_cast<char*>("()Ljava/lang/String;"),
3731 (void*) JNI_OrthancPluginGetOrthancPath
3732 });
3733
3734 methods.push_back((JNINativeMethod) {
3735 const_cast<char*>("OrthancPluginGetOrthancDirectory"),
3736 const_cast<char*>("()Ljava/lang/String;"),
3737 (void*) JNI_OrthancPluginGetOrthancDirectory
3738 });
3739
3740 methods.push_back((JNINativeMethod) {
3741 const_cast<char*>("OrthancPluginGetConfigurationPath"),
3742 const_cast<char*>("()Ljava/lang/String;"),
3743 (void*) JNI_OrthancPluginGetConfigurationPath
3744 });
3745
3746 methods.push_back((JNINativeMethod) {
3747 const_cast<char*>("OrthancPluginSetRootUri"),
3748 const_cast<char*>("(Ljava/lang/String;)V"),
3749 (void*) JNI_OrthancPluginSetRootUri
3750 });
3751
3752 methods.push_back((JNINativeMethod) {
3753 const_cast<char*>("OrthancPluginSetDescription"),
3754 const_cast<char*>("(Ljava/lang/String;)V"),
3755 (void*) JNI_OrthancPluginSetDescription
3756 });
3757
3758 methods.push_back((JNINativeMethod) {
3759 const_cast<char*>("OrthancPluginExtendOrthancExplorer"),
3760 const_cast<char*>("(Ljava/lang/String;)V"),
3761 (void*) JNI_OrthancPluginExtendOrthancExplorer
3762 });
3763
3764 methods.push_back((JNINativeMethod) {
3765 const_cast<char*>("OrthancPluginGetGlobalProperty"),
3766 const_cast<char*>("(ILjava/lang/String;)Ljava/lang/String;"),
3767 (void*) JNI_OrthancPluginGetGlobalProperty
3768 });
3769
3770 methods.push_back((JNINativeMethod) {
3771 const_cast<char*>("OrthancPluginSetGlobalProperty"),
3772 const_cast<char*>("(ILjava/lang/String;)V"),
3773 (void*) JNI_OrthancPluginSetGlobalProperty
3774 });
3775
3776 methods.push_back((JNINativeMethod) {
3777 const_cast<char*>("OrthancPluginGetCommandLineArgumentsCount"),
3778 const_cast<char*>("()I"),
3779 (void*) JNI_OrthancPluginGetCommandLineArgumentsCount
3780 });
3781
3782 methods.push_back((JNINativeMethod) {
3783 const_cast<char*>("OrthancPluginGetCommandLineArgument"),
3784 const_cast<char*>("(I)Ljava/lang/String;"),
3785 (void*) JNI_OrthancPluginGetCommandLineArgument
3786 });
3787
3788 methods.push_back((JNINativeMethod) {
3789 const_cast<char*>("OrthancPluginGetExpectedDatabaseVersion"),
3790 const_cast<char*>("()I"),
3791 (void*) JNI_OrthancPluginGetExpectedDatabaseVersion
3792 });
3793
3794 methods.push_back((JNINativeMethod) {
3795 const_cast<char*>("OrthancPluginGetConfiguration"),
3796 const_cast<char*>("()Ljava/lang/String;"),
3797 (void*) JNI_OrthancPluginGetConfiguration
3798 });
3799
3800 methods.push_back((JNINativeMethod) {
3801 const_cast<char*>("OrthancPluginBufferCompression"),
3802 const_cast<char*>("([BIB)[B"),
3803 (void*) JNI_OrthancPluginBufferCompression
3804 });
3805
3806 methods.push_back((JNINativeMethod) {
3807 const_cast<char*>("OrthancPluginReadFile"),
3808 const_cast<char*>("(Ljava/lang/String;)[B"),
3809 (void*) JNI_OrthancPluginReadFile
3810 });
3811
3812 methods.push_back((JNINativeMethod) {
3813 const_cast<char*>("OrthancPluginWriteFile"),
3814 const_cast<char*>("(Ljava/lang/String;[B)V"),
3815 (void*) JNI_OrthancPluginWriteFile
3816 });
3817
3818 methods.push_back((JNINativeMethod) {
3819 const_cast<char*>("OrthancPluginGetErrorDescription"),
3820 const_cast<char*>("(I)Ljava/lang/String;"),
3821 (void*) JNI_OrthancPluginGetErrorDescription
3822 });
3823
3824 methods.push_back((JNINativeMethod) {
3825 const_cast<char*>("OrthancPluginUncompressImage"),
3826 const_cast<char*>("([BI)J"),
3827 (void*) JNI_OrthancPluginUncompressImage
3828 });
3829
3830 methods.push_back((JNINativeMethod) {
3831 const_cast<char*>("OrthancPluginCompressPngImage"),
3832 const_cast<char*>("(IIII[B)[B"),
3833 (void*) JNI_OrthancPluginCompressPngImage
3834 });
3835
3836 methods.push_back((JNINativeMethod) {
3837 const_cast<char*>("OrthancPluginCompressJpegImage"),
3838 const_cast<char*>("(IIII[BB)[B"),
3839 (void*) JNI_OrthancPluginCompressJpegImage
3840 });
3841
3842 methods.push_back((JNINativeMethod) {
3843 const_cast<char*>("OrthancPluginHttpGet"),
3844 const_cast<char*>("(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)[B"),
3845 (void*) JNI_OrthancPluginHttpGet
3846 });
3847
3848 methods.push_back((JNINativeMethod) {
3849 const_cast<char*>("OrthancPluginHttpPost"),
3850 const_cast<char*>("(Ljava/lang/String;[BLjava/lang/String;Ljava/lang/String;)[B"),
3851 (void*) JNI_OrthancPluginHttpPost
3852 });
3853
3854 methods.push_back((JNINativeMethod) {
3855 const_cast<char*>("OrthancPluginHttpPut"),
3856 const_cast<char*>("(Ljava/lang/String;[BLjava/lang/String;Ljava/lang/String;)[B"),
3857 (void*) JNI_OrthancPluginHttpPut
3858 });
3859
3860 methods.push_back((JNINativeMethod) {
3861 const_cast<char*>("OrthancPluginHttpDelete"),
3862 const_cast<char*>("(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"),
3863 (void*) JNI_OrthancPluginHttpDelete
3864 });
3865
3866 methods.push_back((JNINativeMethod) {
3867 const_cast<char*>("OrthancPluginGetFontsCount"),
3868 const_cast<char*>("()I"),
3869 (void*) JNI_OrthancPluginGetFontsCount
3870 });
3871
3872 methods.push_back((JNINativeMethod) {
3873 const_cast<char*>("OrthancPluginGetFontName"),
3874 const_cast<char*>("(I)Ljava/lang/String;"),
3875 (void*) JNI_OrthancPluginGetFontName
3876 });
3877
3878 methods.push_back((JNINativeMethod) {
3879 const_cast<char*>("OrthancPluginGetFontSize"),
3880 const_cast<char*>("(I)I"),
3881 (void*) JNI_OrthancPluginGetFontSize
3882 });
3883
3884 methods.push_back((JNINativeMethod) {
3885 const_cast<char*>("OrthancPluginRegisterErrorCode"),
3886 const_cast<char*>("(ISLjava/lang/String;)V"),
3887 (void*) JNI_OrthancPluginRegisterErrorCode
3888 });
3889
3890 methods.push_back((JNINativeMethod) {
3891 const_cast<char*>("OrthancPluginRegisterDictionaryTag"),
3892 const_cast<char*>("(SSILjava/lang/String;II)V"),
3893 (void*) JNI_OrthancPluginRegisterDictionaryTag
3894 });
3895
3896 methods.push_back((JNINativeMethod) {
3897 const_cast<char*>("OrthancPluginRegisterPrivateDictionaryTag"),
3898 const_cast<char*>("(SSILjava/lang/String;IILjava/lang/String;)V"),
3899 (void*) JNI_OrthancPluginRegisterPrivateDictionaryTag
3900 });
3901
3902 methods.push_back((JNINativeMethod) {
3903 const_cast<char*>("OrthancPluginDicomBufferToJson"),
3904 const_cast<char*>("([BIII)Ljava/lang/String;"),
3905 (void*) JNI_OrthancPluginDicomBufferToJson
3906 });
3907
3908 methods.push_back((JNINativeMethod) {
3909 const_cast<char*>("OrthancPluginDicomInstanceToJson"),
3910 const_cast<char*>("(Ljava/lang/String;III)Ljava/lang/String;"),
3911 (void*) JNI_OrthancPluginDicomInstanceToJson
3912 });
3913
3914 methods.push_back((JNINativeMethod) {
3915 const_cast<char*>("OrthancPluginCreateDicom"),
3916 const_cast<char*>("(Ljava/lang/String;JI)[B"),
3917 (void*) JNI_OrthancPluginCreateDicom
3918 });
3919
3920 methods.push_back((JNINativeMethod) {
3921 const_cast<char*>("OrthancPluginCreateImage"),
3922 const_cast<char*>("(III)J"),
3923 (void*) JNI_OrthancPluginCreateImage
3924 });
3925
3926 methods.push_back((JNINativeMethod) {
3927 const_cast<char*>("OrthancPluginDecodeDicomImage"),
3928 const_cast<char*>("([BI)J"),
3929 (void*) JNI_OrthancPluginDecodeDicomImage
3930 });
3931
3932 methods.push_back((JNINativeMethod) {
3933 const_cast<char*>("OrthancPluginComputeMd5"),
3934 const_cast<char*>("([B)Ljava/lang/String;"),
3935 (void*) JNI_OrthancPluginComputeMd5
3936 });
3937
3938 methods.push_back((JNINativeMethod) {
3939 const_cast<char*>("OrthancPluginComputeSha1"),
3940 const_cast<char*>("([B)Ljava/lang/String;"),
3941 (void*) JNI_OrthancPluginComputeSha1
3942 });
3943
3944 methods.push_back((JNINativeMethod) {
3945 const_cast<char*>("OrthancPluginGenerateUuid"),
3946 const_cast<char*>("()Ljava/lang/String;"),
3947 (void*) JNI_OrthancPluginGenerateUuid
3948 });
3949
3950 methods.push_back((JNINativeMethod) {
3951 const_cast<char*>("OrthancPluginCreateFindMatcher"),
3952 const_cast<char*>("([B)J"),
3953 (void*) JNI_OrthancPluginCreateFindMatcher
3954 });
3955
3956 methods.push_back((JNINativeMethod) {
3957 const_cast<char*>("OrthancPluginGetPeers"),
3958 const_cast<char*>("()J"),
3959 (void*) JNI_OrthancPluginGetPeers
3960 });
3961
3962 methods.push_back((JNINativeMethod) {
3963 const_cast<char*>("OrthancPluginAutodetectMimeType"),
3964 const_cast<char*>("(Ljava/lang/String;)Ljava/lang/String;"),
3965 (void*) JNI_OrthancPluginAutodetectMimeType
3966 });
3967
3968 methods.push_back((JNINativeMethod) {
3969 const_cast<char*>("OrthancPluginSetMetricsValue"),
3970 const_cast<char*>("(Ljava/lang/String;FI)V"),
3971 (void*) JNI_OrthancPluginSetMetricsValue
3972 });
3973
3974 methods.push_back((JNINativeMethod) {
3975 const_cast<char*>("OrthancPluginGetTagName"),
3976 const_cast<char*>("(SSLjava/lang/String;)Ljava/lang/String;"),
3977 (void*) JNI_OrthancPluginGetTagName
3978 });
3979
3980 methods.push_back((JNINativeMethod) {
3981 const_cast<char*>("OrthancPluginCreateDicomInstance"),
3982 const_cast<char*>("([B)J"),
3983 (void*) JNI_OrthancPluginCreateDicomInstance
3984 });
3985
3986 methods.push_back((JNINativeMethod) {
3987 const_cast<char*>("OrthancPluginTranscodeDicomInstance"),
3988 const_cast<char*>("([BLjava/lang/String;)J"),
3989 (void*) JNI_OrthancPluginTranscodeDicomInstance
3990 });
3991
3992 methods.push_back((JNINativeMethod) {
3993 const_cast<char*>("OrthancPluginGenerateRestApiAuthorizationToken"),
3994 const_cast<char*>("()Ljava/lang/String;"),
3995 (void*) JNI_OrthancPluginGenerateRestApiAuthorizationToken
3996 });
3997
3998 methods.push_back((JNINativeMethod) {
3999 const_cast<char*>("OrthancPluginCreateDicom2"),
4000 const_cast<char*>("(Ljava/lang/String;JILjava/lang/String;)[B"),
4001 (void*) JNI_OrthancPluginCreateDicom2
4002 });
4003
4004 methods.push_back((JNINativeMethod) {
4005 const_cast<char*>("OrthancPluginFreeDicomInstance"),
4006 const_cast<char*>("(J)V"),
4007 (void*) JNI_OrthancPluginFreeDicomInstance
4008 });
4009
4010 methods.push_back((JNINativeMethod) {
4011 const_cast<char*>("OrthancPluginGetInstanceRemoteAet"),
4012 const_cast<char*>("(J)Ljava/lang/String;"),
4013 (void*) JNI_OrthancPluginGetInstanceRemoteAet
4014 });
4015
4016 methods.push_back((JNINativeMethod) {
4017 const_cast<char*>("OrthancPluginGetInstanceSize"),
4018 const_cast<char*>("(J)J"),
4019 (void*) JNI_OrthancPluginGetInstanceSize
4020 });
4021
4022 methods.push_back((JNINativeMethod) {
4023 const_cast<char*>("OrthancPluginGetInstanceJson"),
4024 const_cast<char*>("(J)Ljava/lang/String;"),
4025 (void*) JNI_OrthancPluginGetInstanceJson
4026 });
4027
4028 methods.push_back((JNINativeMethod) {
4029 const_cast<char*>("OrthancPluginGetInstanceSimplifiedJson"),
4030 const_cast<char*>("(J)Ljava/lang/String;"),
4031 (void*) JNI_OrthancPluginGetInstanceSimplifiedJson
4032 });
4033
4034 methods.push_back((JNINativeMethod) {
4035 const_cast<char*>("OrthancPluginHasInstanceMetadata"),
4036 const_cast<char*>("(JLjava/lang/String;)I"),
4037 (void*) JNI_OrthancPluginHasInstanceMetadata
4038 });
4039
4040 methods.push_back((JNINativeMethod) {
4041 const_cast<char*>("OrthancPluginGetInstanceMetadata"),
4042 const_cast<char*>("(JLjava/lang/String;)Ljava/lang/String;"),
4043 (void*) JNI_OrthancPluginGetInstanceMetadata
4044 });
4045
4046 methods.push_back((JNINativeMethod) {
4047 const_cast<char*>("OrthancPluginGetInstanceOrigin"),
4048 const_cast<char*>("(J)I"),
4049 (void*) JNI_OrthancPluginGetInstanceOrigin
4050 });
4051
4052 methods.push_back((JNINativeMethod) {
4053 const_cast<char*>("OrthancPluginGetInstanceTransferSyntaxUid"),
4054 const_cast<char*>("(J)Ljava/lang/String;"),
4055 (void*) JNI_OrthancPluginGetInstanceTransferSyntaxUid
4056 });
4057
4058 methods.push_back((JNINativeMethod) {
4059 const_cast<char*>("OrthancPluginHasInstancePixelData"),
4060 const_cast<char*>("(J)I"),
4061 (void*) JNI_OrthancPluginHasInstancePixelData
4062 });
4063
4064 methods.push_back((JNINativeMethod) {
4065 const_cast<char*>("OrthancPluginGetInstanceFramesCount"),
4066 const_cast<char*>("(J)I"),
4067 (void*) JNI_OrthancPluginGetInstanceFramesCount
4068 });
4069
4070 methods.push_back((JNINativeMethod) {
4071 const_cast<char*>("OrthancPluginGetInstanceRawFrame"),
4072 const_cast<char*>("(JI)[B"),
4073 (void*) JNI_OrthancPluginGetInstanceRawFrame
4074 });
4075
4076 methods.push_back((JNINativeMethod) {
4077 const_cast<char*>("OrthancPluginGetInstanceDecodedFrame"),
4078 const_cast<char*>("(JI)J"),
4079 (void*) JNI_OrthancPluginGetInstanceDecodedFrame
4080 });
4081
4082 methods.push_back((JNINativeMethod) {
4083 const_cast<char*>("OrthancPluginSerializeDicomInstance"),
4084 const_cast<char*>("(J)[B"),
4085 (void*) JNI_OrthancPluginSerializeDicomInstance
4086 });
4087
4088 methods.push_back((JNINativeMethod) {
4089 const_cast<char*>("OrthancPluginGetInstanceAdvancedJson"),
4090 const_cast<char*>("(JIII)Ljava/lang/String;"),
4091 (void*) JNI_OrthancPluginGetInstanceAdvancedJson
4092 });
4093
4094 methods.push_back((JNINativeMethod) {
4095 const_cast<char*>("OrthancPluginFindAddAnswer"),
4096 const_cast<char*>("(J[B)V"),
4097 (void*) JNI_OrthancPluginFindAddAnswer
4098 });
4099
4100 methods.push_back((JNINativeMethod) {
4101 const_cast<char*>("OrthancPluginFindMarkIncomplete"),
4102 const_cast<char*>("(J)V"),
4103 (void*) JNI_OrthancPluginFindMarkIncomplete
4104 });
4105
4106 methods.push_back((JNINativeMethod) {
4107 const_cast<char*>("OrthancPluginFreeFindMatcher"),
4108 const_cast<char*>("(J)V"),
4109 (void*) JNI_OrthancPluginFreeFindMatcher
4110 });
4111
4112 methods.push_back((JNINativeMethod) {
4113 const_cast<char*>("OrthancPluginFindMatcherIsMatch"),
4114 const_cast<char*>("(J[B)I"),
4115 (void*) JNI_OrthancPluginFindMatcherIsMatch
4116 });
4117
4118 methods.push_back((JNINativeMethod) {
4119 const_cast<char*>("OrthancPluginGetFindQuerySize"),
4120 const_cast<char*>("(J)I"),
4121 (void*) JNI_OrthancPluginGetFindQuerySize
4122 });
4123
4124 methods.push_back((JNINativeMethod) {
4125 const_cast<char*>("OrthancPluginGetFindQueryTagName"),
4126 const_cast<char*>("(JI)Ljava/lang/String;"),
4127 (void*) JNI_OrthancPluginGetFindQueryTagName
4128 });
4129
4130 methods.push_back((JNINativeMethod) {
4131 const_cast<char*>("OrthancPluginGetFindQueryValue"),
4132 const_cast<char*>("(JI)Ljava/lang/String;"),
4133 (void*) JNI_OrthancPluginGetFindQueryValue
4134 });
4135
4136 methods.push_back((JNINativeMethod) {
4137 const_cast<char*>("OrthancPluginFreeImage"),
4138 const_cast<char*>("(J)V"),
4139 (void*) JNI_OrthancPluginFreeImage
4140 });
4141
4142 methods.push_back((JNINativeMethod) {
4143 const_cast<char*>("OrthancPluginGetImagePixelFormat"),
4144 const_cast<char*>("(J)I"),
4145 (void*) JNI_OrthancPluginGetImagePixelFormat
4146 });
4147
4148 methods.push_back((JNINativeMethod) {
4149 const_cast<char*>("OrthancPluginGetImageWidth"),
4150 const_cast<char*>("(J)I"),
4151 (void*) JNI_OrthancPluginGetImageWidth
4152 });
4153
4154 methods.push_back((JNINativeMethod) {
4155 const_cast<char*>("OrthancPluginGetImageHeight"),
4156 const_cast<char*>("(J)I"),
4157 (void*) JNI_OrthancPluginGetImageHeight
4158 });
4159
4160 methods.push_back((JNINativeMethod) {
4161 const_cast<char*>("OrthancPluginGetImagePitch"),
4162 const_cast<char*>("(J)I"),
4163 (void*) JNI_OrthancPluginGetImagePitch
4164 });
4165
4166 methods.push_back((JNINativeMethod) {
4167 const_cast<char*>("OrthancPluginConvertPixelFormat"),
4168 const_cast<char*>("(JI)J"),
4169 (void*) JNI_OrthancPluginConvertPixelFormat
4170 });
4171
4172 methods.push_back((JNINativeMethod) {
4173 const_cast<char*>("OrthancPluginDrawText"),
4174 const_cast<char*>("(JILjava/lang/String;IIBBB)V"),
4175 (void*) JNI_OrthancPluginDrawText
4176 });
4177
4178 methods.push_back((JNINativeMethod) {
4179 const_cast<char*>("OrthancPluginFreeJob"),
4180 const_cast<char*>("(J)V"),
4181 (void*) JNI_OrthancPluginFreeJob
4182 });
4183
4184 methods.push_back((JNINativeMethod) {
4185 const_cast<char*>("OrthancPluginSubmitJob"),
4186 const_cast<char*>("(JI)Ljava/lang/String;"),
4187 (void*) JNI_OrthancPluginSubmitJob
4188 });
4189
4190 methods.push_back((JNINativeMethod) {
4191 const_cast<char*>("OrthancPluginFreePeers"),
4192 const_cast<char*>("(J)V"),
4193 (void*) JNI_OrthancPluginFreePeers
4194 });
4195
4196 methods.push_back((JNINativeMethod) {
4197 const_cast<char*>("OrthancPluginGetPeersCount"),
4198 const_cast<char*>("(J)I"),
4199 (void*) JNI_OrthancPluginGetPeersCount
4200 });
4201
4202 methods.push_back((JNINativeMethod) {
4203 const_cast<char*>("OrthancPluginGetPeerName"),
4204 const_cast<char*>("(JI)Ljava/lang/String;"),
4205 (void*) JNI_OrthancPluginGetPeerName
4206 });
4207
4208 methods.push_back((JNINativeMethod) {
4209 const_cast<char*>("OrthancPluginGetPeerUrl"),
4210 const_cast<char*>("(JI)Ljava/lang/String;"),
4211 (void*) JNI_OrthancPluginGetPeerUrl
4212 });
4213
4214 methods.push_back((JNINativeMethod) {
4215 const_cast<char*>("OrthancPluginGetPeerUserProperty"),
4216 const_cast<char*>("(JILjava/lang/String;)Ljava/lang/String;"),
4217 (void*) JNI_OrthancPluginGetPeerUserProperty
4218 });
4219
4220 methods.push_back((JNINativeMethod) {
4221 const_cast<char*>("OrthancPluginAnswerBuffer"),
4222 const_cast<char*>("(J[BLjava/lang/String;)V"),
4223 (void*) JNI_OrthancPluginAnswerBuffer
4224 });
4225
4226 methods.push_back((JNINativeMethod) {
4227 const_cast<char*>("OrthancPluginCompressAndAnswerPngImage"),
4228 const_cast<char*>("(JIIII[B)V"),
4229 (void*) JNI_OrthancPluginCompressAndAnswerPngImage
4230 });
4231
4232 methods.push_back((JNINativeMethod) {
4233 const_cast<char*>("OrthancPluginRedirect"),
4234 const_cast<char*>("(JLjava/lang/String;)V"),
4235 (void*) JNI_OrthancPluginRedirect
4236 });
4237
4238 methods.push_back((JNINativeMethod) {
4239 const_cast<char*>("OrthancPluginSendHttpStatusCode"),
4240 const_cast<char*>("(JS)V"),
4241 (void*) JNI_OrthancPluginSendHttpStatusCode
4242 });
4243
4244 methods.push_back((JNINativeMethod) {
4245 const_cast<char*>("OrthancPluginSendUnauthorized"),
4246 const_cast<char*>("(JLjava/lang/String;)V"),
4247 (void*) JNI_OrthancPluginSendUnauthorized
4248 });
4249
4250 methods.push_back((JNINativeMethod) {
4251 const_cast<char*>("OrthancPluginSendMethodNotAllowed"),
4252 const_cast<char*>("(JLjava/lang/String;)V"),
4253 (void*) JNI_OrthancPluginSendMethodNotAllowed
4254 });
4255
4256 methods.push_back((JNINativeMethod) {
4257 const_cast<char*>("OrthancPluginSetCookie"),
4258 const_cast<char*>("(JLjava/lang/String;Ljava/lang/String;)V"),
4259 (void*) JNI_OrthancPluginSetCookie
4260 });
4261
4262 methods.push_back((JNINativeMethod) {
4263 const_cast<char*>("OrthancPluginSetHttpHeader"),
4264 const_cast<char*>("(JLjava/lang/String;Ljava/lang/String;)V"),
4265 (void*) JNI_OrthancPluginSetHttpHeader
4266 });
4267
4268 methods.push_back((JNINativeMethod) {
4269 const_cast<char*>("OrthancPluginStartMultipartAnswer"),
4270 const_cast<char*>("(JLjava/lang/String;Ljava/lang/String;)V"),
4271 (void*) JNI_OrthancPluginStartMultipartAnswer
4272 });
4273
4274 methods.push_back((JNINativeMethod) {
4275 const_cast<char*>("OrthancPluginSendMultipartItem"),
4276 const_cast<char*>("(J[B)V"),
4277 (void*) JNI_OrthancPluginSendMultipartItem
4278 });
4279
4280 methods.push_back((JNINativeMethod) {
4281 const_cast<char*>("OrthancPluginSendHttpStatus"),
4282 const_cast<char*>("(JS[B)V"),
4283 (void*) JNI_OrthancPluginSendHttpStatus
4284 });
4285
4286 methods.push_back((JNINativeMethod) {
4287 const_cast<char*>("OrthancPluginCompressAndAnswerJpegImage"),
4288 const_cast<char*>("(JIIII[BB)V"),
4289 (void*) JNI_OrthancPluginCompressAndAnswerJpegImage
4290 });
4291
4292 methods.push_back((JNINativeMethod) {
4293 const_cast<char*>("OrthancPluginSetHttpErrorDetails"),
4294 const_cast<char*>("(JLjava/lang/String;B)V"),
4295 (void*) JNI_OrthancPluginSetHttpErrorDetails
4296 });
4297
4298 methods.push_back((JNINativeMethod) {
4299 const_cast<char*>("OrthancPluginStorageAreaCreate"),
4300 const_cast<char*>("(JLjava/lang/String;[BJI)V"),
4301 (void*) JNI_OrthancPluginStorageAreaCreate
4302 });
4303
4304 methods.push_back((JNINativeMethod) {
4305 const_cast<char*>("OrthancPluginStorageAreaRead"),
4306 const_cast<char*>("(JLjava/lang/String;I)[B"),
4307 (void*) JNI_OrthancPluginStorageAreaRead
4308 });
4309
4310 methods.push_back((JNINativeMethod) {
4311 const_cast<char*>("OrthancPluginStorageAreaRemove"),
4312 const_cast<char*>("(JLjava/lang/String;I)V"),
4313 (void*) JNI_OrthancPluginStorageAreaRemove
4314 });
4315
4316 methods.push_back((JNINativeMethod) {
4317 const_cast<char*>("OrthancPluginReconstructMainDicomTags"),
4318 const_cast<char*>("(JI)V"),
4319 (void*) JNI_OrthancPluginReconstructMainDicomTags
4320 });
4321
4322 methods.push_back((JNINativeMethod) {
4323 const_cast<char*>("OrthancPluginWorklistAddAnswer"),
4324 const_cast<char*>("(JJ[B)V"),
4325 (void*) JNI_OrthancPluginWorklistAddAnswer
4326 });
4327
4328 methods.push_back((JNINativeMethod) {
4329 const_cast<char*>("OrthancPluginWorklistMarkIncomplete"),
4330 const_cast<char*>("(J)V"),
4331 (void*) JNI_OrthancPluginWorklistMarkIncomplete
4332 });
4333
4334 methods.push_back((JNINativeMethod) {
4335 const_cast<char*>("OrthancPluginWorklistIsMatch"),
4336 const_cast<char*>("(J[B)I"),
4337 (void*) JNI_OrthancPluginWorklistIsMatch
4338 });
4339
4340 methods.push_back((JNINativeMethod) {
4341 const_cast<char*>("OrthancPluginWorklistGetDicomQuery"),
4342 const_cast<char*>("(J)[B"),
4343 (void*) JNI_OrthancPluginWorklistGetDicomQuery
4344 });
4345 }