changeset 3735:77183afbf55e storage-commitment

simplification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Mar 2020 13:59:14 +0100
parents 4fc24b69446a
children 0540b54324f1
files OrthancServer/ServerJobs/DicomModalityStoreJob.cpp OrthancServer/ServerJobs/DicomModalityStoreJob.h
diffstat 2 files changed, 11 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/ServerJobs/DicomModalityStoreJob.cpp	Tue Mar 10 13:22:02 2020 +0100
+++ b/OrthancServer/ServerJobs/DicomModalityStoreJob.cpp	Tue Mar 10 13:59:14 2020 +0100
@@ -102,8 +102,10 @@
         
         assert(IsStarted());
         OpenConnection();
-        
-        connection_->RequestStorageCommitment(transactionUid_, sopClassUids_, sopInstanceUids_);
+
+        std::vector<std::string> a(sopClassUids_.begin(), sopClassUids_.end());
+        std::vector<std::string> b(sopInstanceUids_.begin(), sopInstanceUids_.end());
+        connection_->RequestStorageCommitment(transactionUid_, a, b);
       }
     }
 
@@ -125,6 +127,7 @@
     moveOriginatorId_(0),      // By default, not a C-MOVE
     storageCommitment_(false)  // By default, no storage commitment
   {
+    ResetStorageCommitment();
   }
 
 
@@ -210,19 +213,12 @@
     if (storageCommitment_)
     {
       transactionUid_ = Toolbox::GenerateDicomPrivateUniqueIdentifier();
-      sopClassUids_.reserve(GetInstancesCount());
-      sopInstanceUids_.reserve(GetInstancesCount());
+      sopClassUids_.clear();
+      sopInstanceUids_.clear();
     }
   }
   
 
-  void DicomModalityStoreJob::Start()
-  {
-    SetOfInstancesJob::Start();
-    ResetStorageCommitment();
-  }
-
-
   void DicomModalityStoreJob::Reset()
   {
     SetOfInstancesJob::Reset();
@@ -240,6 +236,7 @@
   void DicomModalityStoreJob::EnableStorageCommitment(bool enabled)
   {
     storageCommitment_ = enabled;
+    ResetStorageCommitment();
   }
   
 
--- a/OrthancServer/ServerJobs/DicomModalityStoreJob.h	Tue Mar 10 13:22:02 2020 +0100
+++ b/OrthancServer/ServerJobs/DicomModalityStoreJob.h	Tue Mar 10 13:59:14 2020 +0100
@@ -53,9 +53,9 @@
     bool                                  storageCommitment_;
 
     // For storage commitment
-    std::string               transactionUid_;
-    std::vector<std::string>  sopInstanceUids_;
-    std::vector<std::string>  sopClassUids_;
+    std::string             transactionUid_;
+    std::list<std::string>  sopInstanceUids_;
+    std::list<std::string>  sopClassUids_;
 
     void OpenConnection();
 
@@ -109,8 +109,6 @@
 
     virtual bool Serialize(Json::Value& target);
 
-    virtual void Start() ORTHANC_OVERRIDE;
-
     virtual void Reset() ORTHANC_OVERRIDE;
 
     void EnableStorageCommitment(bool enabled);