changeset 188:090cefdab1d1

fix because of Windows macros
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 12 Nov 2012 17:43:12 +0100
parents 8e673a65564d
children ccbc2cf64a0d
files OrthancServer/DatabaseWrapper.cpp OrthancServer/DatabaseWrapper.h OrthancServer/ServerIndex.cpp UnitTests/ServerIndex.cpp
diffstat 4 files changed, 43 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp	Mon Nov 12 17:29:11 2012 +0100
+++ b/OrthancServer/DatabaseWrapper.cpp	Mon Nov 12 17:43:12 2012 +0100
@@ -139,8 +139,8 @@
     s.Run();
   }
 
-  bool DatabaseWrapper::FindGlobalProperty(std::string& target,
-                                           const std::string& name)
+  bool DatabaseWrapper::LookupGlobalProperty(std::string& target,
+                                             const std::string& name)
   {
     SQLite::Statement s(db_, SQLITE_FROM_HERE, 
                         "SELECT value FROM GlobalProperties WHERE name=?");
@@ -161,7 +161,7 @@
                                                  const std::string& defaultValue)
   {
     std::string s;
-    if (FindGlobalProperty(s, name))
+    if (LookupGlobalProperty(s, name))
     {
       return s;
     }
@@ -181,9 +181,9 @@
     return db_.GetLastInsertRowId();
   }
 
-  bool DatabaseWrapper::FindResource(const std::string& publicId,
-                                     int64_t& id,
-                                     ResourceType& type)
+  bool DatabaseWrapper::LookupResource(const std::string& publicId,
+                                       int64_t& id,
+                                       ResourceType& type)
   {
     SQLite::Statement s(db_, SQLITE_FROM_HERE, 
                         "SELECT internalId, resourceType FROM Resources WHERE publicId=?");
@@ -240,9 +240,9 @@
     s.Run();
   }
 
-  bool DatabaseWrapper::FindMetadata(std::string& target,
-                                     int64_t id,
-                                     MetadataType type)
+  bool DatabaseWrapper::LookupMetadata(std::string& target,
+                                       int64_t id,
+                                       MetadataType type)
   {
     SQLite::Statement s(db_, SQLITE_FROM_HERE, 
                         "SELECT value FROM Metadata WHERE id=? AND type=?");
@@ -265,7 +265,7 @@
                                            const std::string& defaultValue)
   {
     std::string s;
-    if (FindMetadata(s, id, type))
+    if (LookupMetadata(s, id, type))
     {
       return s;
     }
@@ -292,12 +292,12 @@
     s.Run();
   }
 
-  bool DatabaseWrapper::FindFile(int64_t id,
-                                 const std::string& name,
-                                 std::string& fileUuid,
-                                 uint64_t& compressedSize,
-                                 uint64_t& uncompressedSize,
-                                 CompressionType& compressionType)
+  bool DatabaseWrapper::LookupFile(int64_t id,
+                                   const std::string& name,
+                                   std::string& fileUuid,
+                                   uint64_t& compressedSize,
+                                   uint64_t& uncompressedSize,
+                                   CompressionType& compressionType)
   {
     SQLite::Statement s(db_, SQLITE_FROM_HERE, 
                         "SELECT uuid, compressedSize, uncompressedSize, compressionType FROM AttachedFiles WHERE id=? AND name=?");
--- a/OrthancServer/DatabaseWrapper.h	Mon Nov 12 17:29:11 2012 +0100
+++ b/OrthancServer/DatabaseWrapper.h	Mon Nov 12 17:43:12 2012 +0100
@@ -65,8 +65,8 @@
     void SetGlobalProperty(const std::string& name,
                            const std::string& value);
 
-    bool FindGlobalProperty(std::string& target,
-                            const std::string& name);
+    bool LookupGlobalProperty(std::string& target,
+                              const std::string& name);
 
     std::string GetGlobalProperty(const std::string& name,
                                   const std::string& defaultValue = "");
@@ -74,9 +74,9 @@
     int64_t CreateResource(const std::string& publicId,
                            ResourceType type);
 
-    bool FindResource(const std::string& publicId,
-                      int64_t& id,
-                      ResourceType& type);
+    bool LookupResource(const std::string& publicId,
+                        int64_t& id,
+                        ResourceType& type);
 
     void AttachChild(int64_t parent,
                      int64_t child);
@@ -87,9 +87,9 @@
                      MetadataType type,
                      const std::string& value);
 
-    bool FindMetadata(std::string& target,
-                      int64_t id,
-                      MetadataType type);
+    bool LookupMetadata(std::string& target,
+                        int64_t id,
+                        MetadataType type);
 
     std::string GetMetadata(int64_t id,
                             MetadataType type,
@@ -110,12 +110,12 @@
       AttachFile(id, name, fileUuid, fileSize, fileSize, CompressionType_None);
     }
 
