changeset 193:66cd20e970d8 java-code-model

simplification for custom methods
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Jul 2024 18:37:04 +0200
parents b0f096d2339e
children 0c5da632f34d
files CodeAnalysis/Class.mustache CodeAnalysis/CustomFunctions.json CodeAnalysis/CustomMethods.json CodeAnalysis/GenerateOrthancSDK.py Sources/Autogenerated/orthanc.pyi Sources/Autogenerated/sdk_OrthancPluginDicomInstance.impl.h Sources/Autogenerated/sdk_OrthancPluginFindQuery.impl.h Sources/Autogenerated/sdk_OrthancPluginImage.impl.h
diffstat 8 files changed, 32 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/CodeAnalysis/Class.mustache	Tue Jul 02 18:25:53 2024 +0200
+++ b/CodeAnalysis/Class.mustache	Tue Jul 02 18:37:04 2024 +0200
@@ -32,8 +32,7 @@
 
 // Forward declaration of the custom methods
 {{#custom_methods}}
-extern PyObject *{{implementation}}(
-  sdk_{{class_name}}_Object* self, PyObject *args);
+extern PyObject *{{implementation}}(sdk_{{class_name}}_Object* self, PyObject *args);
 {{/custom_methods}}
 // End of forward declarations
 
@@ -47,7 +46,7 @@
 {{#custom_methods}}
   { "{{short_name}}",
     (PyCFunction) {{implementation}}, METH_VARARGS,
-    "Generated from C function {{sdk_function}}()" },
+    "Implemented in C++ function {{implementation}}()" },
 {{/custom_methods}}
   { NULL }  /* Sentinel */
 };
--- a/CodeAnalysis/CustomFunctions.json	Tue Jul 02 18:25:53 2024 +0200
+++ b/CodeAnalysis/CustomFunctions.json	Tue Jul 02 18:37:04 2024 +0200
@@ -2,6 +2,13 @@
   {
     "short_name" : "RegisterRestCallback",
     "implementation" : "RegisterRestCallback",
+    "documentation" : {
+      "description" : [ "Register a REST callback." ],
+      "args" : {
+        "pathRegularExpression" : "Regular expression for the URI. May contain groups.",
+        "callback" : "The callback function to handle the REST call."
+      }
+    },
     "args" : [
       {
         "sdk_name" : "pathRegularExpression",
@@ -13,13 +20,6 @@
         "callable_type" : "typing.Callable[[RestOutput, str], None]"
       }
     ],
-    "documentation" : {
-      "args" : {
-        "pathRegularExpression" : "Regular expression for the URI. May contain groups.",
-        "callback" : "The callback function to handle the REST call."
-      },
-      "description" : [ "Register a REST callback." ]
-    },
     "return_sdk_type" : "void"
   }
 ]
--- a/CodeAnalysis/CustomMethods.json	Tue Jul 02 18:25:53 2024 +0200
+++ b/CodeAnalysis/CustomMethods.json	Tue Jul 02 18:37:04 2024 +0200
@@ -3,7 +3,6 @@
     {
       "short_name" : "GetFindQueryTagGroup",
       "implementation" : "GetFindQueryTagGroup",
-      "sdk_function" : "OrthancPluginGetFindQueryTag",
       "documentation" : {
         "description" : [ "This function returns the group of one DICOM tag in the given C-Find query." ],
         "args" : {
@@ -23,7 +22,6 @@
     {
       "short_name" : "GetFindQueryTagElement",
       "implementation" : "GetFindQueryTagElement",
-      "sdk_function" : "OrthancPluginGetFindQueryTag",
       "documentation" : {
         "description" : [ "This function returns the element of one DICOM tag in the given C-Find query." ],
         "args" : {
@@ -45,7 +43,6 @@
     {
       "short_name" : "GetInstanceData",
       "implementation" : "GetInstanceData",
-      "sdk_function" : "OrthancPluginGetInstanceData",
       "documentation" : {
         "description" : [ "Get the content of the DICOM instance." ],
         "return" : "The DICOM data."
@@ -60,7 +57,6 @@
     {
       "short_name" : "GetImageBuffer",
       "implementation" : "GetImageBuffer",
-      "sdk_function" : "OrthancPluginGetImageBuffer",
       "documentation" : {
         "description" : [ "This function returns a pointer to the memory buffer that contains the pixels of the image." ],
         "return" : "The pixel data."
--- a/CodeAnalysis/GenerateOrthancSDK.py	Tue Jul 02 18:25:53 2024 +0200
+++ b/CodeAnalysis/GenerateOrthancSDK.py	Tue Jul 02 18:37:04 2024 +0200
@@ -394,7 +394,7 @@
         'class_name' : c['name'],
         'short_name' : GetShortName(c['name']),
         'methods' : methods,
-        'custom_methods' : custom_methods,
+        'custom_methods' : sorted(custom_methods, key = lambda x: x['short_name']),
     })
 
     if 'destructor' in c:
--- a/Sources/Autogenerated/orthanc.pyi	Tue Jul 02 18:25:53 2024 +0200
+++ b/Sources/Autogenerated/orthanc.pyi	Tue Jul 02 18:37:04 2024 +0200
@@ -2334,6 +2334,18 @@
         """
         ...
 
+    # This function returns the element of one DICOM tag in the given C-Find query
+    def GetFindQueryTagElement(self, index: int) -> int:
+        """
+        This function returns the element of one DICOM tag in the given C-Find query.
+
+        Args:
+          index (int): The index of the tag of interest.
+
+        Returns:
+          int: The value of the element.
+        """
+        ...
     # This function returns the group of one DICOM tag in the given C-Find query
     def GetFindQueryTagGroup(self, index: int) -> int:
         """
@@ -2346,18 +2358,6 @@
           int: The value of the group.
         """
         ...
-    # This function returns the element of one DICOM tag in the given C-Find query
-    def GetFindQueryTagElement(self, index: int) -> int:
-        """
-        This function returns the element of one DICOM tag in the given C-Find query.
-
-        Args:
-          index (int): The index of the tag of interest.
-
-        Returns:
-          int: The value of the element.
-        """
-        ...
 class Image:
     ...
 
--- a/Sources/Autogenerated/sdk_OrthancPluginDicomInstance.impl.h	Tue Jul 02 18:25:53 2024 +0200
+++ b/Sources/Autogenerated/sdk_OrthancPluginDicomInstance.impl.h	Tue Jul 02 18:37:04 2024 +0200
@@ -55,8 +55,7 @@
 
 
 // Forward declaration of the custom methods
-extern PyObject *GetInstanceData(
-  sdk_OrthancPluginDicomInstance_Object* self, PyObject *args);
+extern PyObject *GetInstanceData(sdk_OrthancPluginDicomInstance_Object* self, PyObject *args);
 // End of forward declarations
 
 
@@ -105,7 +104,7 @@
     "Generated from C function OrthancPluginGetInstanceAdvancedJson()" },
   { "GetInstanceData",
     (PyCFunction) GetInstanceData, METH_VARARGS,
-    "Generated from C function OrthancPluginGetInstanceData()" },
+    "Implemented in C++ function GetInstanceData()" },
   { NULL }  /* Sentinel */
 };
 
--- a/Sources/Autogenerated/sdk_OrthancPluginFindQuery.impl.h	Tue Jul 02 18:25:53 2024 +0200
+++ b/Sources/Autogenerated/sdk_OrthancPluginFindQuery.impl.h	Tue Jul 02 18:37:04 2024 +0200
@@ -33,10 +33,8 @@
 
 
 // Forward declaration of the custom methods
-extern PyObject *GetFindQueryTagGroup(
-  sdk_OrthancPluginFindQuery_Object* self, PyObject *args);
-extern PyObject *GetFindQueryTagElement(
-  sdk_OrthancPluginFindQuery_Object* self, PyObject *args);
+extern PyObject *GetFindQueryTagElement(sdk_OrthancPluginFindQuery_Object* self, PyObject *args);
+extern PyObject *GetFindQueryTagGroup(sdk_OrthancPluginFindQuery_Object* self, PyObject *args);
 // End of forward declarations
 
 
@@ -50,12 +48,12 @@
   { "GetFindQueryValue",
     (PyCFunction) sdk_OrthancPluginFindQuery_OrthancPluginGetFindQueryValue, METH_VARARGS,
     "Generated from C function OrthancPluginGetFindQueryValue()" },
+  { "GetFindQueryTagElement",
+    (PyCFunction) GetFindQueryTagElement, METH_VARARGS,
+    "Implemented in C++ function GetFindQueryTagElement()" },
   { "GetFindQueryTagGroup",
     (PyCFunction) GetFindQueryTagGroup, METH_VARARGS,
-    "Generated from C function OrthancPluginGetFindQueryTag()" },
-  { "GetFindQueryTagElement",
-    (PyCFunction) GetFindQueryTagElement, METH_VARARGS,
-    "Generated from C function OrthancPluginGetFindQueryTag()" },
+    "Implemented in C++ function GetFindQueryTagGroup()" },
   { NULL }  /* Sentinel */
 };
 
--- a/Sources/Autogenerated/sdk_OrthancPluginImage.impl.h	Tue Jul 02 18:25:53 2024 +0200
+++ b/Sources/Autogenerated/sdk_OrthancPluginImage.impl.h	Tue Jul 02 18:37:04 2024 +0200
@@ -39,8 +39,7 @@
 
 
 // Forward declaration of the custom methods
-extern PyObject *GetImageBuffer(
-  sdk_OrthancPluginImage_Object* self, PyObject *args);
+extern PyObject *GetImageBuffer(sdk_OrthancPluginImage_Object* self, PyObject *args);
 // End of forward declarations
 
 
@@ -65,7 +64,7 @@
     "Generated from C function OrthancPluginDrawText()" },
   { "GetImageBuffer",
     (PyCFunction) GetImageBuffer, METH_VARARGS,
-    "Generated from C function OrthancPluginGetImageBuffer()" },
+    "Implemented in C++ function GetImageBuffer()" },
   { NULL }  /* Sentinel */
 };