diff OrthancServer/Sources/ResourceFinder.cpp @ 5674:74f3aab95886 find-refactoring

simplification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 06 Jul 2024 14:43:46 +0200
parents e300f22a46f0
children b744a2cf408a
line wrap: on
line diff
--- a/OrthancServer/Sources/ResourceFinder.cpp	Sat Jul 06 14:31:22 2024 +0200
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Sat Jul 06 14:43:46 2024 +0200
@@ -132,15 +132,12 @@
       return SeriesStatus_Unknown;
     }
 
-    std::list<std::string> values;
-    if (!resource.LookupChildrenMetadata(values, MetadataType_Instance_IndexInSeries))
-    {
-      throw OrthancException(ErrorCode_BadSequenceOfCalls);
-    }
+    std::set<std::string> values;
+    resource.GetChildrenMetadataValues(values, ResourceType_Instance, MetadataType_Instance_IndexInSeries);
 
     std::set<int64_t> instances;
 
-    for (std::list<std::string>::const_iterator
+    for (std::set<std::string>::const_iterator
            it = values.begin(); it != values.end(); ++it)
     {
       int64_t index;
@@ -438,7 +435,7 @@
           break;
 
         case ResourceType_Series:
-          request_.AddRetrieveChildrenMetadata(MetadataType_Instance_IndexInSeries); // required for the SeriesStatus
+          request_.GetChildrenRetrieveSpecification(ResourceType_Instance).AddMetadata(MetadataType_Instance_IndexInSeries); // required for the SeriesStatus
           request_.GetChildrenRetrieveSpecification(ResourceType_Instance).SetRetrieveIdentifiers(true);
           request_.SetRetrieveParentIdentifier(true);
           break;