Mercurial > hg > orthanc-python
comparison Sources/Autogenerated/sdk_OrthancPluginRestOutput.impl.h @ 1:fef9a239df5c
adding auto-generated files
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 26 Mar 2020 18:50:10 +0100 |
parents | |
children | b2bbb516056e |
comparison
equal
deleted
inserted
replaced
0:7ed502b17b8f | 1:fef9a239df5c |
---|---|
1 /** | |
2 * Python plugin for Orthanc | |
3 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
4 * | |
5 * This program is free software: you can redistribute it and/or | |
6 * modify it under the terms of the GNU Affero General Public License | |
7 * as published by the Free Software Foundation, either version 3 of | |
8 * the License, or (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, but | |
11 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Affero General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Affero General Public License | |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 **/ | |
18 | |
19 | |
20 typedef struct | |
21 { | |
22 PyObject_HEAD | |
23 | |
24 /* Type-specific fields go here. */ | |
25 OrthancPluginRestOutput* object_; | |
26 bool borrowed_; | |
27 } sdk_OrthancPluginRestOutput_Object; | |
28 | |
29 | |
30 | |
31 // Forward declaration of the methods | |
32 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginAnswerBuffer( | |
33 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
34 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginCompressAndAnswerPngImage( | |
35 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
36 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginRedirect( | |
37 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
38 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendHttpStatusCode( | |
39 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
40 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendUnauthorized( | |
41 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
42 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendMethodNotAllowed( | |
43 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
44 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSetCookie( | |
45 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
46 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSetHttpHeader( | |
47 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
48 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginStartMultipartAnswer( | |
49 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
50 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendMultipartItem( | |
51 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
52 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendHttpStatus( | |
53 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
54 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginCompressAndAnswerJpegImage( | |
55 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
56 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSetHttpErrorDetails( | |
57 sdk_OrthancPluginRestOutput_Object* self, PyObject *args); | |
58 | |
59 | |
60 static PyMethodDef sdk_OrthancPluginRestOutput_Methods[] = { | |
61 { "AnswerBuffer", | |
62 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginAnswerBuffer, METH_VARARGS, | |
63 "Generated from C function OrthancPluginAnswerBuffer()" }, | |
64 { "CompressAndAnswerPngImage", | |
65 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginCompressAndAnswerPngImage, METH_VARARGS, | |
66 "Generated from C function OrthancPluginCompressAndAnswerPngImage()" }, | |
67 { "Redirect", | |
68 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginRedirect, METH_VARARGS, | |
69 "Generated from C function OrthancPluginRedirect()" }, | |
70 { "SendHttpStatusCode", | |
71 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSendHttpStatusCode, METH_VARARGS, | |
72 "Generated from C function OrthancPluginSendHttpStatusCode()" }, | |
73 { "SendUnauthorized", | |
74 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSendUnauthorized, METH_VARARGS, | |
75 "Generated from C function OrthancPluginSendUnauthorized()" }, | |
76 { "SendMethodNotAllowed", | |
77 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSendMethodNotAllowed, METH_VARARGS, | |
78 "Generated from C function OrthancPluginSendMethodNotAllowed()" }, | |
79 { "SetCookie", | |
80 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSetCookie, METH_VARARGS, | |
81 "Generated from C function OrthancPluginSetCookie()" }, | |
82 { "SetHttpHeader", | |
83 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSetHttpHeader, METH_VARARGS, | |
84 "Generated from C function OrthancPluginSetHttpHeader()" }, | |
85 { "StartMultipartAnswer", | |
86 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginStartMultipartAnswer, METH_VARARGS, | |
87 "Generated from C function OrthancPluginStartMultipartAnswer()" }, | |
88 { "SendMultipartItem", | |
89 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSendMultipartItem, METH_VARARGS, | |
90 "Generated from C function OrthancPluginSendMultipartItem()" }, | |
91 { "SendHttpStatus", | |
92 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSendHttpStatus, METH_VARARGS, | |
93 "Generated from C function OrthancPluginSendHttpStatus()" }, | |
94 { "CompressAndAnswerJpegImage", | |
95 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginCompressAndAnswerJpegImage, METH_VARARGS, | |
96 "Generated from C function OrthancPluginCompressAndAnswerJpegImage()" }, | |
97 { "SetHttpErrorDetails", | |
98 (PyCFunction) sdk_OrthancPluginRestOutput_OrthancPluginSetHttpErrorDetails, METH_VARARGS, | |
99 "Generated from C function OrthancPluginSetHttpErrorDetails()" }, | |
100 { NULL } /* Sentinel */ | |
101 }; | |
102 | |
103 | |
104 static int sdk_OrthancPluginRestOutput_Constructor( | |
105 sdk_OrthancPluginRestOutput_Object *self, PyObject *args, PyObject *kwds) | |
106 { | |
107 OrthancPlugins::LogInfo("Creating Python object of class OrthancPluginRestOutput"); | |
108 | |
109 self->object_ = NULL; | |
110 self->borrowed_ = false; | |
111 | |
112 long long object = 0; | |
113 unsigned char borrowed = false; | |
114 | |
115 if (PyArg_ParseTuple(args, "Lb", &object, &borrowed)) | |
116 { | |
117 self->object_ = reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(object)); | |
118 self->borrowed_ = borrowed; | |
119 return 0; | |
120 } | |
121 else | |
122 { | |
123 PyErr_SetString(PyExc_ValueError, "Expected a pair (pointer, borrowed) in the constructor"); | |
124 return -1; | |
125 } | |
126 } | |
127 | |
128 | |
129 /** | |
130 * Static global structure => the fields that are beyond the last | |
131 * initialized field are set to zero. | |
132 * https://stackoverflow.com/a/11152199/881731 | |
133 **/ | |
134 static PyTypeObject sdk_OrthancPluginRestOutput_Type = { | |
135 PyVarObject_HEAD_INIT(NULL, 0) | |
136 "orthanc.RestOutput", /* tp_name */ | |
137 sizeof(sdk_OrthancPluginRestOutput_Object), /* tp_basicsize */ | |
138 }; | |
139 | |
140 | |
141 | |
142 | |
143 // Actual implementation of the methods | |
144 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginAnswerBuffer( | |
145 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
146 { | |
147 OrthancPlugins::LogInfo("Calling method OrthancPluginAnswerBuffer() on object of class OrthancPluginRestOutput"); | |
148 | |
149 if (self->object_ == NULL) | |
150 { | |
151 // TODO: RAISE | |
152 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
153 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
154 return NULL; | |
155 } | |
156 | |
157 Py_buffer arg0; | |
158 const char* arg2 = NULL; | |
159 | |
160 if (!PyArg_ParseTuple(args, "s*s", &arg0, &arg2)) | |
161 { | |
162 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
163 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | |
164 return NULL; | |
165 } | |
166 OrthancPluginAnswerBuffer(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len, arg2); | |
167 PyBuffer_Release(&arg0); | |
168 | |
169 Py_INCREF(Py_None); | |
170 return Py_None; | |
171 } | |
172 | |
173 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginCompressAndAnswerPngImage( | |
174 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
175 { | |
176 OrthancPlugins::LogInfo("Calling method OrthancPluginCompressAndAnswerPngImage() on object of class OrthancPluginRestOutput"); | |
177 | |
178 if (self->object_ == NULL) | |
179 { | |
180 // TODO: RAISE | |
181 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
182 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
183 return NULL; | |
184 } | |
185 | |
186 long int arg0 = 0; | |
187 unsigned long arg1 = 0; | |
188 unsigned long arg2 = 0; | |
189 unsigned long arg3 = 0; | |
190 Py_buffer arg4; | |
191 | |
192 if (!PyArg_ParseTuple(args, "lkkks*", &arg0, &arg1, &arg2, &arg3, &arg4)) | |
193 { | |
194 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
195 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (5 arguments expected)"); | |
196 return NULL; | |
197 } | |
198 OrthancPluginCompressAndAnswerPngImage(OrthancPlugins::GetGlobalContext(), self->object_, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf); | |
199 PyBuffer_Release(&arg4); | |
200 | |
201 Py_INCREF(Py_None); | |
202 return Py_None; | |
203 } | |
204 | |
205 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginRedirect( | |
206 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
207 { | |
208 OrthancPlugins::LogInfo("Calling method OrthancPluginRedirect() on object of class OrthancPluginRestOutput"); | |
209 | |
210 if (self->object_ == NULL) | |
211 { | |
212 // TODO: RAISE | |
213 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
214 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
215 return NULL; | |
216 } | |
217 | |
218 const char* arg0 = NULL; | |
219 | |
220 if (!PyArg_ParseTuple(args, "s", &arg0)) | |
221 { | |
222 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
223 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
224 return NULL; | |
225 } | |
226 OrthancPluginRedirect(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
227 | |
228 | |
229 Py_INCREF(Py_None); | |
230 return Py_None; | |
231 } | |
232 | |
233 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendHttpStatusCode( | |
234 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
235 { | |
236 OrthancPlugins::LogInfo("Calling method OrthancPluginSendHttpStatusCode() on object of class OrthancPluginRestOutput"); | |
237 | |
238 if (self->object_ == NULL) | |
239 { | |
240 // TODO: RAISE | |
241 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
242 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
243 return NULL; | |
244 } | |
245 | |
246 unsigned short arg0 = 0; | |
247 | |
248 if (!PyArg_ParseTuple(args, "H", &arg0)) | |
249 { | |
250 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
251 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
252 return NULL; | |
253 } | |
254 OrthancPluginSendHttpStatusCode(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
255 | |
256 | |
257 Py_INCREF(Py_None); | |
258 return Py_None; | |
259 } | |
260 | |
261 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendUnauthorized( | |
262 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
263 { | |
264 OrthancPlugins::LogInfo("Calling method OrthancPluginSendUnauthorized() on object of class OrthancPluginRestOutput"); | |
265 | |
266 if (self->object_ == NULL) | |
267 { | |
268 // TODO: RAISE | |
269 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
270 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
271 return NULL; | |
272 } | |
273 | |
274 const char* arg0 = NULL; | |
275 | |
276 if (!PyArg_ParseTuple(args, "s", &arg0)) | |
277 { | |
278 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
279 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
280 return NULL; | |
281 } | |
282 OrthancPluginSendUnauthorized(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
283 | |
284 | |
285 Py_INCREF(Py_None); | |
286 return Py_None; | |
287 } | |
288 | |
289 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendMethodNotAllowed( | |
290 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
291 { | |
292 OrthancPlugins::LogInfo("Calling method OrthancPluginSendMethodNotAllowed() on object of class OrthancPluginRestOutput"); | |
293 | |
294 if (self->object_ == NULL) | |
295 { | |
296 // TODO: RAISE | |
297 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
298 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
299 return NULL; | |
300 } | |
301 | |
302 const char* arg0 = NULL; | |
303 | |
304 if (!PyArg_ParseTuple(args, "s", &arg0)) | |
305 { | |
306 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
307 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
308 return NULL; | |
309 } | |
310 OrthancPluginSendMethodNotAllowed(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
311 | |
312 | |
313 Py_INCREF(Py_None); | |
314 return Py_None; | |
315 } | |
316 | |
317 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSetCookie( | |
318 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
319 { | |
320 OrthancPlugins::LogInfo("Calling method OrthancPluginSetCookie() on object of class OrthancPluginRestOutput"); | |
321 | |
322 if (self->object_ == NULL) | |
323 { | |
324 // TODO: RAISE | |
325 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
326 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
327 return NULL; | |
328 } | |
329 | |
330 const char* arg0 = NULL; | |
331 const char* arg1 = NULL; | |
332 | |
333 if (!PyArg_ParseTuple(args, "ss", &arg0, &arg1)) | |
334 { | |
335 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
336 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | |
337 return NULL; | |
338 } | |
339 OrthancPluginSetCookie(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); | |
340 | |
341 | |
342 Py_INCREF(Py_None); | |
343 return Py_None; | |
344 } | |
345 | |
346 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSetHttpHeader( | |
347 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
348 { | |
349 OrthancPlugins::LogInfo("Calling method OrthancPluginSetHttpHeader() on object of class OrthancPluginRestOutput"); | |
350 | |
351 if (self->object_ == NULL) | |
352 { | |
353 // TODO: RAISE | |
354 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
355 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
356 return NULL; | |
357 } | |
358 | |
359 const char* arg0 = NULL; | |
360 const char* arg1 = NULL; | |
361 | |
362 if (!PyArg_ParseTuple(args, "ss", &arg0, &arg1)) | |
363 { | |
364 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
365 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | |
366 return NULL; | |
367 } | |
368 OrthancPluginSetHttpHeader(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); | |
369 | |
370 | |
371 Py_INCREF(Py_None); | |
372 return Py_None; | |
373 } | |
374 | |
375 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginStartMultipartAnswer( | |
376 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
377 { | |
378 OrthancPlugins::LogInfo("Calling method OrthancPluginStartMultipartAnswer() on object of class OrthancPluginRestOutput"); | |
379 | |
380 if (self->object_ == NULL) | |
381 { | |
382 // TODO: RAISE | |
383 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
384 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
385 return NULL; | |
386 } | |
387 | |
388 const char* arg0 = NULL; | |
389 const char* arg1 = NULL; | |
390 | |
391 if (!PyArg_ParseTuple(args, "ss", &arg0, &arg1)) | |
392 { | |
393 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
394 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | |
395 return NULL; | |
396 } | |
397 OrthancPluginErrorCode code = OrthancPluginStartMultipartAnswer(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); | |
398 | |
399 | |
400 if (code == OrthancPluginErrorCode_Success) | |
401 { | |
402 Py_INCREF(Py_None); | |
403 return Py_None; | |
404 } | |
405 else | |
406 { | |
407 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
408 //PythonLock::RaiseException(module, code); | |
409 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
410 return NULL; | |
411 } | |
412 } | |
413 | |
414 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendMultipartItem( | |
415 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
416 { | |
417 OrthancPlugins::LogInfo("Calling method OrthancPluginSendMultipartItem() on object of class OrthancPluginRestOutput"); | |
418 | |
419 if (self->object_ == NULL) | |
420 { | |
421 // TODO: RAISE | |
422 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
423 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
424 return NULL; | |
425 } | |
426 | |
427 const char* arg0 = NULL; | |
428 unsigned long arg1 = 0; | |
429 | |
430 if (!PyArg_ParseTuple(args, "sk", &arg0, &arg1)) | |
431 { | |
432 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
433 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | |
434 return NULL; | |
435 } | |
436 OrthancPluginErrorCode code = OrthancPluginSendMultipartItem(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); | |
437 | |
438 | |
439 if (code == OrthancPluginErrorCode_Success) | |
440 { | |
441 Py_INCREF(Py_None); | |
442 return Py_None; | |
443 } | |
444 else | |
445 { | |
446 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
447 //PythonLock::RaiseException(module, code); | |
448 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
449 return NULL; | |
450 } | |
451 } | |
452 | |
453 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSendHttpStatus( | |
454 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
455 { | |
456 OrthancPlugins::LogInfo("Calling method OrthancPluginSendHttpStatus() on object of class OrthancPluginRestOutput"); | |
457 | |
458 if (self->object_ == NULL) | |
459 { | |
460 // TODO: RAISE | |
461 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
462 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
463 return NULL; | |
464 } | |
465 | |
466 unsigned short arg0 = 0; | |
467 const char* arg1 = NULL; | |
468 unsigned long arg2 = 0; | |
469 | |
470 if (!PyArg_ParseTuple(args, "Hsk", &arg0, &arg1, &arg2)) | |
471 { | |
472 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
473 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | |
474 return NULL; | |
475 } | |
476 OrthancPluginSendHttpStatus(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1, arg2); | |
477 | |
478 | |
479 Py_INCREF(Py_None); | |
480 return Py_None; | |
481 } | |
482 | |
483 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginCompressAndAnswerJpegImage( | |
484 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
485 { | |
486 OrthancPlugins::LogInfo("Calling method OrthancPluginCompressAndAnswerJpegImage() on object of class OrthancPluginRestOutput"); | |
487 | |
488 if (self->object_ == NULL) | |
489 { | |
490 // TODO: RAISE | |
491 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
492 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
493 return NULL; | |
494 } | |
495 | |
496 long int arg0 = 0; | |
497 unsigned long arg1 = 0; | |
498 unsigned long arg2 = 0; | |
499 unsigned long arg3 = 0; | |
500 Py_buffer arg4; | |
501 unsigned char arg5 = 0; | |
502 | |
503 if (!PyArg_ParseTuple(args, "lkkks*b", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) | |
504 { | |
505 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
506 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); | |
507 return NULL; | |
508 } | |
509 OrthancPluginCompressAndAnswerJpegImage(OrthancPlugins::GetGlobalContext(), self->object_, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf, arg5); | |
510 PyBuffer_Release(&arg4); | |
511 | |
512 Py_INCREF(Py_None); | |
513 return Py_None; | |
514 } | |
515 | |
516 static PyObject *sdk_OrthancPluginRestOutput_OrthancPluginSetHttpErrorDetails( | |
517 sdk_OrthancPluginRestOutput_Object* self, PyObject *args) | |
518 { | |
519 OrthancPlugins::LogInfo("Calling method OrthancPluginSetHttpErrorDetails() on object of class OrthancPluginRestOutput"); | |
520 | |
521 if (self->object_ == NULL) | |
522 { | |
523 // TODO: RAISE | |
524 //PythonLock::RaiseException(module, OrthancPluginErrorCode_NullPointer); | |
525 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
526 return NULL; | |
527 } | |
528 | |
529 const char* arg0 = NULL; | |
530 unsigned char arg1 = 0; | |
531 | |
532 if (!PyArg_ParseTuple(args, "sb", &arg0, &arg1)) | |
533 { | |
534 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
535 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | |
536 return NULL; | |
537 } | |
538 OrthancPluginSetHttpErrorDetails(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); | |
539 | |
540 | |
541 Py_INCREF(Py_None); | |
542 return Py_None; | |
543 } | |
544 | |
545 | |
546 | |
547 static void RegisterOrthancPluginRestOutputClass(PyObject* module) | |
548 { | |
549 sdk_OrthancPluginRestOutput_Type.tp_new = PyType_GenericNew; | |
550 sdk_OrthancPluginRestOutput_Type.tp_flags = Py_TPFLAGS_DEFAULT; | |
551 sdk_OrthancPluginRestOutput_Type.tp_doc = "Generated from Orthanc C class: OrthancPluginRestOutput"; | |
552 sdk_OrthancPluginRestOutput_Type.tp_methods = sdk_OrthancPluginRestOutput_Methods; | |
553 sdk_OrthancPluginRestOutput_Type.tp_init = (initproc) sdk_OrthancPluginRestOutput_Constructor; | |
554 | |
555 | |
556 if (PyType_Ready(&sdk_OrthancPluginRestOutput_Type) < 0) | |
557 { | |
558 OrthancPlugins::LogError("Cannot register Python class: OrthancPluginRestOutput"); | |
559 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | |
560 } | |
561 | |
562 Py_INCREF(&sdk_OrthancPluginRestOutput_Type); | |
563 if (PyModule_AddObject(module, "RestOutput", (PyObject *)&sdk_OrthancPluginRestOutput_Type) < 0) | |
564 { | |
565 OrthancPlugins::LogError("Cannot register Python class: OrthancPluginRestOutput"); | |
566 Py_DECREF(&sdk_OrthancPluginRestOutput_Type); | |
567 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | |
568 } | |
569 } | |
570 | |
571 | |
572 PyObject* GetOrthancPluginRestOutputType() | |
573 { | |
574 return (PyObject*) &sdk_OrthancPluginRestOutput_Type; | |
575 } |