diff OrthancServer/Sources/ResourceFinder.cpp @ 5696:0f8b6214308a find-refactoring

preparing to use ResourceFinder in OrthancFindRequestHandler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jul 2024 10:56:33 +0200
parents 4a85ee2cbe1f
children f375e9983943
line wrap: on
line diff
--- a/OrthancServer/Sources/ResourceFinder.cpp	Fri Jul 12 10:16:20 2024 +0200
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Fri Jul 12 10:56:33 2024 +0200
@@ -949,7 +949,7 @@
       {
         if (pagingMode_ == PagingMode_FullDatabase)
         {
-          visitor.Apply(resource, hasRequestedTags_, requestedTags);
+          visitor.Apply(resource, requestedTags);
         }
         else
         {
@@ -967,7 +967,7 @@
           }
           else
           {
-            visitor.Apply(resource, hasRequestedTags_, requestedTags);
+            visitor.Apply(resource, requestedTags);
             countResults++;
           }
         }
@@ -990,19 +990,21 @@
       const ResourceFinder&  that_;
       ServerIndex& index_;
       Json::Value& target_;
+      bool         hasRequestedTags_;
 
     public:
       Visitor(const ResourceFinder& that,
               ServerIndex& index,
-              Json::Value& target) :
+              Json::Value& target,
+              bool hasRequestedTags) :
         that_(that),
         index_(index),
-        target_(target)
+        target_(target),
+        hasRequestedTags_(hasRequestedTags)
       {
       }
 
       virtual void Apply(const FindResponse::Resource& resource,
-                         bool hasRequestedTags,
                          const DicomMap& requestedTags) ORTHANC_OVERRIDE
       {
         if (that_.expand_)
@@ -1010,7 +1012,7 @@
           Json::Value item;
           that_.Expand(item, resource, index_);
 
-          if (hasRequestedTags)
+          if (hasRequestedTags_)
           {
             static const char* const REQUESTED_TAGS = "RequestedTags";
             item[REQUESTED_TAGS] = Json::objectValue;
@@ -1032,7 +1034,7 @@
 
     target = Json::arrayValue;
 
-    Visitor visitor(*this, context.GetIndex(), target);
+    Visitor visitor(*this, context.GetIndex(), target, hasRequestedTags_);
     Execute(visitor, context);
   }