Mercurial > hg > orthanc
changeset 617:a24b0161b171 find-move-scp
lookup using aet
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Oct 2013 11:28:02 +0200 |
parents | dbecea588ef5 |
children | 5ab377df6d8b |
files | OrthancServer/OrthancInitialization.cpp OrthancServer/OrthancInitialization.h |
diffstat | 2 files changed, 48 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp Fri Oct 25 11:06:10 2013 +0200 +++ b/OrthancServer/OrthancInitialization.cpp Fri Oct 25 11:28:02 2013 +0200 @@ -227,11 +227,11 @@ - void GetDicomModality(const std::string& name, - std::string& aet, - std::string& address, - int& port, - ModalityManufacturer& manufacturer) + void GetDicomModalityUsingSymbolicName(const std::string& name, + std::string& aet, + std::string& address, + int& port, + ModalityManufacturer& manufacturer) { boost::mutex::scoped_lock lock(globalMutex_); @@ -472,7 +472,7 @@ std::string aet, address; int port; ModalityManufacturer manufacturer; - GetDicomModality(name, aet, address, port, manufacturer); + GetDicomModalityUsingSymbolicName(name, aet, address, port, manufacturer); LOG(WARNING) << "Connecting to remote DICOM modality: AET=" << aet << ", address=" << address << ", port=" << port; @@ -485,29 +485,26 @@ } - void ConnectToModalityUsingAETitle(DicomUserConnection& connection, - const std::string& aet) + bool LookupDicomModalityUsingAETitle(const std::string& aet, + std::string& symbolicName, + std::string& address, + int& port, + ModalityManufacturer& manufacturer) { std::set<std::string> modalities; GetListOfDicomModalities(modalities); - std::string address; - int port; - ModalityManufacturer manufacturer; - bool found = false; - for (std::set<std::string>::const_iterator it = modalities.begin(); it != modalities.end(); it++) { try { std::string thisAet; - GetDicomModality(*it, thisAet, address, port, manufacturer); + GetDicomModalityUsingSymbolicName(*it, thisAet, address, port, manufacturer); if (aet == thisAet) { - found = true; - break; + return true; } } catch (OrthancException&) @@ -515,7 +512,28 @@ } } - if (!found) + return false; + } + + + bool IsKnownAETitle(const std::string& aet) + { + std::string symbolicName, address; + int port; + ModalityManufacturer manufacturer; + + return LookupDicomModalityUsingAETitle(aet, symbolicName, address, port, manufacturer); + } + + + void ConnectToModalityUsingAETitle(DicomUserConnection& connection, + const std::string& aet) + { + std::string symbolicName, address; + int port; + ModalityManufacturer manufacturer; + + if (!LookupDicomModalityUsingAETitle(aet, symbolicName, address, port, manufacturer)) { throw OrthancException("Unknown modality: " + aet); }
--- a/OrthancServer/OrthancInitialization.h Fri Oct 25 11:06:10 2013 +0200 +++ b/OrthancServer/OrthancInitialization.h Fri Oct 25 11:28:02 2013 +0200 @@ -55,11 +55,17 @@ bool GetGlobalBoolParameter(const std::string& parameter, bool defaultValue); - void GetDicomModality(const std::string& name, - std::string& aet, - std::string& address, - int& port, - ModalityManufacturer& manufacturer); + void GetDicomModalityUsingSymbolicName(const std::string& name, + std::string& aet, + std::string& address, + int& port, + ModalityManufacturer& manufacturer); + + bool LookupDicomModalityUsingAETitle(const std::string& aet, + std::string& symbolicName, + std::string& address, + int& port, + ModalityManufacturer& manufacturer); void GetOrthancPeer(const std::string& name, std::string& url, @@ -85,4 +91,6 @@ void ConnectToModalityUsingAETitle(DicomUserConnection& connection, const std::string& aet); + + bool IsKnownAETitle(const std::string& aet); }