# HG changeset patch # User Sebastien Jodogne # Date 1720010365 -7200 # Node ID 2db6c1f6417fa6d2be6cea0ff755b595e49a8688 # Parent d7acfccc0d0b9aa33aa4f4b6b91b0e1f8f84289d documented orthanc.RegisterStorageArea() diff -r d7acfccc0d0b -r 2db6c1f6417f CodeAnalysis/CustomFunctions.json --- 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" } ] diff -r d7acfccc0d0b -r 2db6c1f6417f Sources/Autogenerated/orthanc.pyi --- 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: ... diff -r d7acfccc0d0b -r 2db6c1f6417f Sources/Autogenerated/sdk_GlobalFunctions.impl.h --- 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 } diff -r d7acfccc0d0b -r 2db6c1f6417f Sources/Plugin.cpp --- 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 **/ { diff -r d7acfccc0d0b -r 2db6c1f6417f Sources/StorageArea.cpp --- 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" diff -r d7acfccc0d0b -r 2db6c1f6417f Sources/StorageArea.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();