diff OrthancServer/ServerToolbox.cpp @ 3089:fb8ee0786b1e db-changes

new extension for database plugin SDK: setResourcesContent
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 05 Jan 2019 11:39:31 +0100
parents d498ece73562
children 2e1808b6146a
line wrap: on
line diff
--- a/OrthancServer/ServerToolbox.cpp	Fri Jan 04 17:48:34 2019 +0100
+++ b/OrthancServer/ServerToolbox.cpp	Sat Jan 05 11:39:31 2019 +0100
@@ -100,10 +100,12 @@
 
 
   void ResourcesContent::EncodeForPlugins(
-    std::vector<OrthancPluginResourcesContentTags>& tags,
+    std::vector<OrthancPluginResourcesContentTags>& identifierTags,
+    std::vector<OrthancPluginResourcesContentTags>& mainDicomTags,
     std::vector<OrthancPluginResourcesContentMetadata>& metadata) const
   {
-    tags.reserve(tags_.size());
+    identifierTags.reserve(tags_.size());
+    mainDicomTags.reserve(tags_.size());
     metadata.reserve(metadata_.size());
 
     for (std::list<TagValue>::const_iterator
@@ -111,11 +113,18 @@
     {
       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);
+
+      if (it->isIdentifier_)
+      {
+        identifierTags.push_back(tmp);
+      }
+      else
+      {
+        mainDicomTags.push_back(tmp);
+      }
     }
 
     for (std::list<Metadata>::const_iterator
@@ -128,7 +137,7 @@
       metadata.push_back(tmp);
     }
 
-    assert(tags.size() == tags_.size() &&
+    assert(identifierTags.size() + mainDicomTags.size() == tags_.size() &&
            metadata.size() == metadata_.size());
   }