changeset 5030:d6ed4c73c719 delayed-deletion

SDK: Added GetDatabaseServerIdentifier
author Alain Mazy <am@osimis.io>
date Tue, 21 Jun 2022 17:29:17 +0200
parents 6fd815fae50f
children eec3e4a91663
files OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h
diffstat 2 files changed, 42 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue Jun 21 11:06:41 2022 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue Jun 21 17:29:17 2022 +0200
@@ -5621,6 +5621,16 @@
         return true;
       }
 
+      case _OrthancPluginService_GetDatabaseServerIdentifier:
+      {
+        const _OrthancPluginRetrieveStaticString& p =
+          *reinterpret_cast<const _OrthancPluginRetrieveStaticString*>(parameters);
+
+        *p.result = pimpl_->databaseServerIdentifier_.c_str();
+
+        return true;
+      }
+
       default:
       {
         // This service is unknown to the Orthanc plugin engine
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Jun 21 11:06:41 2022 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Jun 21 17:29:17 2022 +0200
@@ -446,7 +446,8 @@
     _OrthancPluginService_GenerateRestApiAuthorizationToken = 39,   /* New in Orthanc 1.8.1 */
     _OrthancPluginService_CreateMemoryBuffer64 = 40, /* New in Orthanc 1.9.0 */
     _OrthancPluginService_CreateDicom2 = 41,         /* New in Orthanc 1.9.0 */
-    
+    _OrthancPluginService_GetDatabaseServerIdentifier = 42,         /* New in Orthanc 1.11.1 */
+
     /* Registration of callbacks */
     _OrthancPluginService_RegisterRestCallback = 1000,
     _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
@@ -9002,7 +9003,36 @@
 
     return context->InvokeService(context, _OrthancPluginService_RegisterWebDavCollection, &params);
   }
-  
+
+
+  /**
+   * @brief Gets the DatabaseServerIdentifier.
+   *
+   * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
+   * @return the database server identifier.  This is a statically-allocated
+   * string, do not free it.
+   * @ingroup Toolbox
+   **/
+  ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetDatabaseServerIdentifier(
+    OrthancPluginContext*  context)
+  {
+    const char* result;
+
+    _OrthancPluginRetrieveStaticString params;
+    params.result = &result;
+    params.argument = NULL;
+
+    if (context->InvokeService(context, _OrthancPluginService_GetDatabaseServerIdentifier, &params) != OrthancPluginErrorCode_Success)
+    {
+      /* Error */
+      return NULL;
+    }
+    else
+    {
+      return result;
+    }
+  }
+
 
 #ifdef  __cplusplus
 }