# HG changeset patch # User Sebastien Jodogne # Date 1396362581 -7200 # Node ID 9076a986c451edea3622963e17dc6d8f5ef9c9f1 # Parent ec69658b031bf538bdb2475f6b68009c75586e1c code clarification diff -r ec69658b031b -r 9076a986c451 OrthancServer/OrthancRestApi.cpp --- 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(call.GetContext()); \ - ServerContext& context = contextApi.GetContext() + ServerContext& context = that.GetContext() -#define RETRIEVE_MODALITIES(call) \ - const OrthancRestApi::SetOfStrings& modalities = \ - dynamic_cast(call.GetContext()).GetModalities(); - -#define RETRIEVE_PEERS(call) \ - const OrthancRestApi::SetOfStrings& peers = \ - dynamic_cast(call.GetContext()).GetPeers(); - +#define RETRIEVE_THAT(call) \ + OrthancRestApi& that = \ + dynamic_cast(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");