Mercurial > hg > orthanc
changeset 3088:d498ece73562 db-changes
preparing extension CreateResources
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 04 Jan 2019 17:48:34 +0100 |
parents | df1b17be20f6 |
children | fb8ee0786b1e |
files | OrthancServer/ServerToolbox.cpp OrthancServer/ServerToolbox.h Plugins/Include/orthanc/OrthancCDatabasePlugin.h |
diffstat | 3 files changed, 67 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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<OrthancPluginResourcesContentTags>& tags, + std::vector<OrthancPluginResourcesContentMetadata>& metadata) const + { + tags.reserve(tags_.size()); + metadata.reserve(metadata_.size()); + + for (std::list<TagValue>::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<Metadata>::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)
--- 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 <boost/noncopyable.hpp> #include <list> +#include <orthanc/OrthancCDatabasePlugin.h> + 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<OrthancPluginResourcesContentTags>& tags, + std::vector<OrthancPluginResourcesContentMetadata>& metadata) const; };
--- 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; /*<! @endcond */