diff OrthancServer/ServerIndex.cpp @ 1294:910478b2d4e4

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Feb 2015 13:48:05 +0100
parents 6e7e5ed91c2d
children 501432928727
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp	Thu Feb 05 14:58:42 2015 +0100
+++ b/OrthancServer/ServerIndex.cpp	Fri Feb 06 13:48:05 2015 +0100
@@ -306,7 +306,7 @@
 
     int64_t id;
     ResourceType type;
-    if (!db_.LookupResource(uuid, id, type) ||
+    if (!db_.LookupResource(id, type, uuid) ||
         expectedType != type)
     {
       return false;
@@ -541,7 +541,7 @@
       {
         ResourceType type;
         int64_t tmp;
-        if (db_.LookupResource(hasher.HashInstance(), tmp, type))
+        if (db_.LookupResource(tmp, type, hasher.HashInstance()))
         {
           assert(type == ResourceType_Instance);
           db_.GetAllMetadata(instanceMetadata, tmp);
@@ -576,26 +576,26 @@
       {
         ResourceType dummy;
 
-        if (db_.LookupResource(hasher.HashSeries(), series, dummy))
+        if (db_.LookupResource(series, dummy, hasher.HashSeries()))
         {
           assert(dummy == ResourceType_Series);
           // The patient, the study and the series already exist
 
-          bool ok = (db_.LookupResource(hasher.HashPatient(), patient, dummy) &&
-                     db_.LookupResource(hasher.HashStudy(), study, dummy));
+          bool ok = (db_.LookupResource(patient, dummy, hasher.HashPatient()) &&
+                     db_.LookupResource(study, dummy, hasher.HashStudy()));
           assert(ok);
         }
-        else if (db_.LookupResource(hasher.HashStudy(), study, dummy))
+        else if (db_.LookupResource(study, dummy, hasher.HashStudy()))
         {
           assert(dummy == ResourceType_Study);
 
           // New series: The patient and the study already exist
           isNewSeries = true;
 
-          bool ok = db_.LookupResource(hasher.HashPatient(), patient, dummy);
+          bool ok = db_.LookupResource(patient, dummy, hasher.HashPatient());
           assert(ok);
         }
-        else if (db_.LookupResource(hasher.HashPatient(), patient, dummy))
+        else if (db_.LookupResource(patient, dummy, hasher.HashPatient()))
         {
           assert(dummy == ResourceType_Patient);
 
@@ -834,7 +834,7 @@
     // Lookup for the requested resource
     int64_t id;
     ResourceType type;
-    if (!db_.LookupResource(publicId, id, type) ||
+    if (!db_.LookupResource(id, type, publicId) ||
         type != expectedType)
     {
       return false;
@@ -994,7 +994,7 @@
 
     int64_t id;
     ResourceType type;
-    if (!db_.LookupResource(instanceUuid, id, type))
+    if (!db_.LookupResource(id, type, instanceUuid))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1092,7 +1092,7 @@
 
     int64_t id;
     ResourceType type;
-    if (!db_.LookupResource(publicId, id, type))
+    if (!db_.LookupResource(id, type, publicId))
     {
       throw OrthancException(ErrorCode_InternalError);
     }
@@ -1228,7 +1228,7 @@
     // already stored
     int64_t patientToAvoid;
     ResourceType type;
-    bool hasPatientToAvoid = db_.LookupResource(newPatientId, patientToAvoid, type);
+    bool hasPatientToAvoid = db_.LookupResource(patientToAvoid, type, newPatientId);
 
     if (hasPatientToAvoid && type != ResourceType_Patient)
     {
@@ -1312,7 +1312,7 @@
     // Lookup for the requested resource
     int64_t id;
     ResourceType type;
-    if (!db_.LookupResource(publicId, id, type) ||
+    if (!db_.LookupResource(id, type, publicId) ||
         type != ResourceType_Patient)
     {
       throw OrthancException(ErrorCode_ParameterOutOfRange);
@@ -1330,7 +1330,7 @@
     // Lookup for the requested resource
     int64_t id;
     ResourceType type;
-    if (!db_.LookupResource(publicId, id, type) ||
+    if (!db_.LookupResource(id, type, publicId) ||
         type != ResourceType_Patient)
     {
       throw OrthancException(ErrorCode_ParameterOutOfRange);
@@ -1355,7 +1355,7 @@
 
     ResourceType type;
     int64_t resource;
-    if (!db_.LookupResource(publicId, resource, type))
+    if (!db_.LookupResource(resource, type, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1386,7 +1386,7 @@
 
     ResourceType type;
     int64_t top;
-    if (!db_.LookupResource(publicId, top, type))
+    if (!db_.LookupResource(top, type, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1435,7 +1435,7 @@
 
     ResourceType rtype;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, rtype))
+    if (!db_.LookupResource(id, rtype, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1451,7 +1451,7 @@
 
     ResourceType rtype;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, rtype))
+    if (!db_.LookupResource(id, rtype, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1468,7 +1468,7 @@
 
     ResourceType rtype;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, rtype))
+    if (!db_.LookupResource(id, rtype, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1484,7 +1484,7 @@
 
     ResourceType rtype;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, rtype))
+    if (!db_.LookupResource(id, rtype, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1501,7 +1501,7 @@
 
     ResourceType type;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, type) ||
+    if (!db_.LookupResource(id, type, publicId) ||
         expectedType != type)
     {
       throw OrthancException(ErrorCode_UnknownResource);
@@ -1518,7 +1518,7 @@
 
     ResourceType type;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, type))
+    if (!db_.LookupResource(id, type, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1560,7 +1560,7 @@
 
     int64_t id;
     ResourceType type;
-    if (!db_.LookupResource(publicId, id, type))
+    if (!db_.LookupResource(id, type, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1674,7 +1674,7 @@
 
     ResourceType type;
     int64_t top;
-    if (!db_.LookupResource(publicId, top, type))
+    if (!db_.LookupResource(top, type, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1723,7 +1723,7 @@
 
     ResourceType type;
     int64_t top;
-    if (!db_.LookupResource(publicId, top, type))
+    if (!db_.LookupResource(top, type, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1878,7 +1878,7 @@
 
     ResourceType resourceType;
     int64_t resourceId;
-    if (!db_.LookupResource(publicId, resourceId, resourceType))
+    if (!db_.LookupResource(resourceId, resourceType, publicId))
     {
       return StoreStatus_Failure;  // Inexistent resource
     }
@@ -1924,7 +1924,7 @@
 
     ResourceType rtype;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, rtype))
+    if (!db_.LookupResource(id, rtype, publicId))
     {
       throw OrthancException(ErrorCode_UnknownResource);
     }
@@ -1944,7 +1944,7 @@
 
     ResourceType type;
     int64_t id;
-    if (!db_.LookupResource(publicId, id, type))
+    if (!db_.LookupResource(id, type, publicId))
     {
       return false;
     }