# HG changeset patch # User Sebastien Jodogne # Date 1546620514 -3600 # Node ID d498ece73562b1bac80a64320668c77c0b079d95 # Parent df1b17be20f67380b3c16b2c563498303b6121f1 preparing extension CreateResources diff -r df1b17be20f6 -r d498ece73562 OrthancServer/ServerToolbox.cpp --- a/OrthancServer/ServerToolbox.cpp Fri Jan 04 17:22:47 2019 +0100 +++ b/OrthancServer/ServerToolbox.cpp Fri Jan 04 17:48:34 2019 +0100 @@ -99,6 +99,40 @@ } + void ResourcesContent::EncodeForPlugins( + std::vector& tags, + std::vector& metadata) const + { + tags.reserve(tags_.size()); + metadata.reserve(metadata_.size()); + + for (std::list::const_iterator + it = tags_.begin(); it != tags_.end(); ++it) + { + OrthancPluginResourcesContentTags tmp; + tmp.resource = it->resourceId_; + tmp.isIdentifier = it->isIdentifier_; + tmp.group = it->tag_.GetGroup(); + tmp.element = it->tag_.GetElement(); + tmp.value = it->value_.c_str(); + tags.push_back(tmp); + } + + for (std::list::const_iterator + it = metadata_.begin(); it != metadata_.end(); ++it) + { + OrthancPluginResourcesContentMetadata tmp; + tmp.resource = it->resourceId_; + tmp.metadata = it->metadata_; + tmp.value = it->value_.c_str(); + metadata.push_back(tmp); + } + + assert(tags.size() == tags_.size() && + metadata.size() == metadata_.size()); + } + + static void StoreMainDicomTagsInternal(ResourcesContent& target, int64_t resource, const DicomMap& tags) diff -r df1b17be20f6 -r d498ece73562 OrthancServer/ServerToolbox.h --- a/OrthancServer/ServerToolbox.h Fri Jan 04 17:22:47 2019 +0100 +++ b/OrthancServer/ServerToolbox.h Fri Jan 04 17:48:34 2019 +0100 @@ -39,6 +39,8 @@ #include #include +#include + namespace Orthanc { class ServerContext; @@ -122,6 +124,11 @@ // WARNING: The database should be locked with a transaction! void Store(Compatibility::ISetResourcesContent& target) const; + + // WARNING: The resulting C structure will contain pointers to the + // current object. Don't delete or modify it! + void EncodeForPlugins(std::vector& tags, + std::vector& metadata) const; }; diff -r df1b17be20f6 -r d498ece73562 Plugins/Include/orthanc/OrthancCDatabasePlugin.h --- a/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Fri Jan 04 17:22:47 2019 +0100 +++ b/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Fri Jan 04 17:48:34 2019 +0100 @@ -155,6 +155,22 @@ int64_t seriesId; } OrthancPluginCreateInstanceResult; + typedef struct /* New in Orthanc 1.5.2 */ + { + int64_t resource; + uint8_t isIdentifier; + uint16_t group; + uint16_t element; + const char* value; + } OrthancPluginResourcesContentTags; + + typedef struct /* New in Orthanc 1.5.2 */ + { + int64_t resource; + int32_t metadata; + const char* value; + } OrthancPluginResourcesContentMetadata; + typedef struct { @@ -769,7 +785,16 @@ const char* hashStudy, const char* hashSeries, const char* hashInstance); - } OrthancPluginDatabaseExtensions; + + OrthancPluginErrorCode (*setResourcesContent) ( + /* inputs */ + void* payload, + uint32_t countTags, + uint32_t countMetadata, + const OrthancPluginResourcesContentTags* tags, + const OrthancPluginResourcesContentMetadata* metadata); + + } OrthancPluginDatabaseExtensions; /*