Mercurial > hg > orthanc
diff Plugins/Include/orthanc/OrthancCPlugin.h @ 2823:807169f85ba9
OrthancPluginGetPeerUserProperty()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 18 Sep 2018 15:38:18 +0200 |
parents | 1b6497e412e4 |
children | 9f48722e8508 |
line wrap: on
line diff
--- a/Plugins/Include/orthanc/OrthancCPlugin.h Mon Sep 17 12:08:49 2018 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Tue Sep 18 15:38:18 2018 +0200 @@ -527,6 +527,7 @@ _OrthancPluginService_GetPeerName = 8004, _OrthancPluginService_GetPeerUrl = 8005, _OrthancPluginService_CallPeerApi = 8006, + _OrthancPluginService_GetPeerUserProperty = 8007, /* Primitives for handling jobs (new in 1.4.2) */ _OrthancPluginService_CreateJob = 9000, @@ -6000,6 +6001,7 @@ const char** target; const OrthancPluginPeers* peers; uint32_t peerIndex; + const char* userProperty; } _OrthancPluginGetPeerProperty; /** @@ -6031,6 +6033,7 @@ params.target = ⌖ params.peers = peers; params.peerIndex = peerIndex; + params.userProperty = NULL; if (context->InvokeService(context, _OrthancPluginService_GetPeerName, ¶ms) != OrthancPluginErrorCode_Success) { @@ -6071,6 +6074,7 @@ params.target = ⌖ params.peers = peers; params.peerIndex = peerIndex; + params.userProperty = NULL; if (context->InvokeService(context, _OrthancPluginService_GetPeerUrl, ¶ms) != OrthancPluginErrorCode_Success) { @@ -6085,6 +6089,53 @@ + /** + * @brief Get some user-defined property of an Orthanc peer. + * + * This function returns some user-defined property of some Orthanc + * peer. An user-defined property is a property that is associated + * with the peer in the Orthanc configuration file, but that is not + * recognized by the Orthanc core. + * + * This function is thread-safe: Several threads sharing the same + * OrthancPluginPeers object can simultaneously call this function. + * + * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). + * @param peers The data structure describing the Orthanc peers. + * @param peerIndex The index of the peer of interest. + * This value must be lower than OrthancPluginGetPeersCount(). + * @param userProperty The user property of interest. + * @result The value of the user property, or NULL if it is not defined. + * @ingroup Toolbox + **/ + ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetPeerUserProperty( + OrthancPluginContext* context, + const OrthancPluginPeers* peers, + uint32_t peerIndex, + const char* userProperty) + { + const char* target = NULL; + + _OrthancPluginGetPeerProperty params; + memset(¶ms, 0, sizeof(params)); + params.target = ⌖ + params.peers = peers; + params.peerIndex = peerIndex; + params.userProperty = userProperty; + + if (context->InvokeService(context, _OrthancPluginService_GetPeerUserProperty, ¶ms) != OrthancPluginErrorCode_Success) + { + /* No such user property */ + return NULL; + } + else + { + return target; + } + } + + + typedef struct { OrthancPluginMemoryBuffer* answerBody;