Mercurial > hg > orthanc-python
comparison Sources/Autogenerated/sdk_OrthancPluginDicomWebNode.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 OrthancPluginDicomWebNode* object_; | |
26 bool borrowed_; | |
27 } sdk_OrthancPluginDicomWebNode_Object; | |
28 | |
29 | |
30 | |
31 // Forward declaration of the methods | |
32 | |
33 | |
34 static PyMethodDef sdk_OrthancPluginDicomWebNode_Methods[] = { | |
35 { NULL } /* Sentinel */ | |
36 }; | |
37 | |
38 | |
39 static int sdk_OrthancPluginDicomWebNode_Constructor( | |
40 sdk_OrthancPluginDicomWebNode_Object *self, PyObject *args, PyObject *kwds) | |
41 { | |
42 OrthancPlugins::LogInfo("Creating Python object of class OrthancPluginDicomWebNode"); | |
43 | |
44 self->object_ = NULL; | |
45 self->borrowed_ = false; | |
46 | |
47 long long object = 0; | |
48 unsigned char borrowed = false; | |
49 | |
50 if (PyArg_ParseTuple(args, "Lb", &object, &borrowed)) | |
51 { | |
52 self->object_ = reinterpret_cast<OrthancPluginDicomWebNode*>(static_cast<intptr_t>(object)); | |
53 self->borrowed_ = borrowed; | |
54 return 0; | |
55 } | |
56 else | |
57 { | |
58 PyErr_SetString(PyExc_ValueError, "Expected a pair (pointer, borrowed) in the constructor"); | |
59 return -1; | |
60 } | |
61 } | |
62 | |
63 | |
64 /** | |
65 * Static global structure => the fields that are beyond the last | |
66 * initialized field are set to zero. | |
67 * https://stackoverflow.com/a/11152199/881731 | |
68 **/ | |
69 static PyTypeObject sdk_OrthancPluginDicomWebNode_Type = { | |
70 PyVarObject_HEAD_INIT(NULL, 0) | |
71 "orthanc.DicomWebNode", /* tp_name */ | |
72 sizeof(sdk_OrthancPluginDicomWebNode_Object), /* tp_basicsize */ | |
73 }; | |
74 | |
75 | |
76 | |
77 | |
78 // Actual implementation of the methods | |
79 | |
80 | |
81 static void RegisterOrthancPluginDicomWebNodeClass(PyObject* module) | |
82 { | |
83 sdk_OrthancPluginDicomWebNode_Type.tp_new = PyType_GenericNew; | |
84 sdk_OrthancPluginDicomWebNode_Type.tp_flags = Py_TPFLAGS_DEFAULT; | |
85 sdk_OrthancPluginDicomWebNode_Type.tp_doc = "Generated from Orthanc C class: OrthancPluginDicomWebNode"; | |
86 sdk_OrthancPluginDicomWebNode_Type.tp_methods = sdk_OrthancPluginDicomWebNode_Methods; | |
87 sdk_OrthancPluginDicomWebNode_Type.tp_init = (initproc) sdk_OrthancPluginDicomWebNode_Constructor; | |
88 | |
89 | |
90 if (PyType_Ready(&sdk_OrthancPluginDicomWebNode_Type) < 0) | |
91 { | |
92 OrthancPlugins::LogError("Cannot register Python class: OrthancPluginDicomWebNode"); | |
93 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | |
94 } | |
95 | |
96 Py_INCREF(&sdk_OrthancPluginDicomWebNode_Type); | |
97 if (PyModule_AddObject(module, "DicomWebNode", (PyObject *)&sdk_OrthancPluginDicomWebNode_Type) < 0) | |
98 { | |
99 OrthancPlugins::LogError("Cannot register Python class: OrthancPluginDicomWebNode"); | |
100 Py_DECREF(&sdk_OrthancPluginDicomWebNode_Type); | |
101 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | |
102 } | |
103 } | |
104 | |
105 | |
106 PyObject* GetOrthancPluginDicomWebNodeType() | |
107 { | |
108 return (PyObject*) &sdk_OrthancPluginDicomWebNode_Type; | |
109 } |