Mercurial > hg > orthanc-python
diff 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 |
line wrap: on
line diff
--- a/CodeAnalysis/Class.mustache Fri May 28 10:53:18 2021 +0200 +++ b/CodeAnalysis/Class.mustache Thu Jun 10 18:19:27 2021 +0200 @@ -17,22 +17,20 @@ **/ -typedef struct -{ - PyObject_HEAD - - /* Type-specific fields go here. */ - {{class_name}}* object_; - bool borrowed_; -} sdk_{{class_name}}_Object; - - - -// Forward declaration of the methods +// Forward declaration of the autogenerated methods {{#methods}} static PyObject *sdk_{{class_name}}_{{c_function}}( sdk_{{class_name}}_Object* self, PyObject *args); {{/methods}} +// End of forward declarations + + +// Forward declaration of the custom methods +{{#custom_methods}} +extern PyObject *{{implementation}}( + sdk_{{class_name}}_Object* self, PyObject *args); +{{/custom_methods}} +// End of forward declarations static PyMethodDef sdk_{{class_name}}_Methods[] = { @@ -41,6 +39,11 @@ (PyCFunction) sdk_{{class_name}}_{{c_function}}, METH_VARARGS, "Generated from C function {{c_function}}()" }, {{/methods}} +{{#custom_methods}} + { "{{method_name}}", + (PyCFunction) {{implementation}}, METH_VARARGS, + "Generated from C function {{sdk_function}}()" }, +{{/custom_methods}} { NULL } /* Sentinel */ }; @@ -157,7 +160,7 @@ } -PyObject* Get{{class_name}}Type() +PyTypeObject* Get{{class_name}}Type() { - return (PyObject*) &sdk_{{class_name}}_Type; + return &sdk_{{class_name}}_Type; }