changeset 25:dfc43678aecb

replacing deprecated std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 06 Jul 2020 16:25:56 +0200
parents 065bc476bcdc
children ea0017a63fe4
files Framework/OrthancInstancesCache.cpp Framework/OrthancInstancesCache.h Framework/PullMode/PullJob.cpp Framework/PushMode/ActivePushTransactions.cpp Framework/PushMode/PushJob.cpp Framework/SourceDicomInstance.h Framework/StatefulOrthancJob.cpp Framework/StatefulOrthancJob.h Plugin/Plugin.cpp Plugin/PluginContext.cpp Plugin/PluginContext.h
diffstat 11 files changed, 31 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/OrthancInstancesCache.cpp	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/OrthancInstancesCache.cpp	Mon Jul 06 16:25:56 2020 +0200
@@ -19,6 +19,7 @@
 
 #include "OrthancInstancesCache.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
 
 namespace OrthancPlugins
 {
@@ -119,7 +120,7 @@
 
 
   void OrthancInstancesCache::Store(const std::string& instanceId,
-                                    std::auto_ptr<SourceDicomInstance>& instance)
+                                    std::unique_ptr<SourceDicomInstance>& instance)
   {
     if (instance.get() == NULL)
     {
@@ -222,7 +223,7 @@
     }
       
     // The instance was not in the cache, load it
-    std::auto_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId));
+    std::unique_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId));
     size = instance->GetInfo().GetSize();
     md5 = instance->GetInfo().GetMD5();
 
@@ -251,7 +252,7 @@
     }
       
     // The instance was not in the cache, load it
-    std::auto_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId));
+    std::unique_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId));
     instance->GetChunk(chunk, md5, 0, instance->GetInfo().GetSize());
 
     // Store the just-loaded DICOM instance into the cache
--- a/Framework/OrthancInstancesCache.h	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/OrthancInstancesCache.h	Mon Jul 06 16:25:56 2020 +0200
@@ -23,6 +23,7 @@
 #include "TransferBucket.h"
 
 #include <Cache/LeastRecentlyUsedIndex.h>
+#include <Compatibility.h>  // For std::unique_ptr
 
 #include <boost/thread/mutex.hpp>
 
@@ -75,7 +76,7 @@
 
     // The mutex must be locked!
     void Store(const std::string& instanceId,
-               std::auto_ptr<SourceDicomInstance>& instance);
+               std::unique_ptr<SourceDicomInstance>& instance);
     
 
   public:
--- a/Framework/PullMode/PullJob.cpp	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/PullMode/PullJob.cpp	Mon Jul 06 16:25:56 2020 +0200
@@ -23,6 +23,7 @@
 #include "../HttpQueries/HttpQueriesRunner.h"
 #include "../TransferScheduler.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
 #include <Logging.h>
 
 #include <json/writer.h>
