diff Core/DicomParsing/FromDcmtkBridge.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 bc25deb40302
children 090022f1b5e1
line wrap: on
line diff
--- a/Core/DicomParsing/FromDcmtkBridge.cpp	Fri Feb 28 13:23:11 2020 +0100
+++ b/Core/DicomParsing/FromDcmtkBridge.cpp	Mon Mar 02 15:32:45 2020 +0100
@@ -47,6 +47,7 @@
 
 #include "FromDcmtkBridge.h"
 #include "ToDcmtkBridge.h"
+#include "../Compatibility.h"
 #include "../Logging.h"
 #include "../Toolbox.h"
 #include "../OrthancException.h"
@@ -351,7 +352,7 @@
               << name << " (multiplicity: " << minMultiplicity << "-" 
               << (arbitrary ? "n" : boost::lexical_cast<std::string>(maxMultiplicity)) << ")";
 
-    std::auto_ptr<DcmDictEntry>  entry;
+    std::unique_ptr<DcmDictEntry>  entry;
     if (privateCreator.empty())
     {
       if (tag.GetGroup() % 2 == 1)
@@ -885,7 +886,7 @@
     if (element.isLeaf())
     {
       // The "0" below lets "LeafValueToJson()" take care of "TooLong" values
-      std::auto_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement
+      std::unique_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement
                                   (element, flags, 0, encoding, hasCodeExtensions, ignoreTagLength));
 
       if (ignoreTagLength.find(GetTag(element)) == ignoreTagLength.end())
@@ -1632,7 +1633,7 @@
                                         Encoding dicomEncoding,
                                         const std::string& privateCreator)
   {
-    std::auto_ptr<DcmElement> element;
+    std::unique_ptr<DcmElement> element;
 
     switch (value.type())
     {
@@ -1659,7 +1660,7 @@
         
         for (Json::Value::ArrayIndex i = 0; i < value.size(); i++)
         {
-          std::auto_ptr<DcmItem> item(new DcmItem);
+          std::unique_ptr<DcmItem> item(new DcmItem);
 
           switch (value[i].type())
           {
@@ -1780,7 +1781,7 @@
                                         Encoding defaultEncoding,
                                         const std::string& privateCreator)
   {
-    std::auto_ptr<DcmDataset> result(new DcmDataset);
+    std::unique_ptr<DcmDataset> result(new DcmDataset);
     Encoding encoding = ExtractEncoding(json, defaultEncoding);
 
     SetString(*result, DCM_SpecificCharacterSet, GetDicomSpecificCharacterSet(encoding));
@@ -1816,7 +1817,7 @@
 
       if (tag != DICOM_TAG_SPECIFIC_CHARACTER_SET)
       {
-        std::auto_ptr<DcmElement> element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, encoding, privateCreator));
+        std::unique_ptr<DcmElement> element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, encoding, privateCreator));
         const DcmTagKey& tag = element->getTag();
 
         result->findAndDeleteElement(tag);
@@ -1868,7 +1869,7 @@
     }
     is.setEos();
 
-    std::auto_ptr<DcmFileFormat> result(new DcmFileFormat);
+    std::unique_ptr<DcmFileFormat> result(new DcmFileFormat);
 
     result->transferInit();
     if (!result->read(is).good())