changeset 2587:bf14b037731f jobs

new constructor for DicomUserConnection
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 14 May 2018 21:44:41 +0200
parents ec09641d6f41
children a3fdfb6979ed
files Core/DicomNetworking/DicomUserConnection.cpp Core/DicomNetworking/DicomUserConnection.h OrthancServer/OrthancRestApi/OrthancRestModalities.cpp
diffstat 3 files changed, 32 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomUserConnection.cpp	Mon May 14 21:33:57 2018 +0200
+++ b/Core/DicomNetworking/DicomUserConnection.cpp	Mon May 14 21:44:41 2018 +0200
@@ -795,13 +795,12 @@
   }
 
 
-  DicomUserConnection::DicomUserConnection() : 
-    pimpl_(new PImpl),
-    preferredTransferSyntax_(DEFAULT_PREFERRED_TRANSFER_SYNTAX),
-    localAet_("STORESCU"),
-    remoteAet_("ANY-SCP"),
-    remoteHost_("127.0.0.1")
+  void DicomUserConnection::DefaultSetup()
   {
+    preferredTransferSyntax_ = DEFAULT_PREFERRED_TRANSFER_SYNTAX;
+    localAet_ = "STORESCU";
+    remoteAet_ = "ANY-SCP";
+    remoteHost_ = "127.0.0.1";
     remotePort_ = 104;
     manufacturer_ = ModalityManufacturer_Generic;
 
@@ -819,6 +818,24 @@
 
     ResetStorageSOPClasses();
   }
+   
+
+  DicomUserConnection::DicomUserConnection() : 
+    pimpl_(new PImpl)
+  {
+    DefaultSetup();
+  }
+  
+
+  DicomUserConnection::DicomUserConnection(const std::string& localAet,
+                                           const RemoteModalityParameters& remote) : 
+    pimpl_(new PImpl)
+  {
+    DefaultSetup();
+    SetLocalApplicationEntityTitle(localAet);
+    SetRemoteModality(remote);
+  }
+
 
   DicomUserConnection::~DicomUserConnection()
   {
--- a/Core/DicomNetworking/DicomUserConnection.h	Mon May 14 21:33:57 2018 +0200
+++ b/Core/DicomNetworking/DicomUserConnection.h	Mon May 14 21:44:41 2018 +0200
@@ -77,11 +77,18 @@
 
     void CheckStorageSOPClassesInvariant() const;
 
+    void DefaultSetup();
+
   public:
     DicomUserConnection();
 
     ~DicomUserConnection();
 
+    // This constructor corresponds to behavior of the old class
+    // "ReusableDicomUserConnection", without the call to "Open()"
+    DicomUserConnection(const std::string& localAet,
+                        const RemoteModalityParameters& remote);
+
     void SetRemoteModality(const RemoteModalityParameters& parameters);
 
     void SetLocalApplicationEntityTitle(const std::string& aet);
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon May 14 21:33:57 2018 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon May 14 21:44:41 2018 +0200
@@ -89,7 +89,7 @@
         connection_->Store(dicom);
       }
 
-      boost::this_thread::sleep(boost::posix_time::milliseconds(500));
+      //boost::this_thread::sleep(boost::posix_time::milliseconds(500));
 
       return true;
     }
@@ -221,7 +221,7 @@
   protected:
     virtual bool HandleInstance(const std::string& instance)
     {
-      boost::this_thread::sleep(boost::posix_time::milliseconds(500));
+      //boost::this_thread::sleep(boost::posix_time::milliseconds(500));
 
       if (client_.get() == NULL)
       {