# HG changeset patch # User Alain Mazy # Date 1655825357 -7200 # Node ID d6ed4c73c7190714c4f5f52b198cc8ddb437ff73 # Parent 6fd815fae50f7f94dc4df7a79e19ff33c05e9a5d SDK: Added GetDatabaseServerIdentifier diff -r 6fd815fae50f -r d6ed4c73c719 OrthancServer/Plugins/Engine/OrthancPlugins.cpp --- 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(parameters); + + *p.result = pimpl_->databaseServerIdentifier_.c_str(); + + return true; + } + default: { // This service is unknown to the Orthanc plugin engine diff -r 6fd815fae50f -r d6ed4c73c719 OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h --- 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, ¶ms); } - + + + /** + * @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, ¶ms) != OrthancPluginErrorCode_Success) + { + /* Error */ + return NULL; + } + else + { + return result; + } + } + #ifdef __cplusplus }