changeset 212:2db6c1f6417f

documented orthanc.RegisterStorageArea()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jul 2024 14:39:25 +0200
parents d7acfccc0d0b
children f8dc8dd2da76
files CodeAnalysis/CustomFunctions.json Sources/Autogenerated/orthanc.pyi Sources/Autogenerated/sdk_GlobalFunctions.impl.h Sources/Plugin.cpp Sources/StorageArea.cpp Sources/StorageArea.h
diffstat 6 files changed, 68 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/CodeAnalysis/CustomFunctions.json	Wed Jul 03 14:21:01 2024 +0200
+++ b/CodeAnalysis/CustomFunctions.json	Wed Jul 03 14:39:25 2024 +0200
@@ -261,5 +261,43 @@
       }
     ],
     "return_sdk_type" : "void"
+  },
+
+  {
+    "comment" : "New in release 3.3",
+    "short_name" : "RegisterStorageArea",
+    "implementation" : "RegisterStorageArea",
+    "documentation" : {
+      "description" : [ "Register a custom storage area." ],
+      "args" : {
+        "create" : "The callback function to store a file on the custom storage area.",
+        "read" : "The callback function to read a file from the custom storage area.",
+        "remove" : "The callback function to remove a file from the custom storage area."
+      }
+    },
+    "args" : [
+      {
+        "sdk_name" : "create",
+        "sdk_type" : "Callable",
+        "callable_type" : "StorageCreateCallback",
+        "callable_protocol_args" : "uuid: str, content_type: ContentType, data: bytes",
+        "callable_protocol_return" : "None"
+      },
+      {
+        "sdk_name" : "read",
+        "sdk_type" : "Callable",
+        "callable_type" : "StorageReadCallback",
+        "callable_protocol_args" : "uuid: str, content_type: ContentType",
+        "callable_protocol_return" : "bytes"
+      },
+      {
+        "sdk_name" : "remove",
+        "sdk_type" : "Callable",
+        "callable_type" : "StorageRemoveCallback",
+        "callable_protocol_args" : "uuid: str, content_type: ContentType",
+        "callable_protocol_return" : "None"
+      }
+    ],
+    "return_sdk_type" : "void"
   }
 ]
--- a/Sources/Autogenerated/orthanc.pyi	Wed Jul 03 14:21:01 2024 +0200
+++ b/Sources/Autogenerated/orthanc.pyi	Wed Jul 03 14:39:25 2024 +0200
@@ -2300,6 +2300,30 @@
     """
     ...
 
+class StorageCreateCallback(typing.Protocol):
+    def __call__(self, uuid: str, content_type: ContentType, data: bytes) -> None:
+        ...
+
+class StorageReadCallback(typing.Protocol):
+    def __call__(self, uuid: str, content_type: ContentType) -> bytes:
+        ...
+
+class StorageRemoveCallback(typing.Protocol):
+    def __call__(self, uuid: str, content_type: ContentType) -> None:
+        ...
+
+# Register a custom storage area
+def RegisterStorageArea(create: StorageCreateCallback, read: StorageReadCallback, remove: StorageRemoveCallback) -> None:
+    """
+    Register a custom storage area.
+
+    Args:
+      create (StorageCreateCallback): The callback function to store a file on the custom storage area.
+      read (StorageReadCallback): The callback function to read a file from the custom storage area.
+      remove (StorageRemoveCallback): The callback function to remove a file from the custom storage area.
+    """
+    ...
+
 class WorklistCallback(typing.Protocol):
     def __call__(self, answers: WorklistAnswers, query: WorklistQuery, issuer_aet: str, called_aet: str) -> None:
         ...
--- a/Sources/Autogenerated/sdk_GlobalFunctions.impl.h	Wed Jul 03 14:21:01 2024 +0200
+++ b/Sources/Autogenerated/sdk_GlobalFunctions.impl.h	Wed Jul 03 14:39:25 2024 +0200
@@ -32,6 +32,7 @@
 extern PyObject *RegisterOnChangeCallback(PyObject* module, PyObject *args);
 extern PyObject *RegisterOnStoredInstanceCallback(PyObject* module, PyObject *args);
 extern PyObject *RegisterRestCallback(PyObject* module, PyObject *args);
+extern PyObject *RegisterStorageArea(PyObject* module, PyObject *args);
 extern PyObject *RegisterWorklistCallback(PyObject* module, PyObject *args);
 // End of forward declarations
 
@@ -2044,6 +2045,8 @@
     "Implemented in C++ function RegisterOnStoredInstanceCallback()" },
   { "RegisterRestCallback", RegisterRestCallback, METH_VARARGS,
     "Implemented in C++ function RegisterRestCallback()" },
+  { "RegisterStorageArea", RegisterStorageArea, METH_VARARGS,
+    "Implemented in C++ function RegisterStorageArea()" },
   { "RegisterWorklistCallback", RegisterWorklistCallback, METH_VARARGS,
     "Implemented in C++ function RegisterWorklistCallback()" },
   { NULL, NULL }
--- a/Sources/Plugin.cpp	Wed Jul 03 14:21:01 2024 +0200
+++ b/Sources/Plugin.cpp	Wed Jul 03 14:39:25 2024 +0200
@@ -279,17 +279,7 @@
 
   
   /**
-   * New in release 3.3
-   **/
-  
-  {
-    PyMethodDef f = { "RegisterStorageArea", RegisterStorageArea, METH_VARARGS, "" };
-    functions.push_back(f);
-  }
-
-
-  /**
-   * New in release 3.5
+   * New in release 4.0
    **/
   
   {
--- a/Sources/StorageArea.cpp	Wed Jul 03 14:21:01 2024 +0200
+++ b/Sources/StorageArea.cpp	Wed Jul 03 14:39:25 2024 +0200
@@ -21,6 +21,8 @@
 
 #include "StorageArea.h"
 
+#include "PythonHeaderWrapper.h"
+
 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
 #include "PythonString.h"
 
--- a/Sources/StorageArea.h	Wed Jul 03 14:21:01 2024 +0200
+++ b/Sources/StorageArea.h	Wed Jul 03 14:39:25 2024 +0200
@@ -21,8 +21,4 @@
 
 #pragma once
 
-#include "PythonHeaderWrapper.h"
-
-PyObject* RegisterStorageArea(PyObject* module, PyObject* args);
-
 void FinalizeStorageArea();