diff OrthancServer/ServerIndex.h @ 1247:32fcc5dc7562

abstraction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Dec 2014 13:54:27 +0100
parents 6c07108ff1e2
children 40725595aaf0
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.h	Mon Dec 08 12:56:30 2014 +0100
+++ b/OrthancServer/ServerIndex.h	Mon Dec 08 13:54:27 2014 +0100
@@ -40,7 +40,7 @@
 #include "../Core/DicomFormat/DicomInstanceHasher.h"
 #include "ServerEnumerations.h"
 
-#include "DatabaseWrapper.h"
+#include "IDatabaseWrapper.h"
 
 
 namespace Orthanc
@@ -68,7 +68,7 @@
     boost::thread unstableResourcesMonitorThread_;
 
     std::auto_ptr<Internals::ServerIndexListener> listener_;
-    std::auto_ptr<DatabaseWrapper> db_;
+    IDatabaseWrapper& db_;
     LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload>  unstableResources_;
 
     uint64_t currentStorageSize_;
@@ -113,7 +113,7 @@
                    const std::string& publicId)
     {
       ServerIndexChange change(changeType, resourceType, publicId);
-      db_->LogChange(internalId, change);
+      db_.LogChange(internalId, change);
     }
 
     uint64_t IncrementGlobalSequenceInternal(GlobalProperty property);
@@ -121,7 +121,7 @@
 
   public:
     ServerIndex(ServerContext& context,
-                const std::string& dbPath);
+                IDatabaseWrapper& database);
 
     ~ServerIndex();
 
@@ -164,20 +164,20 @@
                         const std::string& uuid,
                         ResourceType expectedType);
 
-    bool GetChanges(Json::Value& target,
+    void GetChanges(Json::Value& target,
                     int64_t since,
                     unsigned int maxResults);
 
-    bool GetLastChange(Json::Value& target);
+    void GetLastChange(Json::Value& target);
 
     void LogExportedResource(const std::string& publicId,
                              const std::string& remoteModality);
 
-    bool GetExportedResources(Json::Value& target,
+    void GetExportedResources(Json::Value& target,
                               int64_t since,
                               unsigned int maxResults);
 
-    bool GetLastExportedResource(Json::Value& target);
+    void GetLastExportedResource(Json::Value& target);
 
     bool IsProtectedPatient(const std::string& publicId);