changeset 3768:6110a4995ace

replacing std::auto_ptr by std::unique_ptr in GDCM sample plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 Mar 2020 15:02:23 +0100
parents c6658187e4b1
children eb044cc49d51
files Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp Plugins/Samples/GdcmDecoder/GdcmDecoderCache.h Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp Plugins/Samples/GdcmDecoder/Plugin.cpp Plugins/Samples/ModalityWorklists/Plugin.cpp
diffstat 5 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp	Tue Mar 17 14:46:06 2020 +0100
+++ b/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp	Tue Mar 17 15:02:23 2020 +0100
@@ -21,6 +21,7 @@
 
 #include "GdcmDecoderCache.h"
 
+#include "../../../Core/Compatibility.h"
 #include "OrthancImageWrapper.h"
 
 namespace OrthancPlugins
@@ -83,13 +84,13 @@
     }
 
     // This is not the same image
-    std::auto_ptr<GdcmImageDecoder> decoder(new GdcmImageDecoder(dicom, size));
-    std::auto_ptr<OrthancImageWrapper> image(new OrthancImageWrapper(context, decoder->Decode(context, frameIndex)));
+    std::unique_ptr<GdcmImageDecoder> decoder(new GdcmImageDecoder(dicom, size));
+    std::unique_ptr<OrthancImageWrapper> image(new OrthancImageWrapper(context, decoder->Decode(context, frameIndex)));
 
     {
       // Cache the newly created decoder for further use
       boost::mutex::scoped_lock lock(mutex_);
-      decoder_ = decoder;
+      decoder_.reset(decoder.release());
       size_ = size;
       md5_ = md5;
     }
--- a/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.h	Tue Mar 17 14:46:06 2020 +0100
+++ b/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.h	Tue Mar 17 15:02:23 2020 +0100
@@ -21,6 +21,7 @@
 
 #pragma once
 
+#include "../../../Core/Compatibility.h"
 #include "GdcmImageDecoder.h"
 #include "OrthancImageWrapper.h"
 
@@ -33,7 +34,7 @@
   {
   private:
     boost::mutex   mutex_;
-    std::auto_ptr<OrthancPlugins::GdcmImageDecoder>  decoder_;
+    std::unique_ptr<OrthancPlugins::GdcmImageDecoder>  decoder_;
     size_t       size_;
     std::string  md5_;
 
--- a/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp	Tue Mar 17 14:46:06 2020 +0100
+++ b/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp	Tue Mar 17 15:02:23 2020 +0100
@@ -21,6 +21,7 @@
 
 #include "GdcmImageDecoder.h"
 
+#include "../../../Core/Compatibility.h"
 #include "OrthancImageWrapper.h"
 
 #include <gdcmImageReader.h>
@@ -40,9 +41,9 @@
     size_t                size_;
 
     gdcm::ImageReader reader_;
-    std::auto_ptr<gdcm::ImageApplyLookupTable> lut_;
-    std::auto_ptr<gdcm::ImageChangePhotometricInterpretation> photometric_;
-    std::auto_ptr<gdcm::ImageChangePlanarConfiguration> interleaved_;
+    std::unique_ptr<gdcm::ImageApplyLookupTable> lut_;
+    std::unique_ptr<gdcm::ImageChangePhotometricInterpretation> photometric_;
+    std::unique_ptr<gdcm::ImageChangePlanarConfiguration> interleaved_;
     std::string decoded_;
 
     PImpl(const void* dicom,
--- a/Plugins/Samples/GdcmDecoder/Plugin.cpp	Tue Mar 17 14:46:06 2020 +0100
+++ b/Plugins/Samples/GdcmDecoder/Plugin.cpp	Tue Mar 17 15:02:23 2020 +0100
@@ -19,6 +19,7 @@
  **/
 
 
+#include "../../../Core/Compatibility.h"
 #include "GdcmDecoderCache.h"
 #include "OrthancImageWrapper.h"
 
@@ -35,7 +36,7 @@
 {
   try
   {
-    std::auto_ptr<OrthancPlugins::OrthancImageWrapper> image;
+    std::unique_ptr<OrthancPlugins::OrthancImageWrapper> image;
 
 #if 0
     // Do not use the cache
--- a/Plugins/Samples/ModalityWorklists/Plugin.cpp	Tue Mar 17 14:46:06 2020 +0100
+++ b/Plugins/Samples/ModalityWorklists/Plugin.cpp	Tue Mar 17 15:02:23 2020 +0100
@@ -19,6 +19,7 @@
  **/
 
 
+#include "../../../Core/Compatibility.h"
 #include "../Common/OrthancPluginCppWrapper.h"
 
 #include <boost/filesystem.hpp>
@@ -142,7 +143,7 @@
   try
   {
     // Construct an object to match the worklists in the database against the C-Find query
-    std::auto_ptr<OrthancPlugins::FindMatcher> matcher(CreateMatcher(query, issuerAet));
+    std::unique_ptr<OrthancPlugins::FindMatcher> matcher(CreateMatcher(query, issuerAet));
 
     // Loop over the regular files in the database folder
     namespace fs = boost::filesystem;