Mercurial > hg > orthanc
changeset 812:8a36c947490c
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 08 May 2014 14:51:49 +0200 |
parents | 78b9f64b6b7b |
children | b640aeee11ba |
files | OrthancServer/DicomProtocol/RemoteModalityParameters.cpp OrthancServer/DicomProtocol/RemoteModalityParameters.h OrthancServer/OrthancInitialization.cpp OrthancServer/OrthancInitialization.h OrthancServer/OrthancPeerParameters.h OrthancServer/OrthancRestApi/OrthancRestModalities.cpp |
diffstat | 6 files changed, 14 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/RemoteModalityParameters.cpp Wed May 07 16:58:22 2014 +0200 +++ b/OrthancServer/DicomProtocol/RemoteModalityParameters.cpp Thu May 08 14:51:49 2014 +0200 @@ -41,7 +41,6 @@ { RemoteModalityParameters::RemoteModalityParameters() { - name_ = ""; aet_ = "ORTHANC"; host_ = "localhost"; port_ = 104;
--- a/OrthancServer/DicomProtocol/RemoteModalityParameters.h Wed May 07 16:58:22 2014 +0200 +++ b/OrthancServer/DicomProtocol/RemoteModalityParameters.h Thu May 08 14:51:49 2014 +0200 @@ -44,7 +44,6 @@ // TODO Use the flyweight pattern for this class private: - std::string name_; std::string aet_; std::string host_; int port_; @@ -53,16 +52,6 @@ public: RemoteModalityParameters(); - const std::string& GetName() const - { - return name_; - } - - void SetName(const std::string& name) - { - name_ = name; - } - const std::string& GetApplicationEntityTitle() const { return aet_;
--- a/OrthancServer/OrthancInitialization.cpp Wed May 07 16:58:22 2014 +0200 +++ b/OrthancServer/OrthancInitialization.cpp Thu May 08 14:51:49 2014 +0200 @@ -525,7 +525,8 @@ } - void Configuration::UpdateModality(const RemoteModalityParameters& modality) + void Configuration::UpdateModality(const std::string& symbolicName, + const RemoteModalityParameters& modality) { boost::mutex::scoped_lock lock(globalMutex_); @@ -540,11 +541,11 @@ throw OrthancException(ErrorCode_BadFileFormat); } - modalities.removeMember(modality.GetName().c_str()); + modalities.removeMember(symbolicName); Json::Value v; modality.ToJson(v); - modalities[modality.GetName()] = v; + modalities[symbolicName] = v; } @@ -567,7 +568,8 @@ } - void Configuration::UpdatePeer(const OrthancPeerParameters& peer) + void Configuration::UpdatePeer(const std::string& symbolicName, + const OrthancPeerParameters& peer) { boost::mutex::scoped_lock lock(globalMutex_); @@ -582,11 +584,11 @@ throw OrthancException(ErrorCode_BadFileFormat); } - peers.removeMember(peer.GetName().c_str()); + peers.removeMember(symbolicName); Json::Value v; peer.ToJson(v); - peers[peer.GetName()] = v; + peers[symbolicName] = v; }
--- a/OrthancServer/OrthancInitialization.h Wed May 07 16:58:22 2014 +0200 +++ b/OrthancServer/OrthancInitialization.h Thu May 08 14:51:49 2014 +0200 @@ -91,11 +91,13 @@ static RemoteModalityParameters GetModalityUsingAet(const std::string& aet); - static void UpdateModality(const RemoteModalityParameters& modality); + static void UpdateModality(const std::string& symbolicName, + const RemoteModalityParameters& modality); static void RemoveModality(const std::string& symbolicName); - static void UpdatePeer(const OrthancPeerParameters& peer); + static void UpdatePeer(const std::string& symbolicName, + const OrthancPeerParameters& peer); static void RemovePeer(const std::string& symbolicName); };
--- a/OrthancServer/OrthancPeerParameters.h Wed May 07 16:58:22 2014 +0200 +++ b/OrthancServer/OrthancPeerParameters.h Thu May 08 14:51:49 2014 +0200 @@ -40,7 +40,6 @@ class OrthancPeerParameters { private: - std::string name_; std::string url_; std::string username_; std::string password_; @@ -48,16 +47,6 @@ public: OrthancPeerParameters(); - const std::string& GetName() const - { - return name_; - } - - void SetName(const std::string& name) - { - name_ = name; - } - const std::string& GetUrl() const { return url_;
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Wed May 07 16:58:22 2014 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Thu May 08 14:51:49 2014 +0200 @@ -472,8 +472,7 @@ { RemoteModalityParameters modality; modality.FromJson(json); - modality.SetName(call.GetUriComponent("id", "")); - Configuration::UpdateModality(modality); + Configuration::UpdateModality(call.GetUriComponent("id", ""), modality); } } @@ -492,8 +491,7 @@ { OrthancPeerParameters peer; peer.FromJson(json); - peer.SetName(call.GetUriComponent("id", "")); - Configuration::UpdatePeer(peer); + Configuration::UpdatePeer(call.GetUriComponent("id", ""), peer); } }