diff Plugins/Engine/OrthancPluginDatabase.cpp @ 2697:e583478e0c6c jobs

New primitive in database SDK: "lookupIdentifierRange" to speed up range searches
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Jul 2018 15:59:17 +0200
parents 878b59270859
children bfee0b9f3209
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPluginDatabase.cpp	Tue Jul 03 15:07:41 2018 +0200
+++ b/Plugins/Engine/OrthancPluginDatabase.cpp	Tue Jul 03 15:59:17 2018 +0200
@@ -634,6 +634,34 @@
   }
 
 
+  void OrthancPluginDatabase::LookupIdentifierRange(std::list<int64_t>& result,
+                                                    ResourceType level,
+                                                    const DicomTag& tag,
+                                                    const std::string& start,
+                                                    const std::string& end)
+  {
+    if (extensions_.lookupIdentifierRange == NULL)
+    {
+      // Default implementation, for plugins using Orthanc SDK <= 1.3.2
+
+      LookupIdentifier(result, level, tag, IdentifierConstraintType_GreaterOrEqual, start);
+
+      std::list<int64_t> b;
+      LookupIdentifier(result, level, tag, IdentifierConstraintType_SmallerOrEqual, end);
+
+      result.splice(result.end(), b);
+    }
+    else
+    {
+      ResetAnswers();
+      CheckSuccess(extensions_.lookupIdentifierRange(GetContext(), payload_, Plugins::Convert(level),
+                                                     tag.GetGroup(), tag.GetElement(),
+                                                     start.c_str(), end.c_str()));
+      ForwardAnswers(result);
+    }
+  }
+
+
   bool OrthancPluginDatabase::LookupMetadata(std::string& target,
                                              int64_t id,
                                              MetadataType type)