diff OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 3712:2a170a8f1faf

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 15:32:45 +0100
parents a9ce35d67c3c
children 09f091b6b569
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Fri Feb 28 13:23:11 2020 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Mar 02 15:32:45 2020 +0100
@@ -388,14 +388,14 @@
     class ImageToEncode
     {
     private:
-      std::auto_ptr<ImageAccessor>&  image_;
+      std::unique_ptr<ImageAccessor>&  image_;
       ImageExtractionMode            mode_;
       bool                           invert_;
       MimeType                       format_;
       std::string                    answer_;
 
     public:
-      ImageToEncode(std::auto_ptr<ImageAccessor>& image,
+      ImageToEncode(std::unique_ptr<ImageAccessor>& image,
                     ImageExtractionMode mode,
                     bool invert) :
         image_(image),
@@ -518,7 +518,7 @@
       }
 
       virtual void Handle(RestApiGetCall& call,
-                          std::auto_ptr<ImageAccessor>& decoded,
+                          std::unique_ptr<ImageAccessor>& decoded,
                           const DicomMap& dicom) = 0;
 
       virtual bool RequiresDicomTags() const = 0;
@@ -541,7 +541,7 @@
         }
 
         DicomMap dicom;
-        std::auto_ptr<ImageAccessor> decoded;
+        std::unique_ptr<ImageAccessor> decoded;
 
         try
         {
@@ -613,7 +613,7 @@
 
 
       static void DefaultHandler(RestApiGetCall& call,
-                                 std::auto_ptr<ImageAccessor>& decoded,
+                                 std::unique_ptr<ImageAccessor>& decoded,
                                  ImageExtractionMode mode,
                                  bool invert)
       {
@@ -649,7 +649,7 @@
       }
 
       virtual void Handle(RestApiGetCall& call,
-                          std::auto_ptr<ImageAccessor>& decoded,
+                          std::unique_ptr<ImageAccessor>& decoded,
                           const DicomMap& dicom) ORTHANC_OVERRIDE
       {
         bool invert = false;
@@ -817,7 +817,7 @@
       
     public:
       virtual void Handle(RestApiGetCall& call,
-                          std::auto_ptr<ImageAccessor>& decoded,
+                          std::unique_ptr<ImageAccessor>& decoded,
                           const DicomMap& dicom) ORTHANC_OVERRIDE
       {
         bool invert;
@@ -865,7 +865,7 @@
           }
           else
           {
-            std::auto_ptr<ImageAccessor> resized(
+            std::unique_ptr<ImageAccessor> resized(
               new Image(decoded->GetFormat(), targetWidth, targetHeight, false));
             
             if (smooth &&
@@ -901,7 +901,7 @@
           const float scaling = 255.0f * rescaleSlope / windowWidth;
           const float offset = (rescaleIntercept - windowCenter + windowWidth / 2.0f) / rescaleSlope;
 
-          std::auto_ptr<ImageAccessor> rescaled(new Image(PixelFormat_Grayscale8, decoded->GetWidth(), decoded->GetHeight(), false));
+          std::unique_ptr<ImageAccessor> rescaled(new Image(PixelFormat_Grayscale8, decoded->GetWidth(), decoded->GetHeight(), false));
           ImageProcessing::ShiftScale(*rescaled, converted, offset, scaling, false);
 
           if (targetWidth == decoded->GetWidth() &&
@@ -911,7 +911,7 @@
           }
           else
           {
-            std::auto_ptr<ImageAccessor> resized(
+            std::unique_ptr<ImageAccessor> resized(
               new Image(PixelFormat_Grayscale8, targetWidth, targetHeight, false));
             
             if (smooth &&
@@ -976,7 +976,7 @@
     DefaultDicomImageDecoder decoder;  // This is Orthanc's built-in decoder
 #endif
 
-    std::auto_ptr<ImageAccessor> decoded(decoder.Decode(dicomContent.c_str(), dicomContent.size(), frame));
+    std::unique_ptr<ImageAccessor> decoded(decoder.Decode(dicomContent.c_str(), dicomContent.size(), frame));
 
     std::string result;
     decoded->ToMatlabString(result);