comparison Sources/Autogenerated/sdk_GlobalFunctions.impl.h @ 184:f34f3a149c22 java-code-model

added class PythonThreadsAllower
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Jul 2024 15:49:05 +0200
parents 194ba7d6e0f4
children 55473de7694f
comparison
equal deleted inserted replaced
183:d31f216c9462 184:f34f3a149c22
29 { 29 {
30 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 30 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
31 return NULL; 31 return NULL;
32 } 32 }
33 33
34 const char* s = OrthancPluginAutodetectMimeType(OrthancPlugins::GetGlobalContext(), arg0); 34 const char* s;
35 {
36 PythonThreadsAllower allower;
37 s = OrthancPluginAutodetectMimeType(OrthancPlugins::GetGlobalContext(), arg0);
38 }
35 39
36 if (s == NULL) 40 if (s == NULL)
37 { 41 {
38 Py_INCREF(Py_None); 42 Py_INCREF(Py_None);
39 return Py_None; 43 return Py_None;
57 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 61 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
58 return NULL; 62 return NULL;
59 } 63 }
60 64
61 OrthancPlugins::MemoryBuffer buffer; 65 OrthancPlugins::MemoryBuffer buffer;
62 OrthancPluginErrorCode code = OrthancPluginBufferCompression(OrthancPlugins::GetGlobalContext(), *buffer, arg0.buf, arg0.len, static_cast<OrthancPluginCompressionType>(arg2), arg3); 66 OrthancPluginErrorCode code;
67 {
68 PythonThreadsAllower allower;
69 code = OrthancPluginBufferCompression(OrthancPlugins::GetGlobalContext(), *buffer, arg0.buf, arg0.len, static_cast<OrthancPluginCompressionType>(arg2), arg3);
70 }
63 PyBuffer_Release(&arg0); 71 PyBuffer_Release(&arg0);
64 if (code == OrthancPluginErrorCode_Success) 72 if (code == OrthancPluginErrorCode_Success)
65 { 73 {
66 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 74 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
67 } 75 }
76 { 84 {
77 PythonLock::LogCall("Calling Python global function: OrthancPluginCheckVersion()"); 85 PythonLock::LogCall("Calling Python global function: OrthancPluginCheckVersion()");
78 86
79 87
80 88
81 long value = OrthancPluginCheckVersion(OrthancPlugins::GetGlobalContext()); 89 long value;
90 {
91 PythonThreadsAllower allower;
92 value = OrthancPluginCheckVersion(OrthancPlugins::GetGlobalContext());
93 }
82 94
83 return PyLong_FromLong(value); 95 return PyLong_FromLong(value);
84 } 96 }
85 97
86 static PyObject* sdk_OrthancPluginCheckVersionAdvanced(PyObject* module, PyObject* args) 98 static PyObject* sdk_OrthancPluginCheckVersionAdvanced(PyObject* module, PyObject* args)
95 { 107 {
96 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 108 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
97 return NULL; 109 return NULL;
98 } 110 }
99 111
100 long value = OrthancPluginCheckVersionAdvanced(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); 112 long value;
113 {
114 PythonThreadsAllower allower;
115 value = OrthancPluginCheckVersionAdvanced(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2);
116 }
101 117
102 return PyLong_FromLong(value); 118 return PyLong_FromLong(value);
103 } 119 }
104 120
105 static PyObject* sdk_OrthancPluginCompressJpegImage(PyObject* module, PyObject* args) 121 static PyObject* sdk_OrthancPluginCompressJpegImage(PyObject* module, PyObject* args)
118 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); 134 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)");
119 return NULL; 135 return NULL;
120 } 136 }
121 137
122 OrthancPlugins::MemoryBuffer buffer; 138 OrthancPlugins::MemoryBuffer buffer;
123 OrthancPluginErrorCode code = OrthancPluginCompressJpegImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf, arg5); 139 OrthancPluginErrorCode code;
140 {
141 PythonThreadsAllower allower;
142 code = OrthancPluginCompressJpegImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf, arg5);
143 }
124 PyBuffer_Release(&arg4); 144 PyBuffer_Release(&arg4);
125 if (code == OrthancPluginErrorCode_Success) 145 if (code == OrthancPluginErrorCode_Success)
126 { 146 {
127 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 147 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
128 } 148 }
148 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (5 arguments expected)"); 168 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (5 arguments expected)");
149 return NULL; 169 return NULL;
150 } 170 }
151 171
152 OrthancPlugins::MemoryBuffer buffer; 172 OrthancPlugins::MemoryBuffer buffer;
153 OrthancPluginErrorCode code = OrthancPluginCompressPngImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf); 173 OrthancPluginErrorCode code;
174 {
175 PythonThreadsAllower allower;
176 code = OrthancPluginCompressPngImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf);
177 }
154 PyBuffer_Release(&arg4); 178 PyBuffer_Release(&arg4);
155 if (code == OrthancPluginErrorCode_Success) 179 if (code == OrthancPluginErrorCode_Success)
156 { 180 {
157 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 181 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
158 } 182 }
174 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 198 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
175 return NULL; 199 return NULL;
176 } 200 }
177 201
178 OrthancPlugins::OrthancString s; 202 OrthancPlugins::OrthancString s;
179 s.Assign(OrthancPluginComputeMd5(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); 203 {
204 PythonThreadsAllower allower;
205 s.Assign(OrthancPluginComputeMd5(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len));
206 }
180 PyBuffer_Release(&arg0); 207 PyBuffer_Release(&arg0);
181 if (s.GetContent() == NULL) 208 if (s.GetContent() == NULL)
182 { 209 {
183 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 210 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
184 return NULL; 211 return NULL;
200 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 227 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
201 return NULL; 228 return NULL;
202 } 229 }
203 230
204 OrthancPlugins::OrthancString s; 231 OrthancPlugins::OrthancString s;
205 s.Assign(OrthancPluginComputeSha1(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); 232 {
233 PythonThreadsAllower allower;
234 s.Assign(OrthancPluginComputeSha1(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len));
235 }
206 PyBuffer_Release(&arg0); 236 PyBuffer_Release(&arg0);
207 if (s.GetContent() == NULL) 237 if (s.GetContent() == NULL)
208 { 238 {
209 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 239 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
210 return NULL; 240 return NULL;
234 PyErr_SetString(PyExc_TypeError, "Invalid orthanc.OrthancPluginImage object"); 264 PyErr_SetString(PyExc_TypeError, "Invalid orthanc.OrthancPluginImage object");
235 return NULL; 265 return NULL;
236 } 266 }
237 267
238 OrthancPlugins::MemoryBuffer buffer; 268 OrthancPlugins::MemoryBuffer buffer;
239 OrthancPluginErrorCode code = OrthancPluginCreateDicom(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1 == Py_None ? NULL : reinterpret_cast<sdk_OrthancPluginImage_Object*>(arg1)->object_, static_cast<OrthancPluginCreateDicomFlags>(arg2)); 269 OrthancPluginErrorCode code;
270 {
271 PythonThreadsAllower allower;
272 code = OrthancPluginCreateDicom(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1 == Py_None ? NULL : reinterpret_cast<sdk_OrthancPluginImage_Object*>(arg1)->object_, static_cast<OrthancPluginCreateDicomFlags>(arg2));
273 }
240 274
241 if (code == OrthancPluginErrorCode_Success) 275 if (code == OrthancPluginErrorCode_Success)
242 { 276 {
243 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 277 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
244 } 278 }
269 PyErr_SetString(PyExc_TypeError, "Invalid orthanc.OrthancPluginImage object"); 303 PyErr_SetString(PyExc_TypeError, "Invalid orthanc.OrthancPluginImage object");
270 return NULL; 304 return NULL;
271 } 305 }
272 306
273 OrthancPlugins::MemoryBuffer buffer; 307 OrthancPlugins::MemoryBuffer buffer;
274 OrthancPluginErrorCode code = OrthancPluginCreateDicom2(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1 == Py_None ? NULL : reinterpret_cast<sdk_OrthancPluginImage_Object*>(arg1)->object_, static_cast<OrthancPluginCreateDicomFlags>(arg2), arg3); 308 OrthancPluginErrorCode code;
309 {
310 PythonThreadsAllower allower;
311 code = OrthancPluginCreateDicom2(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1 == Py_None ? NULL : reinterpret_cast<sdk_OrthancPluginImage_Object*>(arg1)->object_, static_cast<OrthancPluginCreateDicomFlags>(arg2), arg3);
312 }
275 313
276 if (code == OrthancPluginErrorCode_Success) 314 if (code == OrthancPluginErrorCode_Success)
277 { 315 {
278 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 316 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
279 } 317 }
295 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 333 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
296 return NULL; 334 return NULL;
297 } 335 }
298 336
299 // This is the case of a constructor 337 // This is the case of a constructor
300 OrthancPluginDicomInstance* obj = OrthancPluginCreateDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); 338 OrthancPluginDicomInstance* obj;
339 {
340 PythonThreadsAllower allower;
341 obj = OrthancPluginCreateDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len);
342 }
301 PyBuffer_Release(&arg0); 343 PyBuffer_Release(&arg0);
302 if (obj == NULL) 344 if (obj == NULL)
303 { 345 {
304 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 346 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
305 return NULL; 347 return NULL;
324 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 366 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
325 return NULL; 367 return NULL;
326 } 368 }
327 369
328 // This is the case of a constructor 370 // This is the case of a constructor
329 OrthancPluginFindMatcher* obj = OrthancPluginCreateFindMatcher(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); 371 OrthancPluginFindMatcher* obj;
372 {
373 PythonThreadsAllower allower;
374 obj = OrthancPluginCreateFindMatcher(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len);
375 }
330 PyBuffer_Release(&arg0); 376 PyBuffer_Release(&arg0);
331 if (obj == NULL) 377 if (obj == NULL)
332 { 378 {
333 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 379 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
334 return NULL; 380 return NULL;
355 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 401 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
356 return NULL; 402 return NULL;
357 } 403 }
358 404
359 // This is the case of a constructor 405 // This is the case of a constructor
360 OrthancPluginImage* obj = OrthancPluginCreateImage(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2); 406 OrthancPluginImage* obj;
407 {
408 PythonThreadsAllower allower;
409 obj = OrthancPluginCreateImage(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2);
410 }
361 411
362 if (obj == NULL) 412 if (obj == NULL)
363 { 413 {
364 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 414 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
365 return NULL; 415 return NULL;
384 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 434 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
385 return NULL; 435 return NULL;
386 } 436 }
387 437
388 OrthancPlugins::MemoryBuffer buffer; 438 OrthancPlugins::MemoryBuffer buffer;
389 OrthancPluginErrorCode code = OrthancPluginCreateMemoryBuffer(OrthancPlugins::GetGlobalContext(), *buffer, arg0); 439 OrthancPluginErrorCode code;
440 {
441 PythonThreadsAllower allower;
442 code = OrthancPluginCreateMemoryBuffer(OrthancPlugins::GetGlobalContext(), *buffer, arg0);
443 }
390 444
391 if (code == OrthancPluginErrorCode_Success) 445 if (code == OrthancPluginErrorCode_Success)
392 { 446 {
393 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 447 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
394 } 448 }
411 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 465 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
412 return NULL; 466 return NULL;
413 } 467 }
414 468
415 // This is the case of a constructor 469 // This is the case of a constructor
416 OrthancPluginImage* obj = OrthancPluginDecodeDicomImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); 470 OrthancPluginImage* obj;
471 {
472 PythonThreadsAllower allower;
473 obj = OrthancPluginDecodeDicomImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2);
474 }
417 PyBuffer_Release(&arg0); 475 PyBuffer_Release(&arg0);
418 if (obj == NULL) 476 if (obj == NULL)
419 { 477 {
420 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 478 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
421 return NULL; 479 return NULL;
443 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); 501 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)");
444 return NULL; 502 return NULL;
445 } 503 }
446 504
447 OrthancPlugins::OrthancString s; 505 OrthancPlugins::OrthancString s;
448 s.Assign(OrthancPluginDicomBufferToJson(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4)); 506 {
507 PythonThreadsAllower allower;
508 s.Assign(OrthancPluginDicomBufferToJson(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4));
509 }
449 PyBuffer_Release(&arg0); 510 PyBuffer_Release(&arg0);
450 if (s.GetContent() == NULL) 511 if (s.GetContent() == NULL)
451 { 512 {
452 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 513 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
453 return NULL; 514 return NULL;
472 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); 533 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)");
473 return NULL; 534 return NULL;
474 } 535 }
475 536
476 OrthancPlugins::OrthancString s; 537 OrthancPlugins::OrthancString s;
477 s.Assign(OrthancPluginDicomInstanceToJson(OrthancPlugins::GetGlobalContext(), arg0, static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3)); 538 {
539 PythonThreadsAllower allower;
540 s.Assign(OrthancPluginDicomInstanceToJson(OrthancPlugins::GetGlobalContext(), arg0, static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3));
541 }
478 542
479 if (s.GetContent() == NULL) 543 if (s.GetContent() == NULL)
480 { 544 {
481 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 545 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
482 return NULL; 546 return NULL;
497 { 561 {
498 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 562 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
499 return NULL; 563 return NULL;
500 } 564 }
501 565
502 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), arg0); 566 {
567 PythonThreadsAllower allower;
568 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), arg0);
569 }
503 570
504 571
505 Py_INCREF(Py_None); 572 Py_INCREF(Py_None);
506 return Py_None; 573 return Py_None;
507 } 574 }
511 PythonLock::LogCall("Calling Python global function: OrthancPluginGenerateRestApiAuthorizationToken()"); 578 PythonLock::LogCall("Calling Python global function: OrthancPluginGenerateRestApiAuthorizationToken()");
512 579
513 580
514 581
515 OrthancPlugins::OrthancString s; 582 OrthancPlugins::OrthancString s;
516 s.Assign(OrthancPluginGenerateRestApiAuthorizationToken(OrthancPlugins::GetGlobalContext())); 583 {
584 PythonThreadsAllower allower;
585 s.Assign(OrthancPluginGenerateRestApiAuthorizationToken(OrthancPlugins::GetGlobalContext()));
586 }
517 587
518 if (s.GetContent() == NULL) 588 if (s.GetContent() == NULL)
519 { 589 {
520 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 590 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
521 return NULL; 591 return NULL;
531 PythonLock::LogCall("Calling Python global function: OrthancPluginGenerateUuid()"); 601 PythonLock::LogCall("Calling Python global function: OrthancPluginGenerateUuid()");
532 602
533 603
534 604
535 OrthancPlugins::OrthancString s; 605 OrthancPlugins::OrthancString s;
536 s.Assign(OrthancPluginGenerateUuid(OrthancPlugins::GetGlobalContext())); 606 {
607 PythonThreadsAllower allower;
608 s.Assign(OrthancPluginGenerateUuid(OrthancPlugins::GetGlobalContext()));
609 }
537 610
538 if (s.GetContent() == NULL) 611 if (s.GetContent() == NULL)
539 { 612 {
540 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 613 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
541 return NULL; 614 return NULL;
557 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 630 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
558 return NULL; 631 return NULL;
559 } 632 }
560 633
561 OrthancPlugins::OrthancString s; 634 OrthancPlugins::OrthancString s;
562 s.Assign(OrthancPluginGetCommandLineArgument(OrthancPlugins::GetGlobalContext(), arg0)); 635 {
636 PythonThreadsAllower allower;
637 s.Assign(OrthancPluginGetCommandLineArgument(OrthancPlugins::GetGlobalContext(), arg0));
638 }
563 639
564 if (s.GetContent() == NULL) 640 if (s.GetContent() == NULL)
565 { 641 {
566 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 642 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
567 return NULL; 643 return NULL;
576 { 652 {
577 PythonLock::LogCall("Calling Python global function: OrthancPluginGetCommandLineArgumentsCount()"); 653 PythonLock::LogCall("Calling Python global function: OrthancPluginGetCommandLineArgumentsCount()");
578 654
579 655
580 656
581 long value = OrthancPluginGetCommandLineArgumentsCount(OrthancPlugins::GetGlobalContext()); 657 long value;
658 {
659 PythonThreadsAllower allower;
660 value = OrthancPluginGetCommandLineArgumentsCount(OrthancPlugins::GetGlobalContext());
661 }
582 662
583 return PyLong_FromLong(value); 663 return PyLong_FromLong(value);
584 } 664 }
585 665
586 static PyObject* sdk_OrthancPluginGetConfiguration(PyObject* module, PyObject* args) 666 static PyObject* sdk_OrthancPluginGetConfiguration(PyObject* module, PyObject* args)
588 PythonLock::LogCall("Calling Python global function: OrthancPluginGetConfiguration()"); 668 PythonLock::LogCall("Calling Python global function: OrthancPluginGetConfiguration()");
589 669
590 670
591 671
592 OrthancPlugins::OrthancString s; 672 OrthancPlugins::OrthancString s;
593 s.Assign(OrthancPluginGetConfiguration(OrthancPlugins::GetGlobalContext())); 673 {
674 PythonThreadsAllower allower;
675 s.Assign(OrthancPluginGetConfiguration(OrthancPlugins::GetGlobalContext()));
676 }
594 677
595 if (s.GetContent() == NULL) 678 if (s.GetContent() == NULL)
596 { 679 {
597 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 680 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
598 return NULL; 681 return NULL;
608 PythonLock::LogCall("Calling Python global function: OrthancPluginGetConfigurationPath()"); 691 PythonLock::LogCall("Calling Python global function: OrthancPluginGetConfigurationPath()");
609 692
610 693
611 694
612 OrthancPlugins::OrthancString s; 695 OrthancPlugins::OrthancString s;
613 s.Assign(OrthancPluginGetConfigurationPath(OrthancPlugins::GetGlobalContext())); 696 {
697 PythonThreadsAllower allower;
698 s.Assign(OrthancPluginGetConfigurationPath(OrthancPlugins::GetGlobalContext()));
699 }
614 700
615 if (s.GetContent() == NULL) 701 if (s.GetContent() == NULL)
616 { 702 {
617 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 703 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
618 return NULL; 704 return NULL;
634 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 720 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
635 return NULL; 721 return NULL;
636 } 722 }
637 723
638 OrthancPlugins::MemoryBuffer buffer; 724 OrthancPlugins::MemoryBuffer buffer;
639 OrthancPluginErrorCode code = OrthancPluginGetDicomForInstance(OrthancPlugins::GetGlobalContext(), *buffer, arg0); 725 OrthancPluginErrorCode code;
726 {
727 PythonThreadsAllower allower;
728 code = OrthancPluginGetDicomForInstance(OrthancPlugins::GetGlobalContext(), *buffer, arg0);
729 }
640 730
641 if (code == OrthancPluginErrorCode_Success) 731 if (code == OrthancPluginErrorCode_Success)
642 { 732 {
643 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 733 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
644 } 734 }
659 { 749 {
660 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 750 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
661 return NULL; 751 return NULL;
662 } 752 }
663 753
664 const char* s = OrthancPluginGetErrorDescription(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginErrorCode>(arg0)); 754 const char* s;
755 {
756 PythonThreadsAllower allower;
757 s = OrthancPluginGetErrorDescription(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginErrorCode>(arg0));
758 }
665 759
666 if (s == NULL) 760 if (s == NULL)
667 { 761 {
668 Py_INCREF(Py_None); 762 Py_INCREF(Py_None);
669 return Py_None; 763 return Py_None;
678 { 772 {
679 PythonLock::LogCall("Calling Python global function: OrthancPluginGetExpectedDatabaseVersion()"); 773 PythonLock::LogCall("Calling Python global function: OrthancPluginGetExpectedDatabaseVersion()");
680 774
681 775
682 776
683 long value = OrthancPluginGetExpectedDatabaseVersion(OrthancPlugins::GetGlobalContext()); 777 long value;
778 {
779 PythonThreadsAllower allower;
780 value = OrthancPluginGetExpectedDatabaseVersion(OrthancPlugins::GetGlobalContext());
781 }
684 782
685 return PyLong_FromLong(value); 783 return PyLong_FromLong(value);
686 } 784 }
687 785
688 static PyObject* sdk_OrthancPluginGetFontName(PyObject* module, PyObject* args) 786 static PyObject* sdk_OrthancPluginGetFontName(PyObject* module, PyObject* args)
695 { 793 {
696 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 794 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
697 return NULL; 795 return NULL;
698 } 796 }
699 797
700 const char* s = OrthancPluginGetFontName(OrthancPlugins::GetGlobalContext(), arg0); 798 const char* s;
799 {
800 PythonThreadsAllower allower;
801 s = OrthancPluginGetFontName(OrthancPlugins::GetGlobalContext(), arg0);
802 }
701 803
702 if (s == NULL) 804 if (s == NULL)
703 { 805 {
704 Py_INCREF(Py_None); 806 Py_INCREF(Py_None);
705 return Py_None; 807 return Py_None;
720 { 822 {
721 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 823 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
722 return NULL; 824 return NULL;
723 } 825 }
724 826
725 long value = OrthancPluginGetFontSize(OrthancPlugins::GetGlobalContext(), arg0); 827 long value;
828 {
829 PythonThreadsAllower allower;
830 value = OrthancPluginGetFontSize(OrthancPlugins::GetGlobalContext(), arg0);
831 }
726 832
727 return PyLong_FromLong(value); 833 return PyLong_FromLong(value);
728 } 834 }
729 835
730 static PyObject* sdk_OrthancPluginGetFontsCount(PyObject* module, PyObject* args) 836 static PyObject* sdk_OrthancPluginGetFontsCount(PyObject* module, PyObject* args)
731 { 837 {
732 PythonLock::LogCall("Calling Python global function: OrthancPluginGetFontsCount()"); 838 PythonLock::LogCall("Calling Python global function: OrthancPluginGetFontsCount()");
733 839
734 840
735 841
736 long value = OrthancPluginGetFontsCount(OrthancPlugins::GetGlobalContext()); 842 long value;
843 {
844 PythonThreadsAllower allower;
845 value = OrthancPluginGetFontsCount(OrthancPlugins::GetGlobalContext());
846 }
737 847
738 return PyLong_FromLong(value); 848 return PyLong_FromLong(value);
739 } 849 }
740 850
741 static PyObject* sdk_OrthancPluginGetGlobalProperty(PyObject* module, PyObject* args) 851 static PyObject* sdk_OrthancPluginGetGlobalProperty(PyObject* module, PyObject* args)
750 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 860 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
751 return NULL; 861 return NULL;
752 } 862 }
753 863
754 OrthancPlugins::OrthancString s; 864 OrthancPlugins::OrthancString s;
755 s.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1)); 865 {
866 PythonThreadsAllower allower;
867 s.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1));
868 }
756 869
757 if (s.GetContent() == NULL) 870 if (s.GetContent() == NULL)
758 { 871 {
759 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 872 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
760 return NULL; 873 return NULL;
770 PythonLock::LogCall("Calling Python global function: OrthancPluginGetOrthancDirectory()"); 883 PythonLock::LogCall("Calling Python global function: OrthancPluginGetOrthancDirectory()");
771 884
772 885
773 886
774 OrthancPlugins::OrthancString s; 887 OrthancPlugins::OrthancString s;
775 s.Assign(OrthancPluginGetOrthancDirectory(OrthancPlugins::GetGlobalContext())); 888 {
889 PythonThreadsAllower allower;
890 s.Assign(OrthancPluginGetOrthancDirectory(OrthancPlugins::GetGlobalContext()));
891 }
776 892
777 if (s.GetContent() == NULL) 893 if (s.GetContent() == NULL)
778 { 894 {
779 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 895 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
780 return NULL; 896 return NULL;
790 PythonLock::LogCall("Calling Python global function: OrthancPluginGetOrthancPath()"); 906 PythonLock::LogCall("Calling Python global function: OrthancPluginGetOrthancPath()");
791 907
792 908
793 909
794 OrthancPlugins::OrthancString s; 910 OrthancPlugins::OrthancString s;
795 s.Assign(OrthancPluginGetOrthancPath(OrthancPlugins::GetGlobalContext())); 911 {
912 PythonThreadsAllower allower;
913 s.Assign(OrthancPluginGetOrthancPath(OrthancPlugins::GetGlobalContext()));
914 }
796 915
797 if (s.GetContent() == NULL) 916 if (s.GetContent() == NULL)
798 { 917 {
799 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 918 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
800 return NULL; 919 return NULL;
810 PythonLock::LogCall("Calling Python global function: OrthancPluginGetPeers()"); 929 PythonLock::LogCall("Calling Python global function: OrthancPluginGetPeers()");
811 930
812 931
813 932
814 // This is the case of a constructor 933 // This is the case of a constructor
815 OrthancPluginPeers* obj = OrthancPluginGetPeers(OrthancPlugins::GetGlobalContext()); 934 OrthancPluginPeers* obj;
935 {
936 PythonThreadsAllower allower;
937 obj = OrthancPluginGetPeers(OrthancPlugins::GetGlobalContext());
938 }
816 939
817 if (obj == NULL) 940 if (obj == NULL)
818 { 941 {
819 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 942 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
820 return NULL; 943 return NULL;
841 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 964 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
842 return NULL; 965 return NULL;
843 } 966 }
844 967
845 OrthancPlugins::OrthancString s; 968 OrthancPlugins::OrthancString s;
846 s.Assign(OrthancPluginGetTagName(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2)); 969 {
970 PythonThreadsAllower allower;
971 s.Assign(OrthancPluginGetTagName(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2));
972 }
847 973
848 if (s.GetContent() == NULL) 974 if (s.GetContent() == NULL)
849 { 975 {
850 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 976 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
851 return NULL; 977 return NULL;
868 { 994 {
869 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 995 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
870 return NULL; 996 return NULL;
871 } 997 }
872 998
873 OrthancPluginErrorCode code = OrthancPluginHttpDelete(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); 999 OrthancPluginErrorCode code;
1000 {
1001 PythonThreadsAllower allower;
1002 code = OrthancPluginHttpDelete(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2);
1003 }
874 1004
875 1005
876 if (code == OrthancPluginErrorCode_Success) 1006 if (code == OrthancPluginErrorCode_Success)
877 { 1007 {
878 Py_INCREF(Py_None); 1008 Py_INCREF(Py_None);
898 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 1028 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
899 return NULL; 1029 return NULL;
900 } 1030 }
901 1031
902 OrthancPlugins::MemoryBuffer buffer; 1032 OrthancPlugins::MemoryBuffer buffer;
903 OrthancPluginErrorCode code = OrthancPluginHttpGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1, arg2); 1033 OrthancPluginErrorCode code;
1034 {
1035 PythonThreadsAllower allower;
1036 code = OrthancPluginHttpGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1, arg2);
1037 }
904 1038
905 if (code == OrthancPluginErrorCode_Success) 1039 if (code == OrthancPluginErrorCode_Success)
906 { 1040 {
907 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1041 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
908 } 1042 }
927 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); 1061 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)");
928 return NULL; 1062 return NULL;
929 } 1063 }
930 1064
931 OrthancPlugins::MemoryBuffer buffer; 1065 OrthancPlugins::MemoryBuffer buffer;
932 OrthancPluginErrorCode code = OrthancPluginHttpPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); 1066 OrthancPluginErrorCode code;
1067 {
1068 PythonThreadsAllower allower;
1069 code = OrthancPluginHttpPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4);
1070 }
933 PyBuffer_Release(&arg1); 1071 PyBuffer_Release(&arg1);
934 if (code == OrthancPluginErrorCode_Success) 1072 if (code == OrthancPluginErrorCode_Success)
935 { 1073 {
936 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1074 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
937 } 1075 }
956 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); 1094 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)");
957 return NULL; 1095 return NULL;
958 } 1096 }
959 1097
960 OrthancPlugins::MemoryBuffer buffer; 1098 OrthancPlugins::MemoryBuffer buffer;
961 OrthancPluginErrorCode code = OrthancPluginHttpPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); 1099 OrthancPluginErrorCode code;
1100 {
1101 PythonThreadsAllower allower;
1102 code = OrthancPluginHttpPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4);
1103 }
962 PyBuffer_Release(&arg1); 1104 PyBuffer_Release(&arg1);
963 if (code == OrthancPluginErrorCode_Success) 1105 if (code == OrthancPluginErrorCode_Success)
964 { 1106 {
965 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1107 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
966 } 1108 }
981 { 1123 {
982 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1124 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
983 return NULL; 1125 return NULL;
984 } 1126 }
985 1127
986 OrthancPluginLogError(OrthancPlugins::GetGlobalContext(), arg0); 1128 {
1129 PythonThreadsAllower allower;
1130 OrthancPluginLogError(OrthancPlugins::GetGlobalContext(), arg0);
1131 }
987 1132
988 1133
989 Py_INCREF(Py_None); 1134 Py_INCREF(Py_None);
990 return Py_None; 1135 return Py_None;
991 } 1136 }
1000 { 1145 {
1001 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1146 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1002 return NULL; 1147 return NULL;
1003 } 1148 }
1004 1149
1005 OrthancPluginLogInfo(OrthancPlugins::GetGlobalContext(), arg0); 1150 {
1151 PythonThreadsAllower allower;
1152 OrthancPluginLogInfo(OrthancPlugins::GetGlobalContext(), arg0);
1153 }
1006 1154
1007 1155
1008 Py_INCREF(Py_None); 1156 Py_INCREF(Py_None);
1009 return Py_None; 1157 return Py_None;
1010 } 1158 }
1019 { 1167 {
1020 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1168 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1021 return NULL; 1169 return NULL;
1022 } 1170 }
1023 1171
1024 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), arg0); 1172 {
1173 PythonThreadsAllower allower;
1174 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), arg0);
1175 }
1025 1176
1026 1177
1027 Py_INCREF(Py_None); 1178 Py_INCREF(Py_None);
1028 return Py_None; 1179 return Py_None;
1029 } 1180 }
1039 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1190 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1040 return NULL; 1191 return NULL;
1041 } 1192 }
1042 1193
1043 OrthancPlugins::OrthancString s; 1194 OrthancPlugins::OrthancString s;
1044 s.Assign(OrthancPluginLookupInstance(OrthancPlugins::GetGlobalContext(), arg0)); 1195 {
1196 PythonThreadsAllower allower;
1197 s.Assign(OrthancPluginLookupInstance(OrthancPlugins::GetGlobalContext(), arg0));
1198 }
1045 1199
1046 if (s.GetContent() == NULL) 1200 if (s.GetContent() == NULL)
1047 { 1201 {
1048 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 1202 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
1049 return NULL; 1203 return NULL;
1065 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1219 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1066 return NULL; 1220 return NULL;
1067 } 1221 }
1068 1222
1069 OrthancPlugins::OrthancString s; 1223 OrthancPlugins::OrthancString s;
1070 s.Assign(OrthancPluginLookupPatient(OrthancPlugins::GetGlobalContext(), arg0)); 1224 {
1225 PythonThreadsAllower allower;
1226 s.Assign(OrthancPluginLookupPatient(OrthancPlugins::GetGlobalContext(), arg0));
1227 }
1071 1228
1072 if (s.GetContent() == NULL) 1229 if (s.GetContent() == NULL)
1073 { 1230 {
1074 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 1231 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
1075 return NULL; 1232 return NULL;
1091 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1248 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1092 return NULL; 1249 return NULL;
1093 } 1250 }
1094 1251
1095 OrthancPlugins::OrthancString s; 1252 OrthancPlugins::OrthancString s;
1096 s.Assign(OrthancPluginLookupSeries(OrthancPlugins::GetGlobalContext(), arg0)); 1253 {
1254 PythonThreadsAllower allower;
1255 s.Assign(OrthancPluginLookupSeries(OrthancPlugins::GetGlobalContext(), arg0));
1256 }
1097 1257
1098 if (s.GetContent() == NULL) 1258 if (s.GetContent() == NULL)
1099 { 1259 {
1100 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 1260 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
1101 return NULL; 1261 return NULL;
1117 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1277 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1118 return NULL; 1278 return NULL;
1119 } 1279 }
1120 1280
1121 OrthancPlugins::OrthancString s; 1281 OrthancPlugins::OrthancString s;
1122 s.Assign(OrthancPluginLookupStudy(OrthancPlugins::GetGlobalContext(), arg0)); 1282 {
1283 PythonThreadsAllower allower;
1284 s.Assign(OrthancPluginLookupStudy(OrthancPlugins::GetGlobalContext(), arg0));
1285 }
1123 1286
1124 if (s.GetContent() == NULL) 1287 if (s.GetContent() == NULL)
1125 { 1288 {
1126 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 1289 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
1127 return NULL; 1290 return NULL;
1143 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1306 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1144 return NULL; 1307 return NULL;
1145 } 1308 }
1146 1309
1147 OrthancPlugins::OrthancString s; 1310 OrthancPlugins::OrthancString s;
1148 s.Assign(OrthancPluginLookupStudyWithAccessionNumber(OrthancPlugins::GetGlobalContext(), arg0)); 1311 {
1312 PythonThreadsAllower allower;
1313 s.Assign(OrthancPluginLookupStudyWithAccessionNumber(OrthancPlugins::GetGlobalContext(), arg0));
1314 }
1149 1315
1150 if (s.GetContent() == NULL) 1316 if (s.GetContent() == NULL)
1151 { 1317 {
1152 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 1318 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
1153 return NULL; 1319 return NULL;
1169 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1335 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1170 return NULL; 1336 return NULL;
1171 } 1337 }
1172 1338
1173 OrthancPlugins::MemoryBuffer buffer; 1339 OrthancPlugins::MemoryBuffer buffer;
1174 OrthancPluginErrorCode code = OrthancPluginReadFile(OrthancPlugins::GetGlobalContext(), *buffer, arg0); 1340 OrthancPluginErrorCode code;
1341 {
1342 PythonThreadsAllower allower;
1343 code = OrthancPluginReadFile(OrthancPlugins::GetGlobalContext(), *buffer, arg0);
1344 }
1175 1345
1176 if (code == OrthancPluginErrorCode_Success) 1346 if (code == OrthancPluginErrorCode_Success)
1177 { 1347 {
1178 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1348 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
1179 } 1349 }
1199 { 1369 {
1200 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); 1370 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)");
1201 return NULL; 1371 return NULL;
1202 } 1372 }
1203 1373
1204 OrthancPluginErrorCode code = OrthancPluginRegisterDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5); 1374 OrthancPluginErrorCode code;
1375 {
1376 PythonThreadsAllower allower;
1377 code = OrthancPluginRegisterDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5);
1378 }
1205 1379
1206 1380
1207 if (code == OrthancPluginErrorCode_Success) 1381 if (code == OrthancPluginErrorCode_Success)
1208 { 1382 {
1209 Py_INCREF(Py_None); 1383 Py_INCREF(Py_None);
1228 { 1402 {
1229 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 1403 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
1230 return NULL; 1404 return NULL;
1231 } 1405 }
1232 1406
1233 OrthancPluginErrorCode code = OrthancPluginRegisterErrorCode(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); 1407 OrthancPluginErrorCode code;
1408 {
1409 PythonThreadsAllower allower;
1410 code = OrthancPluginRegisterErrorCode(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2);
1411 }
1234 1412
1235 1413
1236 if (code == OrthancPluginErrorCode_Success) 1414 if (code == OrthancPluginErrorCode_Success)
1237 { 1415 {
1238 Py_INCREF(Py_None); 1416 Py_INCREF(Py_None);
1261 { 1439 {
1262 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (7 arguments expected)"); 1440 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (7 arguments expected)");
1263 return NULL; 1441 return NULL;
1264 } 1442 }
1265 1443
1266 OrthancPluginErrorCode code = OrthancPluginRegisterPrivateDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5, arg6); 1444 OrthancPluginErrorCode code;
1445 {
1446 PythonThreadsAllower allower;
1447 code = OrthancPluginRegisterPrivateDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5, arg6);
1448 }
1267 1449
1268 1450
1269 if (code == OrthancPluginErrorCode_Success) 1451 if (code == OrthancPluginErrorCode_Success)
1270 { 1452 {
1271 Py_INCREF(Py_None); 1453 Py_INCREF(Py_None);
1288 { 1470 {
1289 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1471 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1290 return NULL; 1472 return NULL;
1291 } 1473 }
1292 1474
1293 OrthancPluginErrorCode code = OrthancPluginRestApiDelete(OrthancPlugins::GetGlobalContext(), arg0); 1475 OrthancPluginErrorCode code;
1476 {
1477 PythonThreadsAllower allower;
1478 code = OrthancPluginRestApiDelete(OrthancPlugins::GetGlobalContext(), arg0);
1479 }
1294 1480
1295 1481
1296 if (code == OrthancPluginErrorCode_Success) 1482 if (code == OrthancPluginErrorCode_Success)
1297 { 1483 {
1298 Py_INCREF(Py_None); 1484 Py_INCREF(Py_None);
1315 { 1501 {
1316 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1502 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1317 return NULL; 1503 return NULL;
1318 } 1504 }
1319 1505
1320 OrthancPluginErrorCode code = OrthancPluginRestApiDeleteAfterPlugins(OrthancPlugins::GetGlobalContext(), arg0); 1506 OrthancPluginErrorCode code;
1507 {
1508 PythonThreadsAllower allower;
1509 code = OrthancPluginRestApiDeleteAfterPlugins(OrthancPlugins::GetGlobalContext(), arg0);
1510 }
1321 1511
1322 1512
1323 if (code == OrthancPluginErrorCode_Success) 1513 if (code == OrthancPluginErrorCode_Success)
1324 { 1514 {
1325 Py_INCREF(Py_None); 1515 Py_INCREF(Py_None);
1343 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1533 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1344 return NULL; 1534 return NULL;
1345 } 1535 }
1346 1536
1347 OrthancPlugins::MemoryBuffer buffer; 1537 OrthancPlugins::MemoryBuffer buffer;
1348 OrthancPluginErrorCode code = OrthancPluginRestApiGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0); 1538 OrthancPluginErrorCode code;
1539 {
1540 PythonThreadsAllower allower;
1541 code = OrthancPluginRestApiGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0);
1542 }
1349 1543
1350 if (code == OrthancPluginErrorCode_Success) 1544 if (code == OrthancPluginErrorCode_Success)
1351 { 1545 {
1352 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1546 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
1353 } 1547 }
1369 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1563 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1370 return NULL; 1564 return NULL;
1371 } 1565 }
1372 1566
1373 OrthancPlugins::MemoryBuffer buffer; 1567 OrthancPlugins::MemoryBuffer buffer;
1374 OrthancPluginErrorCode code = OrthancPluginRestApiGetAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0); 1568 OrthancPluginErrorCode code;
1569 {
1570 PythonThreadsAllower allower;
1571 code = OrthancPluginRestApiGetAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0);
1572 }
1375 1573
1376 if (code == OrthancPluginErrorCode_Success) 1574 if (code == OrthancPluginErrorCode_Success)
1377 { 1575 {
1378 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1576 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
1379 } 1577 }
1396 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1594 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1397 return NULL; 1595 return NULL;
1398 } 1596 }
1399 1597
1400 OrthancPlugins::MemoryBuffer buffer; 1598 OrthancPlugins::MemoryBuffer buffer;
1401 OrthancPluginErrorCode code = OrthancPluginRestApiPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); 1599 OrthancPluginErrorCode code;
1600 {
1601 PythonThreadsAllower allower;
1602 code = OrthancPluginRestApiPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len);
1603 }
1402 PyBuffer_Release(&arg1); 1604 PyBuffer_Release(&arg1);
1403 if (code == OrthancPluginErrorCode_Success) 1605 if (code == OrthancPluginErrorCode_Success)
1404 { 1606 {
1405 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1607 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
1406 } 1608 }
1423 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1625 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1424 return NULL; 1626 return NULL;
1425 } 1627 }
1426 1628
1427 OrthancPlugins::MemoryBuffer buffer; 1629 OrthancPlugins::MemoryBuffer buffer;
1428 OrthancPluginErrorCode code = OrthancPluginRestApiPostAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); 1630 OrthancPluginErrorCode code;
1631 {
1632 PythonThreadsAllower allower;
1633 code = OrthancPluginRestApiPostAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len);
1634 }
1429 PyBuffer_Release(&arg1); 1635 PyBuffer_Release(&arg1);
1430 if (code == OrthancPluginErrorCode_Success) 1636 if (code == OrthancPluginErrorCode_Success)
1431 { 1637 {
1432 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1638 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
1433 } 1639 }
1450 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1656 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1451 return NULL; 1657 return NULL;
1452 } 1658 }
1453 1659
1454 OrthancPlugins::MemoryBuffer buffer; 1660 OrthancPlugins::MemoryBuffer buffer;
1455 OrthancPluginErrorCode code = OrthancPluginRestApiPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); 1661 OrthancPluginErrorCode code;
1662 {
1663 PythonThreadsAllower allower;
1664 code = OrthancPluginRestApiPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len);
1665 }
1456 PyBuffer_Release(&arg1); 1666 PyBuffer_Release(&arg1);
1457 if (code == OrthancPluginErrorCode_Success) 1667 if (code == OrthancPluginErrorCode_Success)
1458 { 1668 {
1459 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1669 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
1460 } 1670 }
1477 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1687 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1478 return NULL; 1688 return NULL;
1479 } 1689 }
1480 1690
1481 OrthancPlugins::MemoryBuffer buffer; 1691 OrthancPlugins::MemoryBuffer buffer;
1482 OrthancPluginErrorCode code = OrthancPluginRestApiPutAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); 1692 OrthancPluginErrorCode code;
1693 {
1694 PythonThreadsAllower allower;
1695 code = OrthancPluginRestApiPutAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len);
1696 }
1483 PyBuffer_Release(&arg1); 1697 PyBuffer_Release(&arg1);
1484 if (code == OrthancPluginErrorCode_Success) 1698 if (code == OrthancPluginErrorCode_Success)
1485 { 1699 {
1486 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); 1700 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize());
1487 } 1701 }
1502 { 1716 {
1503 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1717 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1504 return NULL; 1718 return NULL;
1505 } 1719 }
1506 1720
1507 OrthancPluginSetDescription(OrthancPlugins::GetGlobalContext(), arg0); 1721 {
1722 PythonThreadsAllower allower;
1723 OrthancPluginSetDescription(OrthancPlugins::GetGlobalContext(), arg0);
1724 }
1508 1725
1509 1726
1510 Py_INCREF(Py_None); 1727 Py_INCREF(Py_None);
1511 return Py_None; 1728 return Py_None;
1512 } 1729 }
1522 { 1739 {
1523 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1740 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1524 return NULL; 1741 return NULL;
1525 } 1742 }
1526 1743
1527 OrthancPluginErrorCode code = OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1); 1744 OrthancPluginErrorCode code;
1745 {
1746 PythonThreadsAllower allower;
1747 code = OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1);
1748 }
1528 1749
1529 1750
1530 if (code == OrthancPluginErrorCode_Success) 1751 if (code == OrthancPluginErrorCode_Success)
1531 { 1752 {
1532 Py_INCREF(Py_None); 1753 Py_INCREF(Py_None);
1551 { 1772 {
1552 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); 1773 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)");
1553 return NULL; 1774 return NULL;
1554 } 1775 }
1555 1776
1556 OrthancPluginSetMetricsValue(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginMetricsType>(arg2)); 1777 {
1778 PythonThreadsAllower allower;
1779 OrthancPluginSetMetricsValue(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginMetricsType>(arg2));
1780 }
1557 1781
1558 1782
1559 Py_INCREF(Py_None); 1783 Py_INCREF(Py_None);
1560 return Py_None; 1784 return Py_None;
1561 } 1785 }
1570 { 1794 {
1571 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); 1795 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)");
1572 return NULL; 1796 return NULL;
1573 } 1797 }
1574 1798
1575 OrthancPluginSetRootUri(OrthancPlugins::GetGlobalContext(), arg0); 1799 {
1800 PythonThreadsAllower allower;
1801 OrthancPluginSetRootUri(OrthancPlugins::GetGlobalContext(), arg0);
1802 }
1576 1803
1577 1804
1578 Py_INCREF(Py_None); 1805 Py_INCREF(Py_None);
1579 return Py_None; 1806 return Py_None;
1580 } 1807 }
1591 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1818 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1592 return NULL; 1819 return NULL;
1593 } 1820 }
1594 1821
1595 // This is the case of a constructor 1822 // This is the case of a constructor
1596 OrthancPluginDicomInstance* obj = OrthancPluginTranscodeDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); 1823 OrthancPluginDicomInstance* obj;
1824 {
1825 PythonThreadsAllower allower;
1826 obj = OrthancPluginTranscodeDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2);
1827 }
1597 PyBuffer_Release(&arg0); 1828 PyBuffer_Release(&arg0);
1598 if (obj == NULL) 1829 if (obj == NULL)
1599 { 1830 {
1600 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 1831 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
1601 return NULL; 1832 return NULL;
1621 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1852 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1622 return NULL; 1853 return NULL;
1623 } 1854 }
1624 1855
1625 // This is the case of a constructor 1856 // This is the case of a constructor
1626 OrthancPluginImage* obj = OrthancPluginUncompressImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginImageFormat>(arg2)); 1857 OrthancPluginImage* obj;
1858 {
1859 PythonThreadsAllower allower;
1860 obj = OrthancPluginUncompressImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginImageFormat>(arg2));
1861 }
1627 PyBuffer_Release(&arg0); 1862 PyBuffer_Release(&arg0);
1628 if (obj == NULL) 1863 if (obj == NULL)
1629 { 1864 {
1630 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); 1865 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError);
1631 return NULL; 1866 return NULL;
1650 { 1885 {
1651 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); 1886 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)");
1652 return NULL; 1887 return NULL;
1653 } 1888 }
1654 1889
1655 OrthancPluginErrorCode code = OrthancPluginWriteFile(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len); 1890 OrthancPluginErrorCode code;
1891 {
1892 PythonThreadsAllower allower;
1893 code = OrthancPluginWriteFile(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len);
1894 }
1656 PyBuffer_Release(&arg1); 1895 PyBuffer_Release(&arg1);
1657 1896
1658 if (code == OrthancPluginErrorCode_Success) 1897 if (code == OrthancPluginErrorCode_Success)
1659 { 1898 {
1660 Py_INCREF(Py_None); 1899 Py_INCREF(Py_None);