Mercurial > hg > orthanc-python
comparison CodeAnalysis/Class.mustache @ 63:32de70a1e4c7
New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jun 2021 18:19:27 +0200 |
parents | 23f3099bed47 |
children | cbfc72a53970 |
comparison
equal
deleted
inserted
replaced
62:d82eef8c98fc | 63:32de70a1e4c7 |
---|---|
15 * You should have received a copy of the GNU Affero General Public License | 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/>. | 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 **/ | 17 **/ |
18 | 18 |
19 | 19 |
20 typedef struct | 20 // Forward declaration of the autogenerated methods |
21 { | |
22 PyObject_HEAD | |
23 | |
24 /* Type-specific fields go here. */ | |
25 {{class_name}}* object_; | |
26 bool borrowed_; | |
27 } sdk_{{class_name}}_Object; | |
28 | |
29 | |
30 | |
31 // Forward declaration of the methods | |
32 {{#methods}} | 21 {{#methods}} |
33 static PyObject *sdk_{{class_name}}_{{c_function}}( | 22 static PyObject *sdk_{{class_name}}_{{c_function}}( |
34 sdk_{{class_name}}_Object* self, PyObject *args); | 23 sdk_{{class_name}}_Object* self, PyObject *args); |
35 {{/methods}} | 24 {{/methods}} |
25 // End of forward declarations | |
26 | |
27 | |
28 // Forward declaration of the custom methods | |
29 {{#custom_methods}} | |
30 extern PyObject *{{implementation}}( | |
31 sdk_{{class_name}}_Object* self, PyObject *args); | |
32 {{/custom_methods}} | |
33 // End of forward declarations | |
36 | 34 |
37 | 35 |
38 static PyMethodDef sdk_{{class_name}}_Methods[] = { | 36 static PyMethodDef sdk_{{class_name}}_Methods[] = { |
39 {{#methods}} | 37 {{#methods}} |
40 { "{{short_name}}", | 38 { "{{short_name}}", |
41 (PyCFunction) sdk_{{class_name}}_{{c_function}}, METH_VARARGS, | 39 (PyCFunction) sdk_{{class_name}}_{{c_function}}, METH_VARARGS, |
42 "Generated from C function {{c_function}}()" }, | 40 "Generated from C function {{c_function}}()" }, |
43 {{/methods}} | 41 {{/methods}} |
42 {{#custom_methods}} | |
43 { "{{method_name}}", | |
44 (PyCFunction) {{implementation}}, METH_VARARGS, | |
45 "Generated from C function {{sdk_function}}()" }, | |
46 {{/custom_methods}} | |
44 { NULL } /* Sentinel */ | 47 { NULL } /* Sentinel */ |
45 }; | 48 }; |
46 | 49 |
47 | 50 |
48 static int sdk_{{class_name}}_Constructor( | 51 static int sdk_{{class_name}}_Constructor( |
155 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | 158 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); |
156 } | 159 } |
157 } | 160 } |
158 | 161 |
159 | 162 |
160 PyObject* Get{{class_name}}Type() | 163 PyTypeObject* Get{{class_name}}Type() |
161 { | 164 { |
162 return (PyObject*) &sdk_{{class_name}}_Type; | 165 return &sdk_{{class_name}}_Type; |
163 } | 166 } |