changeset 5679:527918e9c5d9 find-refactoring

integration mainline->find-refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jul 2024 09:03:40 +0200
parents dc96401dbe88 (current diff) e47ac5e133b1 (diff)
children 77875b51cf95
files OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp OrthancServer/Sources/Database/MainDicomTagsRegistry.h OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h
diffstat 4 files changed, 38 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp	Mon Jul 08 19:03:23 2024 +0200
+++ b/OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp	Tue Jul 09 09:03:40 2024 +0200
@@ -96,4 +96,34 @@
       type = it->second.GetType();
     }
   }
+
+
+  void MainDicomTagsRegistry::NormalizeLookup(std::vector<DatabaseConstraint>& target,
+                                              const DatabaseLookup& source,
+                                              ResourceType queryLevel) const
+  {
+    target.clear();
+    target.reserve(source.GetConstraintsCount());
+
+    for (size_t i = 0; i < source.GetConstraintsCount(); i++)
+    {
+      ResourceType level;
+      DicomTagType type;
+
+      LookupTag(level, type, source.GetConstraint(i).GetTag());
+
+      if (type == DicomTagType_Identifier ||
+          type == DicomTagType_Main)
+      {
+        // Use the fact that patient-level tags are copied at the study level
+        if (level == ResourceType_Patient &&
+            queryLevel != ResourceType_Patient)
+        {
+          level = ResourceType_Study;
+        }
+
+        target.push_back(source.GetConstraint(i).ConvertToDatabaseConstraint(level, type));
+      }
+    }
+  }
 }
--- a/OrthancServer/Sources/Database/MainDicomTagsRegistry.h	Mon Jul 08 19:03:23 2024 +0200
+++ b/OrthancServer/Sources/Database/MainDicomTagsRegistry.h	Tue Jul 09 09:03:40 2024 +0200
@@ -23,7 +23,7 @@
 
 #pragma once
 
-#include "../Search/DicomTagConstraint.h"
+#include "../Search/DatabaseLookup.h"
 
 #include <boost/noncopyable.hpp>
 
@@ -74,5 +74,9 @@
     void LookupTag(ResourceType& level,
                    DicomTagType& type,
                    const DicomTag& tag) const;
+
+    void NormalizeLookup(std::vector<DatabaseConstraint>& target,
+                         const DatabaseLookup& source,
+                         ResourceType queryLevel) const;
   };
 }
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Mon Jul 08 19:03:23 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Tue Jul 09 09:03:40 2024 +0200
@@ -364,38 +364,6 @@
   }
 
 
-  void StatelessDatabaseOperations::NormalizeLookup(std::vector<DatabaseConstraint>& target,
-                                                    const DatabaseLookup& source,
-                                                    ResourceType queryLevel) const
-  {
-    assert(mainDicomTagsRegistry_.get() != NULL);
-
-    target.clear();
-    target.reserve(source.GetConstraintsCount());
-
-    for (size_t i = 0; i < source.GetConstraintsCount(); i++)
-    {
-      ResourceType level;
-      DicomTagType type;
-      
-      mainDicomTagsRegistry_->LookupTag(level, type, source.GetConstraint(i).GetTag());
-
-      if (type == DicomTagType_Identifier ||
-          type == DicomTagType_Main)
-      {
-        // Use the fact that patient-level tags are copied at the study level
-        if (level == ResourceType_Patient &&
-            queryLevel != ResourceType_Patient)
-        {
-          level = ResourceType_Study;
-        }
-        
-        target.push_back(source.GetConstraint(i).ConvertToDatabaseConstraint(level, type));
-      }
-    }
-  }
-
-
   class StatelessDatabaseOperations::Transaction : public boost::noncopyable
   {
   private:
@@ -1929,7 +1897,9 @@
     }
 
     std::vector<DatabaseConstraint> normalized;
-    NormalizeLookup(normalized, lookup, queryLevel);
+
+    assert(mainDicomTagsRegistry_.get() != NULL);
+    mainDicomTagsRegistry_->NormalizeLookup(normalized, lookup, queryLevel);
 
     Operations operations;
     operations.Apply(*this, (instancesId != NULL), normalized, queryLevel, labels, labelsConstraint, limit);
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Mon Jul 08 19:03:23 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Tue Jul 09 09:03:40 2024 +0200
@@ -588,10 +588,6 @@
     std::unique_ptr<ITransactionContextFactory>  factory_;
     unsigned int                                 maxRetries_;
 
-    void NormalizeLookup(std::vector<DatabaseConstraint>& target,
-                         const DatabaseLookup& source,
-                         ResourceType level) const;
-
     void ApplyInternal(IReadOnlyOperations* readOperations,
                        IReadWriteOperations* writeOperations);