# HG changeset patch # User Sebastien Jodogne # Date 1398873181 -7200 # Node ID be87dd517416691dd890c82a743fce862149312b # Parent 4e3593c3511d598d876ca3968dadaa20326aefce rename diff -r 4e3593c3511d -r be87dd517416 OrthancServer/DicomProtocol/ReusableDicomUserConnection.cpp --- a/OrthancServer/DicomProtocol/ReusableDicomUserConnection.cpp Wed Apr 30 15:17:10 2014 +0200 +++ b/OrthancServer/DicomProtocol/ReusableDicomUserConnection.cpp Wed Apr 30 17:53:01 2014 +0200 @@ -102,21 +102,21 @@ } } - ReusableDicomUserConnection::Connection::Connection(ReusableDicomUserConnection& that, - const std::string& aet, - const std::string& address, - int port, - ModalityManufacturer manufacturer) : - Locker(that) + ReusableDicomUserConnection::Locker::Locker(ReusableDicomUserConnection& that, + const std::string& aet, + const std::string& address, + int port, + ModalityManufacturer manufacturer) : + ::Orthanc::Locker(that) { that.Open(aet, address, port, manufacturer); connection_ = that.connection_; } - ReusableDicomUserConnection::Connection::Connection(ReusableDicomUserConnection& that, - const RemoteModalityParameters& remote) : - Locker(that) + ReusableDicomUserConnection::Locker::Locker(ReusableDicomUserConnection& that, + const RemoteModalityParameters& remote) : + ::Orthanc::Locker(that) { that.Open(remote.GetApplicationEntityTitle(), remote.GetHost(), remote.GetPort(), remote.GetManufacturer()); @@ -124,7 +124,7 @@ } - DicomUserConnection& ReusableDicomUserConnection::Connection::GetConnection() + DicomUserConnection& ReusableDicomUserConnection::Locker::GetConnection() { if (connection_ == NULL) { diff -r 4e3593c3511d -r be87dd517416 OrthancServer/DicomProtocol/ReusableDicomUserConnection.h --- a/OrthancServer/DicomProtocol/ReusableDicomUserConnection.h Wed Apr 30 15:17:10 2014 +0200 +++ b/OrthancServer/DicomProtocol/ReusableDicomUserConnection.h Wed Apr 30 17:53:01 2014 +0200 @@ -66,20 +66,20 @@ virtual void Unlock(); public: - class Connection : public Locker + class Locker : public ::Orthanc::Locker { private: DicomUserConnection* connection_; public: - Connection(ReusableDicomUserConnection& that, - const RemoteModalityParameters& remote); + Locker(ReusableDicomUserConnection& that, + const RemoteModalityParameters& remote); - Connection(ReusableDicomUserConnection& that, - const std::string& aet, - const std::string& address, - int port, - ModalityManufacturer manufacturer); + Locker(ReusableDicomUserConnection& that, + const std::string& aet, + const std::string& address, + int port, + ModalityManufacturer manufacturer); DicomUserConnection& GetConnection(); }; diff -r 4e3593c3511d -r be87dd517416 OrthancServer/OrthancMoveRequestHandler.cpp --- a/OrthancServer/OrthancMoveRequestHandler.cpp Wed Apr 30 15:17:10 2014 +0200 +++ b/OrthancServer/OrthancMoveRequestHandler.cpp Wed Apr 30 17:53:01 2014 +0200 @@ -88,9 +88,9 @@ context_.ReadFile(dicom, id, FileContentType_Dicom); { - ReusableDicomUserConnection::Connection connection + ReusableDicomUserConnection::Locker locker (context_.GetReusableDicomUserConnection(), remote_); - connection.GetConnection().Store(dicom); + locker.GetConnection().Store(dicom); } return Status_Success; diff -r 4e3593c3511d -r be87dd517416 OrthancServer/OrthancRestApi/OrthancRestModalities.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Wed Apr 30 15:17:10 2014 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Wed Apr 30 17:53:01 2014 +0200 @@ -75,10 +75,10 @@ } RemoteModalityParameters remote = GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); - ReusableDicomUserConnection::Connection connection(context.GetReusableDicomUserConnection(), remote); + ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); DicomFindAnswers answers; - connection.GetConnection().FindPatient(answers, m); + locker.GetConnection().FindPatient(answers, m); Json::Value result; answers.ToJson(result); @@ -103,10 +103,10 @@ } RemoteModalityParameters remote = GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); - ReusableDicomUserConnection::Connection connection(context.GetReusableDicomUserConnection(), remote); + ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); DicomFindAnswers answers; - connection.GetConnection().FindStudy(answers, m); + locker.GetConnection().FindStudy(answers, m); Json::Value result; answers.ToJson(result); @@ -132,10 +132,10 @@ } RemoteModalityParameters remote = GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); - ReusableDicomUserConnection::Connection connection(context.GetReusableDicomUserConnection(), remote); + ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); DicomFindAnswers answers; - connection.GetConnection().FindSeries(answers, m); + locker.GetConnection().FindSeries(answers, m); Json::Value result; answers.ToJson(result); @@ -162,10 +162,10 @@ } RemoteModalityParameters remote = GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); - ReusableDicomUserConnection::Connection connection(context.GetReusableDicomUserConnection(), remote); + ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); DicomFindAnswers answers; - connection.GetConnection().FindInstance(answers, m); + locker.GetConnection().FindInstance(answers, m); Json::Value result; answers.ToJson(result); @@ -184,10 +184,10 @@ } RemoteModalityParameters remote = GetModalityUsingSymbolicName(call.GetUriComponent("id", "")); - ReusableDicomUserConnection::Connection connection(context.GetReusableDicomUserConnection(), remote); + ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), remote); DicomFindAnswers patients; - connection.GetConnection().FindPatient(patients, m); + locker.GetConnection().FindPatient(patients, m); // Loop over the found patients Json::Value result = Json::arrayValue; @@ -204,7 +204,7 @@ m.CopyTagIfExists(patients.GetAnswer(i), DICOM_TAG_PATIENT_ID); DicomFindAnswers studies; - connection.GetConnection().FindStudy(studies, m); + locker.GetConnection().FindStudy(studies, m); patient["Studies"] = Json::arrayValue; @@ -223,7 +223,7 @@ m.CopyTagIfExists(studies.GetAnswer(j), DICOM_TAG_STUDY_INSTANCE_UID); DicomFindAnswers series; - connection.GetConnection().FindSeries(series, m); + locker.GetConnection().FindSeries(series, m); // Loop over the found series study["Series"] = Json::arrayValue; @@ -319,7 +319,7 @@ } RemoteModalityParameters p = GetModalityUsingSymbolicName(remote); - ReusableDicomUserConnection::Connection connection(context.GetReusableDicomUserConnection(), p); + ReusableDicomUserConnection::Locker locker(context.GetReusableDicomUserConnection(), p); for (std::list::const_iterator it = instances.begin(); it != instances.end(); ++it) @@ -328,7 +328,7 @@ std::string dicom; context.ReadFile(dicom, *it, FileContentType_Dicom); - connection.GetConnection().Store(dicom); + locker.GetConnection().Store(dicom); } call.GetOutput().AnswerBuffer("{}", "application/json"); diff -r 4e3593c3511d -r be87dd517416 UnitTestsSources/MultiThreading.cpp --- a/UnitTestsSources/MultiThreading.cpp Wed Apr 30 15:17:10 2014 +0200 +++ b/UnitTestsSources/MultiThreading.cpp Wed Apr 30 17:53:01 2014 +0200 @@ -225,8 +225,8 @@ c.SetMillisecondsBeforeClose(200); printf("START\n"); fflush(stdout); { - ReusableDicomUserConnection::Connection cc(c, "STORESCP", "localhost", 2000, ModalityManufacturer_Generic); - cc.GetConnection().StoreFile("/home/jodogne/DICOM/Cardiac/MR.X.1.2.276.0.7230010.3.1.4.2831157719.2256.1336386844.676281"); + ReusableDicomUserConnection::Locker lock(c, "STORESCP", "localhost", 2000, ModalityManufacturer_Generic); + lock.GetConnection().StoreFile("/home/jodogne/DICOM/Cardiac/MR.X.1.2.276.0.7230010.3.1.4.2831157719.2256.1336386844.676281"); } printf("**\n"); fflush(stdout); @@ -234,8 +234,8 @@ printf("**\n"); fflush(stdout); { - ReusableDicomUserConnection::Connection cc(c, "STORESCP", "localhost", 2000, ModalityManufacturer_Generic); - cc.GetConnection().StoreFile("/home/jodogne/DICOM/Cardiac/MR.X.1.2.276.0.7230010.3.1.4.2831157719.2256.1336386844.676277"); + ReusableDicomUserConnection::Locker lock(c, "STORESCP", "localhost", 2000, ModalityManufacturer_Generic); + lock.GetConnection().StoreFile("/home/jodogne/DICOM/Cardiac/MR.X.1.2.276.0.7230010.3.1.4.2831157719.2256.1336386844.676277"); } Toolbox::ServerBarrier();