Mercurial > hg > orthanc-python
annotate Sources/Autogenerated/sdk_OrthancPluginPeers.impl.h @ 77:e7ff5efb100d
Custom exception "orthanc.OrthancException" is raised instead of "ValueError"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Aug 2021 18:16:42 +0200 |
parents | cbfc72a53970 |
children | eb6ac5a801d1 |
rev | line source |
---|---|
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Python plugin for Orthanc |
56
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
28
diff
changeset
|
3 * Copyright (C) 2020-2021 Osimis S.A., Belgium |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * This program is free software: you can redistribute it and/or |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Affero General Public License |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * as published by the Free Software Foundation, either version 3 of |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * the License, or (at your option) any later version. |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, but |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * WITHOUT ANY WARRANTY; without even the implied warranty of |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * Affero General Public License for more details. |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Affero General Public License |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 **/ |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 |
63
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
20 // Forward declaration of the autogenerated methods |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeersCount( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 sdk_OrthancPluginPeers_Object* self, PyObject *args); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeerName( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 sdk_OrthancPluginPeers_Object* self, PyObject *args); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeerUrl( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 sdk_OrthancPluginPeers_Object* self, PyObject *args); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeerUserProperty( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 sdk_OrthancPluginPeers_Object* self, PyObject *args); |
63
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
29 // End of forward declarations |
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
30 |
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
31 |
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
32 // Forward declaration of the custom methods |
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
33 // End of forward declarations |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 static PyMethodDef sdk_OrthancPluginPeers_Methods[] = { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 { "GetPeersCount", |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 (PyCFunction) sdk_OrthancPluginPeers_OrthancPluginGetPeersCount, METH_VARARGS, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 "Generated from C function OrthancPluginGetPeersCount()" }, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 { "GetPeerName", |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 (PyCFunction) sdk_OrthancPluginPeers_OrthancPluginGetPeerName, METH_VARARGS, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 "Generated from C function OrthancPluginGetPeerName()" }, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 { "GetPeerUrl", |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 (PyCFunction) sdk_OrthancPluginPeers_OrthancPluginGetPeerUrl, METH_VARARGS, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 "Generated from C function OrthancPluginGetPeerUrl()" }, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 { "GetPeerUserProperty", |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 (PyCFunction) sdk_OrthancPluginPeers_OrthancPluginGetPeerUserProperty, METH_VARARGS, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 "Generated from C function OrthancPluginGetPeerUserProperty()" }, |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 { NULL } /* Sentinel */ |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 }; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 static int sdk_OrthancPluginPeers_Constructor( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 sdk_OrthancPluginPeers_Object *self, PyObject *args, PyObject *kwds) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 { |
28
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1
diff
changeset
|
56 PythonLock::LogCall("Creating Python object of class OrthancPluginPeers"); |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 self->object_ = NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 self->borrowed_ = false; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 long long object = 0; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 unsigned char borrowed = false; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 if (PyArg_ParseTuple(args, "Lb", &object, &borrowed)) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 self->object_ = reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(object)); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 self->borrowed_ = borrowed; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 return 0; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 else |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 PyErr_SetString(PyExc_ValueError, "Expected a pair (pointer, borrowed) in the constructor"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 return -1; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 /** |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 * Static global structure => the fields that are beyond the last |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 * initialized field are set to zero. |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 * https://stackoverflow.com/a/11152199/881731 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 **/ |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 static PyTypeObject sdk_OrthancPluginPeers_Type = { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 PyVarObject_HEAD_INIT(NULL, 0) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 "orthanc.Peers", /* tp_name */ |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 sizeof(sdk_OrthancPluginPeers_Object), /* tp_basicsize */ |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 }; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 static void sdk_OrthancPluginPeers_Destructor(PyObject *self) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 { |
28
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1
diff
changeset
|
92 PythonLock::LogCall("Destroying Python object of class OrthancPluginPeers"); |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 sdk_OrthancPluginPeers_Object& tmp = *((sdk_OrthancPluginPeers_Object*) self); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 if (tmp.object_ != NULL && |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 !tmp.borrowed_) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 OrthancPluginFreePeers(OrthancPlugins::GetGlobalContext(), tmp.object_); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 tmp.object_ = NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 Py_TYPE(self)->tp_free((PyObject *)self); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 // Actual implementation of the methods |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeersCount( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 sdk_OrthancPluginPeers_Object* self, PyObject *args) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 { |
28
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1
diff
changeset
|
111 PythonLock::LogCall("Calling method OrthancPluginGetPeersCount() on object of class OrthancPluginPeers"); |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 if (self->object_ == NULL) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 PyErr_SetString(PyExc_ValueError, "Invalid object"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 return NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 long value = OrthancPluginGetPeersCount(OrthancPlugins::GetGlobalContext(), self->object_); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 return PyLong_FromLong(value); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeerName( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 sdk_OrthancPluginPeers_Object* self, PyObject *args) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 { |
28
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1
diff
changeset
|
128 PythonLock::LogCall("Calling method OrthancPluginGetPeerName() on object of class OrthancPluginPeers"); |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 if (self->object_ == NULL) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 PyErr_SetString(PyExc_ValueError, "Invalid object"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 return NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 unsigned long arg0 = 0; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 if (!PyArg_ParseTuple(args, "k", &arg0)) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 return NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 const char* s = OrthancPluginGetPeerName(OrthancPlugins::GetGlobalContext(), self->object_, arg0); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 if (s == NULL) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 Py_INCREF(Py_None); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 return Py_None; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 else |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 return PyUnicode_FromString(s); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeerUrl( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 sdk_OrthancPluginPeers_Object* self, PyObject *args) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 { |
28
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1
diff
changeset
|
159 PythonLock::LogCall("Calling method OrthancPluginGetPeerUrl() on object of class OrthancPluginPeers"); |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 if (self->object_ == NULL) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 PyErr_SetString(PyExc_ValueError, "Invalid object"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 return NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 unsigned long arg0 = 0; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 if (!PyArg_ParseTuple(args, "k", &arg0)) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 return NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 const char* s = OrthancPluginGetPeerUrl(OrthancPlugins::GetGlobalContext(), self->object_, arg0); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 if (s == NULL) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 Py_INCREF(Py_None); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 return Py_None; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 else |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 return PyUnicode_FromString(s); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 static PyObject *sdk_OrthancPluginPeers_OrthancPluginGetPeerUserProperty( |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 sdk_OrthancPluginPeers_Object* self, PyObject *args) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 { |
28
b2bbb516056e
The "Calling Python..." info logs are disabled if "PythonVerbose" is "false"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1
diff
changeset
|
190 PythonLock::LogCall("Calling method OrthancPluginGetPeerUserProperty() on object of class OrthancPluginPeers"); |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 if (self->object_ == NULL) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 PyErr_SetString(PyExc_ValueError, "Invalid object"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 return NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 unsigned long arg0 = 0; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 const char* arg1 = NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 if (!PyArg_ParseTuple(args, "ks", &arg0, &arg1)) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 return NULL; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 const char* s = OrthancPluginGetPeerUserProperty(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 if (s == NULL) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 Py_INCREF(Py_None); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 return Py_None; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 else |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 return PyUnicode_FromString(s); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 static void RegisterOrthancPluginPeersClass(PyObject* module) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 sdk_OrthancPluginPeers_Type.tp_new = PyType_GenericNew; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 sdk_OrthancPluginPeers_Type.tp_flags = Py_TPFLAGS_DEFAULT; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 sdk_OrthancPluginPeers_Type.tp_doc = "Generated from Orthanc C class: OrthancPluginPeers"; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 sdk_OrthancPluginPeers_Type.tp_methods = sdk_OrthancPluginPeers_Methods; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 sdk_OrthancPluginPeers_Type.tp_init = (initproc) sdk_OrthancPluginPeers_Constructor; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 /** |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 * "tp_dealloc is called when the reference count of the object goes |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 * down to zero. This is where you destroy the object and its |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 * members. It should then free the memory occupied by the object by |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 * calling tp_free." |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 * https://stackoverflow.com/a/24863227/881731 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 **/ |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 sdk_OrthancPluginPeers_Type.tp_dealloc = sdk_OrthancPluginPeers_Destructor; |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 if (PyType_Ready(&sdk_OrthancPluginPeers_Type) < 0) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 OrthancPlugins::LogError("Cannot register Python class: OrthancPluginPeers"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 Py_INCREF(&sdk_OrthancPluginPeers_Type); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 if (PyModule_AddObject(module, "Peers", (PyObject *)&sdk_OrthancPluginPeers_Type) < 0) |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 { |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 OrthancPlugins::LogError("Cannot register Python class: OrthancPluginPeers"); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 Py_DECREF(&sdk_OrthancPluginPeers_Type); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 } |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 |
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 |
63
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
254 PyTypeObject* GetOrthancPluginPeersType() |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 { |
63
32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
256 return &sdk_OrthancPluginPeers_Type; |
1
fef9a239df5c
adding auto-generated files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 } |