diff OrthancServer/Sources/Database/FindResponse.h @ 5748:4bc650d88463 find-refactoring

WIP: started to implement IntegratedFind in SQLite
author Alain Mazy <am@orthanc.team>
date Fri, 30 Aug 2024 18:03:37 +0200
parents 708952bd869c
children 093a8693ba16
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/FindResponse.h	Mon Sep 02 17:17:22 2024 +0200
+++ b/OrthancServer/Sources/Database/FindResponse.h	Fri Aug 30 18:03:37 2024 +0200
@@ -280,10 +280,12 @@
     };
 
   private:
-    typedef std::map<std::string, Resource*>  Index;
+    typedef std::map<std::string, Resource*>  IdentifierIndex;
+    typedef std::map<int64_t, Resource*>      InternalIdIndex;
 
     std::deque<Resource*>  items_;
-    Index                  index_;
+    IdentifierIndex        identifierIndex_;
+    InternalIdIndex        internalIdIndex_;
 
   public:
     ~FindResponse();
@@ -299,14 +301,26 @@
 
     Resource& GetResourceByIdentifier(const std::string& id);
 
+    Resource& GetResourceByInternalId(int64_t internalId);
+
     const Resource& GetResourceByIdentifier(const std::string& id) const
     {
       return const_cast<FindResponse&>(*this).GetResourceByIdentifier(id);
     }
 
+    const Resource& GetResourceByInternalId(int64_t internalId) const
+    {
+      return const_cast<FindResponse&>(*this).GetResourceByInternalId(internalId);
+    }
+
     bool HasResource(const std::string& id) const
     {
-      return (index_.find(id) != index_.end());
+      return (identifierIndex_.find(id) != identifierIndex_.end());
+    }
+
+    bool HasResource(int64_t& internalId) const
+    {
+      return (internalIdIndex_.find(internalId) != internalIdIndex_.end());
     }
   };
 }