@@ -34,7 +35,7 @@
   {
   private:
     const PullJob&               job_;
-    std::auto_ptr<DownloadArea>  area_;
+    std::unique_ptr<DownloadArea>  area_;
 
   public:
     CommitState(const PullJob& job,
@@ -62,8 +63,8 @@
     const PullJob&                    job_;
     JobInfo&                          info_;
     HttpQueriesQueue                  queue_;
-    std::auto_ptr<DownloadArea>       area_;
-    std::auto_ptr<HttpQueriesRunner>  runner_;
+    std::unique_ptr<DownloadArea>       area_;
+    std::unique_ptr<HttpQueriesRunner>  runner_;
 
     void UpdateInfo()
     {
--- a/Framework/PushMode/ActivePushTransactions.cpp	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/PushMode/ActivePushTransactions.cpp	Mon Jul 06 16:25:56 2020 +0200
@@ -21,6 +21,7 @@
 
 #include "../DownloadArea.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
 #include <Logging.h>
 
 
@@ -130,7 +131,7 @@
                                                         BucketCompression compression)
   {
     std::string uuid = Orthanc::Toolbox::GenerateUuid();
-    std::auto_ptr<Transaction> tmp(new Transaction(instances, buckets, compression));
+    std::unique_ptr<Transaction> tmp(new Transaction(instances, buckets, compression));
 
     LOG(INFO) << "Creating transaction to receive " << instances.size()
               << " instances (" << ConvertToMegabytes(tmp->GetDownloadArea().GetTotalSize())
--- a/Framework/PushMode/PushJob.cpp	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/PushMode/PushJob.cpp	Mon Jul 06 16:25:56 2020 +0200
@@ -23,6 +23,7 @@
 #include "../HttpQueries/HttpQueriesRunner.h"
 #include "../TransferScheduler.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
 #include <Logging.h>
 
 #include <json/writer.h>
@@ -97,7 +98,7 @@
     JobInfo&                          info_;
     std::string                       transactionUri_;
     HttpQueriesQueue                  queue_;
-    std::auto_ptr<HttpQueriesRunner>  runner_;
+    std::unique_ptr<HttpQueriesRunner>  runner_;
 
     void UpdateInfo()
     {
--- a/Framework/SourceDicomInstance.h	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/SourceDicomInstance.h	Mon Jul 06 16:25:56 2020 +0200
@@ -21,6 +21,8 @@
 
 #include "DicomInstanceInfo.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
+
 #include <orthanc/OrthancCPlugin.h>
 
 #include <boost/noncopyable.hpp>
@@ -32,7 +34,7 @@
   {
   private:
     OrthancPluginMemoryBuffer         buffer_;
-    std::auto_ptr<DicomInstanceInfo>  info_;
+    std::unique_ptr<DicomInstanceInfo>  info_;
 
   public:
     explicit SourceDicomInstance(const std::string& instanceId);
--- a/Framework/StatefulOrthancJob.cpp	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/StatefulOrthancJob.cpp	Mon Jul 06 16:25:56 2020 +0200
@@ -19,6 +19,8 @@
 
 #include "StatefulOrthancJob.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
+
 namespace OrthancPlugins
 {
   StatefulOrthancJob::JobInfo::JobInfo(StatefulOrthancJob& job) :
@@ -80,7 +82,7 @@
   
   OrthancPluginJobStepStatus StatefulOrthancJob::Step()
   {
-    std::auto_ptr<StateUpdate> update;
+    std::unique_ptr<StateUpdate> update;
 
     if (state_.get() == NULL)
     {        
--- a/Framework/StatefulOrthancJob.h	Mon Jul 06 16:23:48 2020 +0200
+++ b/Framework/StatefulOrthancJob.h	Mon Jul 06 16:25:56 2020 +0200
@@ -21,6 +21,8 @@
 
 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
+
 #include <memory>
 
 
@@ -59,7 +61,7 @@
     {
     private:
       OrthancPluginJobStepStatus  status_;
-      std::auto_ptr<IState>       state_;
+      std::unique_ptr<IState>       state_;
 
       explicit StateUpdate(OrthancPluginJobStepStatus status) :
         status_(status)
@@ -120,7 +122,7 @@
     
 
   private:
-    std::auto_ptr<IState>   state_;
+    std::unique_ptr<IState>   state_;
     JobInfo                 info_;
 
 
--- a/Plugin/Plugin.cpp	Mon Jul 06 16:23:48 2020 +0200
+++ b/Plugin/Plugin.cpp	Mon Jul 06 16:25:56 2020 +0200
@@ -24,6 +24,7 @@
 
 #include <EmbeddedResources.h>
 
+#include <Compatibility.h>  // For std::unique_ptr
 #include <ChunkedBuffer.h>
 #include <Compression/GzipCompressor.h>
 #include <Logging.h>
@@ -517,7 +518,7 @@
     {
       OrthancPlugins::TransferQuery query(source);
 
-      std::auto_ptr<OrthancPlugins::OrthancJob> job;
+      std::unique_ptr<OrthancPlugins::OrthancJob> job;
 
       if (type == JOB_TYPE_PULL)
       {
--- a/Plugin/PluginContext.cpp	Mon Jul 06 16:23:48 2020 +0200
+++ b/Plugin/PluginContext.cpp	Mon Jul 06 16:25:56 2020 +0200
@@ -19,6 +19,7 @@
 
 #include "PluginContext.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
 #include <Logging.h>
 
 
@@ -50,9 +51,9 @@
   }
 
 
-  std::auto_ptr<PluginContext>& PluginContext::GetSingleton()
+  std::unique_ptr<PluginContext>& PluginContext::GetSingleton()
   {
-    static std::auto_ptr<PluginContext>  singleton_;
+    static std::unique_ptr<PluginContext>  singleton_;
     return singleton_;
   }
 
--- a/Plugin/PluginContext.h	Mon Jul 06 16:23:48 2020 +0200
+++ b/Plugin/PluginContext.h	Mon Jul 06 16:25:56 2020 +0200
@@ -22,6 +22,7 @@
 #include "../Framework/OrthancInstancesCache.h"
 #include "../Framework/PushMode/ActivePushTransactions.h"
 
+#include <Compatibility.h>  // For std::unique_ptr
 #include <MultiThreading/Semaphore.h>
 
 #include <map>
@@ -48,7 +49,7 @@
                   size_t memoryCacheSize,
                   unsigned int maxHttpRetries);
 
-    static std::auto_ptr<PluginContext>& GetSingleton();
+    static std::unique_ptr<PluginContext>& GetSingleton();
   
   public:
     OrthancInstancesCache& GetCache()