-    bool FindFile(int64_t id,
-                  const std::string& name,
-                  std::string& fileUuid,
-                  uint64_t& compressedSize,
-                  uint64_t& uncompressedSize,
-                  CompressionType& compressionType);
+    bool LookupFile(int64_t id,
+                    const std::string& name,
+                    std::string& fileUuid,
+                    uint64_t& compressedSize,
+                    uint64_t& uncompressedSize,
+                    CompressionType& compressionType);
 
     void SetMainDicomTags(int64_t id,
                           const DicomMap& tags);
--- a/OrthancServer/ServerIndex.cpp	Mon Nov 12 17:29:11 2012 +0100
+++ b/OrthancServer/ServerIndex.cpp	Mon Nov 12 17:43:12 2012 +0100
@@ -531,29 +531,29 @@
       bool isNewSeries = false;
 
       // Do nothing if the instance already exists
-      if (db2_->FindResource(hasher.HashInstance(), patient, type))
+      if (db2_->LookupResource(hasher.HashInstance(), patient, type))
       {
-        assert(type == ResourceType_Patient);
+        assert(type == ResourceType_Instance);
         return StoreStatus_AlreadyStored;
       }
 
       // Create the patient/study/series/instance hierarchy
       instance = db2_->CreateResource(hasher.HashInstance(), ResourceType_Instance);
 
-      if (!db2_->FindResource(hasher.HashSeries(), series, type))
+      if (!db2_->LookupResource(hasher.HashSeries(), series, type))
       {
         // This is a new series
         isNewSeries = true;
         series = db2_->CreateResource(hasher.HashSeries(), ResourceType_Series);
         db2_->AttachChild(series, instance);
 
-        if (!db2_->FindResource(hasher.HashStudy(), study, type))
+        if (!db2_->LookupResource(hasher.HashStudy(), study, type))
         {
           // This is a new study
           study = db2_->CreateResource(hasher.HashStudy(), ResourceType_Study);
           db2_->AttachChild(study, series);
 
-          if (!db2_->FindResource(hasher.HashPatient(), patient, type))
+          if (!db2_->LookupResource(hasher.HashPatient(), patient, type))
           {
             // This is a new patient
             patient = db2_->CreateResource(hasher.HashPatient(), ResourceType_Patient);
--- a/UnitTests/ServerIndex.cpp	Mon Nov 12 17:29:11 2012 +0100
+++ b/UnitTests/ServerIndex.cpp	Mon Nov 12 17:43:12 2012 +0100
@@ -105,31 +105,31 @@
 
   int64_t b;
   ResourceType t;
-  ASSERT_TRUE(index.FindResource("g", b, t));
+  ASSERT_TRUE(index.LookupResource("g", b, t));
   ASSERT_EQ(7, b);
   ASSERT_EQ(ResourceType_Study, t);
 
-  ASSERT_TRUE(index.FindMetadata(s, a[4], MetadataType_Instance_RemoteAet));
-  ASSERT_FALSE(index.FindMetadata(s, a[4], MetadataType_Instance_IndexInSeries));
+  ASSERT_TRUE(index.LookupMetadata(s, a[4], MetadataType_Instance_RemoteAet));
+  ASSERT_FALSE(index.LookupMetadata(s, a[4], MetadataType_Instance_IndexInSeries));
   ASSERT_EQ("PINNACLE", s);
   ASSERT_EQ("PINNACLE", index.GetMetadata(a[4], MetadataType_Instance_RemoteAet));
   ASSERT_EQ("None", index.GetMetadata(a[4], MetadataType_Instance_IndexInSeries, "None"));
 
-  ASSERT_TRUE(index.FindGlobalProperty(s, "Hello"));
-  ASSERT_FALSE(index.FindGlobalProperty(s, "Hello2"));
+  ASSERT_TRUE(index.LookupGlobalProperty(s, "Hello"));
+  ASSERT_FALSE(index.LookupGlobalProperty(s, "Hello2"));
   ASSERT_EQ("World", s);
   ASSERT_EQ("World", index.GetGlobalProperty("Hello"));
   ASSERT_EQ("None", index.GetGlobalProperty("Hello2", "None"));
 
-  size_t us, cs;
+  uint64_t us, cs;
   CompressionType ct;
-  ASSERT_TRUE(index.FindFile(a[4], "_json", s, cs, us, ct));
+  ASSERT_TRUE(index.LookupFile(a[4], "_json", s, cs, us, ct));
   ASSERT_EQ("my json file", s);
   ASSERT_EQ(21, cs);
   ASSERT_EQ(42, us);
   ASSERT_EQ(CompressionType_Zlib, ct);
 
-  ASSERT_EQ(0, listener.deletedFiles_.size());
+  ASSERT_EQ(0u, listener.deletedFiles_.size());
   ASSERT_EQ(7, index.GetTableRecordCount("Resources"));
   ASSERT_EQ(3, index.GetTableRecordCount("AttachedFiles"));
   ASSERT_EQ(1, index.GetTableRecordCount("Metadata"));