changeset 745:9076a986c451

code clarification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Apr 2014 16:29:41 +0200
parents ec69658b031b
children 478f4f9de9eb
files OrthancServer/OrthancRestApi.cpp
diffstat 1 files changed, 15 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp	Thu Mar 20 10:46:59 2014 +0100
+++ b/OrthancServer/OrthancRestApi.cpp	Tue Apr 01 16:29:41 2014 +0200
@@ -55,18 +55,13 @@
 
 
 #define RETRIEVE_CONTEXT(call)                          \
-  OrthancRestApi& contextApi =                          \
+  OrthancRestApi& that =                                \
     dynamic_cast<OrthancRestApi&>(call.GetContext());   \
-  ServerContext& context = contextApi.GetContext()
+  ServerContext& context = that.GetContext()
 
-#define RETRIEVE_MODALITIES(call)                                       \
-  const OrthancRestApi::SetOfStrings& modalities =                      \
-    dynamic_cast<OrthancRestApi&>(call.GetContext()).GetModalities();
-
-#define RETRIEVE_PEERS(call)                                            \
-  const OrthancRestApi::SetOfStrings& peers =                           \
-    dynamic_cast<OrthancRestApi&>(call.GetContext()).GetPeers();
-
+#define RETRIEVE_THAT(call)                             \
+  OrthancRestApi& that =                                \
+    dynamic_cast<OrthancRestApi&>(call.GetContext());
 
 
 namespace Orthanc
@@ -987,11 +982,12 @@
 
   static void ListModalities(RestApi::GetCall& call)
   {
-    RETRIEVE_MODALITIES(call);
+    RETRIEVE_THAT(call);
 
     Json::Value result = Json::arrayValue;
     for (OrthancRestApi::SetOfStrings::const_iterator 
-           it = modalities.begin(); it != modalities.end(); ++it)
+           it = that.GetModalities().begin(); 
+         it != that.GetModalities().end(); ++it)
     {
       result.append(*it);
     }
@@ -1002,10 +998,10 @@
 
   static void ListModalityOperations(RestApi::GetCall& call)
   {
-    RETRIEVE_MODALITIES(call);
+    RETRIEVE_THAT(call);
 
     std::string id = call.GetUriComponent("id", "");
-    if (IsExistingModality(modalities, id))
+    if (IsExistingModality(that.GetModalities(), id))
     {
       Json::Value result = Json::arrayValue;
       result.append("find-patient");
@@ -1759,11 +1755,12 @@
 
   static void ListPeers(RestApi::GetCall& call)
   {
-    RETRIEVE_PEERS(call);
+    RETRIEVE_THAT(call);
 
     Json::Value result = Json::arrayValue;
     for (OrthancRestApi::SetOfStrings::const_iterator 
-           it = peers.begin(); it != peers.end(); ++it)
+           it = that.GetPeers().begin(); 
+         it != that.GetPeers().end(); ++it)
     {
       result.append(*it);
     }
@@ -1773,10 +1770,10 @@
 
   static void ListPeerOperations(RestApi::GetCall& call)
   {
-    RETRIEVE_PEERS(call);
+    RETRIEVE_THAT(call);
 
     std::string id = call.GetUriComponent("id", "");
-    if (IsExistingPeer(peers, id))
+    if (IsExistingPeer(that.GetPeers(), id))
     {
       Json::Value result = Json::arrayValue;
       result.append("store");