changeset 3713:56f2397f027a storage-commitment

integration mainline->storage-commitment
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 15:42:17 +0100
parents 14b363d972a8 (current diff) 2a170a8f1faf (diff)
children 0504cc83486a
files Core/DicomFormat/DicomMap.cpp Core/DicomNetworking/DicomServer.cpp Core/DicomNetworking/DicomUserConnection.cpp Core/DicomNetworking/Internals/CommandDispatcher.cpp Core/JobsEngine/JobsEngine.h Core/JobsEngine/Operations/SequenceOfOperationsJob.cpp Core/JobsEngine/SetOfCommandsJob.cpp Core/Toolbox.cpp OrthancServer/OrthancRestApi/OrthancRestModalities.cpp OrthancServer/ServerContext.cpp OrthancServer/ServerContext.h OrthancServer/ServerJobs/ArchiveJob.cpp OrthancServer/ServerJobs/ArchiveJob.h OrthancServer/ServerJobs/DicomMoveScuJob.cpp OrthancServer/ServerJobs/OrthancJobUnserializer.cpp OrthancServer/main.cpp Plugins/Engine/OrthancPlugins.cpp Plugins/Engine/OrthancPlugins.h UnitTestsSources/MultiThreadingTests.cpp UnitTestsSources/ToolboxTests.cpp
diffstat 93 files changed, 489 insertions(+), 366 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Cache/MemoryCache.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Cache/MemoryCache.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -62,7 +62,7 @@
       }
 
       // Create a new cache page
-      std::auto_ptr<Page> result(new Page);
+      std::unique_ptr<Page> result(new Page);
       result->id_ = id;
       result->content_.reset(provider_.Provide(id));
 
--- a/Core/Cache/MemoryCache.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Cache/MemoryCache.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,9 +33,11 @@
 
 #pragma once
 
-#include <memory>
+#include "../Compatibility.h"
+#include "ICachePageProvider.h"
 #include "LeastRecentlyUsedIndex.h"
-#include "ICachePageProvider.h"
+
+#include <memory>
 
 namespace Orthanc
 {
@@ -50,7 +52,7 @@
       struct Page
       {
         std::string id_;
-        std::auto_ptr<IDynamicObject> content_;
+        std::unique_ptr<IDynamicObject> content_;
       };
 
       ICachePageProvider& provider_;
--- a/Core/Cache/MemoryObjectCache.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Cache/MemoryObjectCache.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,8 @@
 #include "../PrecompiledHeaders.h"
 #include "MemoryObjectCache.h"
 
+#include "../Compatibility.h"
+
 namespace Orthanc
 {
   class MemoryObjectCache::Item : public boost::noncopyable
@@ -142,7 +144,7 @@
   void MemoryObjectCache::Acquire(const std::string& key,
                                   ICacheable* value)
   {
-    std::auto_ptr<Item> item(new Item(value));
+    std::unique_ptr<Item> item(new Item(value));
 
     if (value == NULL)
     {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/Compatibility.h	Mon Mar 02 15:42:17 2020 +0100
@@ -0,0 +1,66 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2020 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#if __cplusplus < 201103L
+/**
+ * "std::unique_ptr" was introduced in C++11, and "std::auto_ptr" was
+ * removed in C++17. We emulate "std::auto_ptr" using boost: "The
+ * smart pointer unique_ptr [is] a drop-in replacement for
+ * std::unique_ptr, usable also from C++03 compilers." This is only
+ * available if Boost >= 1.57.0 (from November 2014).
+ * https://www.boost.org/doc/libs/1_57_0/doc/html/move/reference.html#header.boost.move.unique_ptr_hpp
+ **/
+
+#include <boost/move/unique_ptr.hpp>
+
+namespace std
+{
+  template <typename T>
+  class unique_ptr : public boost::movelib::unique_ptr<T>
+  {
+  public:
+    unique_ptr() :
+      boost::movelib::unique_ptr<T>()
+    {
+    }      
+
+    unique_ptr(T* p) :
+      boost::movelib::unique_ptr<T>(p)
+    {
+    }      
+  };
+}
+
+#endif
--- a/Core/DicomFormat/DicomImageInformation.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomFormat/DicomImageInformation.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -39,6 +39,7 @@
 
 #include "DicomImageInformation.h"
 
+#include "../Compatibility.h"
 #include "../OrthancException.h"
 #include "../Toolbox.h"
 #include <boost/lexical_cast.hpp>
@@ -223,7 +224,7 @@
 
   DicomImageInformation* DicomImageInformation::Clone() const
   {
-    std::auto_ptr<DicomImageInformation> target(new DicomImageInformation);
+    std::unique_ptr<DicomImageInformation> target(new DicomImageInformation);
     target->width_ = width_;
     target->height_ = height_;
     target->samplesPerPixel_ = samplesPerPixel_;
--- a/Core/DicomFormat/DicomMap.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomFormat/DicomMap.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -37,6 +37,7 @@
 #include <stdio.h>
 #include <memory>
 
+#include "../Compatibility.h"
 #include "../Endianness.h"
 #include "../Logging.h"
 #include "../OrthancException.h"
@@ -300,7 +301,7 @@
 
   DicomMap* DicomMap::Clone() const
   {
-    std::auto_ptr<DicomMap> result(new DicomMap);
+    std::unique_ptr<DicomMap> result(new DicomMap);
 
     for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it)
     {
@@ -1165,7 +1166,7 @@
         throw OrthancException(ErrorCode_BadFileFormat);
       }
 
-      std::auto_ptr<DicomValue> value(new DicomValue);
+      std::unique_ptr<DicomValue> value(new DicomValue);
       value->Unserialize(source[tags[i]]);
 
       content_[tag] = value.release();
--- a/Core/DicomNetworking/DicomFindAnswers.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomNetworking/DicomFindAnswers.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -46,7 +46,7 @@
 {
   void DicomFindAnswers::AddAnswerInternal(ParsedDicomFile* answer)
   {
-    std::auto_ptr<ParsedDicomFile> protection(answer);
+    std::unique_ptr<ParsedDicomFile> protection(answer);
 
     if (isWorklist_)
     {
@@ -166,7 +166,7 @@
 
     DcmDataset& source = *GetAnswer(index).GetDcmtkObject().getDataset();
 
-    std::auto_ptr<DcmDataset> target(new DcmDataset);
+    std::unique_ptr<DcmDataset> target(new DcmDataset);
 
     for (unsigned long i = 0; i < source.card(); i++)
     {
--- a/Core/DicomNetworking/DicomServer.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomNetworking/DicomServer.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -53,7 +53,7 @@
   {
     boost::thread  thread_;
     T_ASC_Network *network_;
-    std::auto_ptr<RunnableWorkersPool>  workers_;
+    std::unique_ptr<RunnableWorkersPool>  workers_;
   };
 
 
@@ -65,7 +65,7 @@
     {
       /* receive an association and acknowledge or reject it. If the association was */
       /* acknowledged, offer corresponding services and invoke one or more if required. */
-      std::auto_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, server->pimpl_->network_));
+      std::unique_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, server->pimpl_->network_));
 
       try
       {
--- a/Core/DicomNetworking/DicomUserConnection.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomNetworking/DicomUserConnection.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -628,7 +628,7 @@
       case ModalityManufacturer_GenericNoWildcardInDates:
       case ModalityManufacturer_GenericNoUniversalWildcard:
       {
-        std::auto_ptr<DicomMap> fix(fields.Clone());
+        std::unique_ptr<DicomMap> fix(fields.Clone());
 
         std::set<DicomTag> tags;
         fix->GetTags(tags);
@@ -743,7 +743,7 @@
   {
     CheckIsOpen();
 
-    std::auto_ptr<ParsedDicomFile> query;
+    std::unique_ptr<ParsedDicomFile> query;
 
     if (normalize)
     {
@@ -856,7 +856,7 @@
   {
     CheckIsOpen();
 
-    std::auto_ptr<ParsedDicomFile> query(ConvertQueryFields(fields, manufacturer_));
+    std::unique_ptr<ParsedDicomFile> query(ConvertQueryFields(fields, manufacturer_));
     DcmDataset* dataset = query->GetDcmtkObject().getDataset();
 
     const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel;
--- a/Core/DicomNetworking/Internals/CommandDispatcher.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomNetworking/Internals/CommandDispatcher.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -90,6 +90,7 @@
 #include "FindScp.h"
 #include "StoreScp.h"
 #include "MoveScp.h"
+#include "../../Compatibility.h"
 #include "../../Toolbox.h"
 #include "../../Logging.h"
 #include "../../OrthancException.h"
@@ -782,7 +783,7 @@
             case DicomRequestType_Store:
               if (server_.HasStoreRequestHandlerFactory()) // Should always be true
               {
-                std::auto_ptr<IStoreRequestHandler> handler
+                std::unique_ptr<IStoreRequestHandler> handler
                   (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler());
 
                 if (handler.get() != NULL)
@@ -795,7 +796,7 @@
             case DicomRequestType_Move:
               if (server_.HasMoveRequestHandlerFactory()) // Should always be true
               {
-                std::auto_ptr<IMoveRequestHandler> handler
+                std::unique_ptr<IMoveRequestHandler> handler
                   (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler());
 
                 if (handler.get() != NULL)
@@ -809,13 +810,13 @@
               if (server_.HasFindRequestHandlerFactory() || // Should always be true
                   server_.HasWorklistRequestHandlerFactory())
               {
-                std::auto_ptr<IFindRequestHandler> findHandler;
+                std::unique_ptr<IFindRequestHandler> findHandler;
                 if (server_.HasFindRequestHandlerFactory())
                 {
                   findHandler.reset(server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler());
                 }
 
-                std::auto_ptr<IWorklistRequestHandler> worklistHandler;
+                std::unique_ptr<IWorklistRequestHandler> worklistHandler;
                 if (server_.HasWorklistRequestHandlerFactory())
                 {
                   worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler());
--- a/Core/DicomNetworking/Internals/MoveScp.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomNetworking/Internals/MoveScp.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -114,7 +114,7 @@
       unsigned int subOperationCount_;
       unsigned int failureCount_;
       unsigned int warningCount_;
-      std::auto_ptr<IMoveRequestIterator> iterator_;
+      std::unique_ptr<IMoveRequestIterator> iterator_;
       const std::string* remoteIp_;
       const std::string* remoteAet_;
       const std::string* calledAet_;
--- a/Core/DicomNetworking/TimeoutDicomConnectionManager.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomNetworking/TimeoutDicomConnectionManager.h	Mon Mar 02 15:42:17 2020 +0100
@@ -63,6 +63,8 @@
 
 #else
 
+#include "../Compatibility.h"
+
 #include <boost/date_time/posix_time/posix_time.hpp>
 
 namespace Orthanc
@@ -72,9 +74,9 @@
   private:
     class Resource;
 
-    std::auto_ptr<DicomUserConnection>   connection_;
-    boost::posix_time::ptime             lastUse_;
-    boost::posix_time::time_duration     timeout_;
+    std::unique_ptr<DicomUserConnection>  connection_;
+    boost::posix_time::ptime              lastUse_;
+    boost::posix_time::time_duration      timeout_;
 
     void Touch();
 
--- a/Core/DicomParsing/DicomDirWriter.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/DicomDirWriter.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -104,6 +104,7 @@
 #include "FromDcmtkBridge.h"
 #include "ToDcmtkBridge.h"
 
+#include "../Compatibility.h"
 #include "../Logging.h"
 #include "../OrthancException.h"
 #include "../TemporaryFile.h"
@@ -132,7 +133,7 @@
     std::string                fileSetId_;
     bool                       extendedSopClass_;
     TemporaryFile              file_;
-    std::auto_ptr<DcmDicomDir> dir_;
+    std::unique_ptr<DcmDicomDir> dir_;
 
     typedef std::pair<ResourceType, std::string>  IndexKey;
     typedef std::map<IndexKey, DcmDirectoryRecord* >  Index;
@@ -466,7 +467,7 @@
         return false; // Already existing
       }
 
-      std::auto_ptr<DcmDirectoryRecord> record(new DcmDirectoryRecord(type, NULL, filename));
+      std::unique_ptr<DcmDirectoryRecord> record(new DcmDirectoryRecord(type, NULL, filename));
 
       switch (level)
       {
--- a/Core/DicomParsing/DicomModification.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/DicomModification.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,13 +34,14 @@
 #include "../PrecompiledHeaders.h"
 #include "DicomModification.h"
 
+#include "../Compatibility.h"
 #include "../Logging.h"
 #include "../OrthancException.h"
 #include "../SerializationToolbox.h"
 #include "FromDcmtkBridge.h"
 #include "ITagVisitor.h"
 
-#include <memory>   // For std::auto_ptr
+#include <memory>   // For std::unique_ptr
 
 
 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2008 =
@@ -317,7 +318,7 @@
   void DicomModification::MapDicomTags(ParsedDicomFile& dicom,
                                        ResourceType level)
   {
-    std::auto_ptr<DicomTag> tag;
+    std::unique_ptr<DicomTag> tag;
 
     switch (level)
     {
--- a/Core/DicomParsing/FromDcmtkBridge.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/FromDcmtkBridge.cpp	Mon Mar 02 15:42:17 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())
--- a/Core/DicomParsing/Internals/DicomFrameIndex.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/Internals/DicomFrameIndex.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../Compatibility.h"
 #include "../../Enumerations.h"
 
 #include <dcmtk/dcmdata/dcdatset.h>
@@ -62,8 +63,8 @@
     class UncompressedIndex;
     class PsmctRle1Index;
 
-    std::auto_ptr<IIndex>  index_;
-    unsigned int           countFrames_;
+    std::unique_ptr<IIndex>  index_;
+    unsigned int             countFrames_;
 
   public:
     DicomFrameIndex(DcmFileFormat& dicom);
--- a/Core/DicomParsing/Internals/DicomImageDecoder.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/Internals/DicomImageDecoder.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -249,7 +249,7 @@
   {
   private:
     std::string psmct_;
-    std::auto_ptr<DicomIntegerPixelAccessor> slowAccessor_;
+    std::unique_ptr<DicomIntegerPixelAccessor> slowAccessor_;
 
   public:
     void Setup(DcmDataset& dataset,
@@ -388,7 +388,7 @@
   }
 
 
-  static ImageAccessor* DecodeLookupTable(std::auto_ptr<ImageAccessor>& target,
+  static ImageAccessor* DecodeLookupTable(std::unique_ptr<ImageAccessor>& target,
                                           const DicomImageInformation& info,
                                           DcmDataset& dataset,
                                           const uint8_t* pixelData,
@@ -508,7 +508,7 @@
      * Create the target image.
      **/
 
-    std::auto_ptr<ImageAccessor> target(CreateImage(dataset, false));
+    std::unique_ptr<ImageAccessor> target(CreateImage(dataset, false));
 
     ImageSource source;
     source.Setup(dataset, frame);
@@ -616,7 +616,7 @@
     FromDcmtkBridge::ExtractDicomSummary(m, dataset);
     DicomImageInformation info(m);
 
-    std::auto_ptr<ImageAccessor> target(CreateImage(dataset, true));
+    std::unique_ptr<ImageAccessor> target(CreateImage(dataset, true));
 
     Uint32 startFragment = 0;  // Default 
     OFString decompressedColorModel;  // Out
@@ -692,7 +692,7 @@
       DJLSRepresentationParameter representationParameter(2, OFTrue);
 
       DJLSCodecParameter parameters;
-      std::auto_ptr<DJLSDecoderBase> decoder;
+      std::unique_ptr<DJLSDecoderBase> decoder;
 
       switch (syntax)
       {
@@ -734,7 +734,7 @@
         EUC_default,     // Mode for UID creation, unused for decompression
         EPC_default);    // Automatically determine whether color-by-plane is required from the SOP Class UID and decompressed photometric interpretation
       DJ_RPLossy representationParameter;
-      std::auto_ptr<DJCodecDecoder> decoder;
+      std::unique_ptr<DJCodecDecoder> decoder;
 
       switch (syntax)
       {
@@ -799,7 +799,7 @@
     {
       LOG(INFO) << "Decoding a compressed image by converting its transfer syntax to Little Endian";
 
-      std::auto_ptr<DcmDataset> converted(dynamic_cast<DcmDataset*>(dataset.clone()));
+      std::unique_ptr<DcmDataset> converted(dynamic_cast<DcmDataset*>(dataset.clone()));
       converted->chooseRepresentation(EXS_LittleEndianExplicit, NULL);
 
       if (converted->canWriteXfer(EXS_LittleEndianExplicit))
@@ -820,7 +820,7 @@
   }
 
 
-  bool DicomImageDecoder::TruncateDecodedImage(std::auto_ptr<ImageAccessor>& image,
+  bool DicomImageDecoder::TruncateDecodedImage(std::unique_ptr<ImageAccessor>& image,
                                                PixelFormat format,
                                                bool allowColorConversion)
   {
@@ -840,17 +840,22 @@
     if (image->GetFormat() != format)
     {
       // A conversion is required
-      std::auto_ptr<ImageAccessor> target
+      std::unique_ptr<ImageAccessor> target
         (new Image(format, image->GetWidth(), image->GetHeight(), false));
       ImageProcessing::Convert(*target, *image);
-      image = target;
+
+#if __cplusplus < 201103L
+      image.reset(target.release());
+#else
+      image = std::move(target);
+#endif
     }
 
     return true;
   }
 
 
-  bool DicomImageDecoder::PreviewDecodedImage(std::auto_ptr<ImageAccessor>& image)
+  bool DicomImageDecoder::PreviewDecodedImage(std::unique_ptr<ImageAccessor>& image)
   {
     switch (image->GetFormat())
     {
@@ -862,10 +867,16 @@
 
       case PixelFormat_RGB48:
       {
-        std::auto_ptr<ImageAccessor> target
+        std::unique_ptr<ImageAccessor> target
           (new Image(PixelFormat_RGB24, image->GetWidth(), image->GetHeight(), false));
         ImageProcessing::Convert(*target, *image);
-        image = target;
+
+#if __cplusplus < 201103L
+        image.reset(target.release());
+#else
+        image = std::move(target);
+#endif
+
         return true;
       }
 
@@ -891,10 +902,15 @@
         // If the source image is not grayscale 8bpp, convert it
         if (image->GetFormat() != PixelFormat_Grayscale8)
         {
-          std::auto_ptr<ImageAccessor> target
+          std::unique_ptr<ImageAccessor> target
             (new Image(PixelFormat_Grayscale8, image->GetWidth(), image->GetHeight(), false));
           ImageProcessing::Convert(*target, *image);
-          image = target;
+
+#if __cplusplus < 201103L
+          image.reset(target.release());
+#else
+          image = std::move(target);
+#endif
         }
 
         return true;
@@ -906,7 +922,7 @@
   }
 
 
-  void DicomImageDecoder::ApplyExtractionMode(std::auto_ptr<ImageAccessor>& image,
+  void DicomImageDecoder::ApplyExtractionMode(std::unique_ptr<ImageAccessor>& image,
                                               ImageExtractionMode mode,
                                               bool invert)
   {
@@ -956,7 +972,7 @@
 
 
   void DicomImageDecoder::ExtractPamImage(std::string& result,
-                                          std::auto_ptr<ImageAccessor>& image,
+                                          std::unique_ptr<ImageAccessor>& image,
                                           ImageExtractionMode mode,
                                           bool invert)
   {
@@ -968,7 +984,7 @@
 
 #if ORTHANC_ENABLE_PNG == 1
   void DicomImageDecoder::ExtractPngImage(std::string& result,
-                                          std::auto_ptr<ImageAccessor>& image,
+                                          std::unique_ptr<ImageAccessor>& image,
                                           ImageExtractionMode mode,
                                           bool invert)
   {
@@ -982,7 +998,7 @@
 
 #if ORTHANC_ENABLE_JPEG == 1
   void DicomImageDecoder::ExtractJpegImage(std::string& result,
-                                           std::auto_ptr<ImageAccessor>& image,
+                                           std::unique_ptr<ImageAccessor>& image,
                                            ImageExtractionMode mode,
                                            bool invert,
                                            uint8_t quality)
--- a/Core/DicomParsing/Internals/DicomImageDecoder.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/Internals/DicomImageDecoder.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../Compatibility.h"
 #include "../ParsedDicomFile.h"
 
 #include <memory>
@@ -82,13 +83,13 @@
                                      DcmDataset& dataset,
                                      unsigned int frame);
 
-    static bool TruncateDecodedImage(std::auto_ptr<ImageAccessor>& image,
+    static bool TruncateDecodedImage(std::unique_ptr<ImageAccessor>& image,
                                      PixelFormat format,
                                      bool allowColorConversion);
 
-    static bool PreviewDecodedImage(std::auto_ptr<ImageAccessor>& image);
+    static bool PreviewDecodedImage(std::unique_ptr<ImageAccessor>& image);
 
-    static void ApplyExtractionMode(std::auto_ptr<ImageAccessor>& image,
+    static void ApplyExtractionMode(std::unique_ptr<ImageAccessor>& image,
                                     ImageExtractionMode mode,
                                     bool invert);
 
@@ -102,20 +103,20 @@
                                  unsigned int frame);
 
     static void ExtractPamImage(std::string& result,
-                                std::auto_ptr<ImageAccessor>& image,
+                                std::unique_ptr<ImageAccessor>& image,
                                 ImageExtractionMode mode,
                                 bool invert);
 
 #if ORTHANC_ENABLE_PNG == 1
     static void ExtractPngImage(std::string& result,
-                                std::auto_ptr<ImageAccessor>& image,
+                                std::unique_ptr<ImageAccessor>& image,
                                 ImageExtractionMode mode,
                                 bool invert);
 #endif
 
 #if ORTHANC_ENABLE_JPEG == 1
     static void ExtractJpegImage(std::string& result,
-                                 std::auto_ptr<ImageAccessor>& image,
+                                 std::unique_ptr<ImageAccessor>& image,
                                  ImageExtractionMode mode,
                                  bool invert,
                                  uint8_t quality);
--- a/Core/DicomParsing/ParsedDicomDir.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/ParsedDicomDir.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "../PrecompiledHeaders.h"
 #include "ParsedDicomDir.h"
 
+#include "../Compatibility.h"
 #include "../OrthancException.h"
 #include "ParsedDicomFile.h"
 #include "FromDcmtkBridge.h"
@@ -119,7 +120,7 @@
       nextOffsets_[i] = next;
       lowerOffsets_[i] = lower;
 
-      std::auto_ptr<DicomMap> entry(new DicomMap);
+      std::unique_ptr<DicomMap> entry(new DicomMap);
       FromDcmtkBridge::ExtractDicomSummary(*entry, *item);
 
       if (next != 0)
--- a/Core/DicomParsing/ParsedDicomFile.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/DicomParsing/ParsedDicomFile.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -156,8 +156,8 @@
 {
   struct ParsedDicomFile::PImpl
   {
-    std::auto_ptr<DcmFileFormat> file_;
-    std::auto_ptr<DicomFrameIndex>  frameIndex_;
+    std::unique_ptr<DcmFileFormat> file_;
+    std::unique_ptr<DicomFrameIndex>  frameIndex_;
   };
 
 
@@ -649,7 +649,7 @@
 
     bool hasCodeExtensions;
     Encoding encoding = DetectEncoding(hasCodeExtensions);
-    std::auto_ptr<DcmElement> element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, encoding, privateCreator));
+    std::unique_ptr<DcmElement> element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, encoding, privateCreator));
     InsertInternal(*pimpl_->file_->getDataset(), element.release());
   }
 
@@ -798,7 +798,7 @@
         }
       }
 
-      std::auto_ptr<DcmElement> element(FromDcmtkBridge::CreateElementForTag(tag, privateCreator));
+      std::unique_ptr<DcmElement> element(FromDcmtkBridge::CreateElementForTag(tag, privateCreator));
 
       if (!utf8Value.empty())
       {
@@ -921,9 +921,9 @@
       Encoding encoding = DetectEncoding(hasCodeExtensions);
       
       std::set<DicomTag> tmp;
-      std::auto_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement
-                                  (*element, DicomToJsonFlags_Default, 
-                                   0, encoding, hasCodeExtensions, tmp));
+      std::unique_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement
+                                    (*element, DicomToJsonFlags_Default, 
+                                     0, encoding, hasCodeExtensions, tmp));
       
       if (v.get() == NULL ||
           v->IsNull())
@@ -1309,7 +1309,7 @@
     DcmTag key(DICOM_TAG_PIXEL_DATA.GetGroup(), 
                DICOM_TAG_PIXEL_DATA.GetElement());
 
-    std::auto_ptr<DcmPixelData> pixels(new DcmPixelData(key));
+    std::unique_ptr<DcmPixelData> pixels(new DcmPixelData(key));
 
     unsigned int pitch = accessor.GetWidth() * bytesPerPixel;
     Uint8* target = NULL;
@@ -1444,7 +1444,7 @@
     ReplacePlainString(FromDcmtkBridge::Convert(DCM_MIMETypeOfEncapsulatedDocument), MIME_PDF);
     //ReplacePlainString(FromDcmtkBridge::Convert(DCM_SeriesNumber), "1");
 
-    std::auto_ptr<DcmPolymorphOBOW> element(new DcmPolymorphOBOW(DCM_EncapsulatedDocument));
+    std::unique_ptr<DcmPolymorphOBOW> element(new DcmPolymorphOBOW(DCM_EncapsulatedDocument));
 
     size_t s = pdf.size();
     if (s & 1)
@@ -1519,7 +1519,7 @@
     const bool generateIdentifiers = (flags & DicomFromJsonFlags_GenerateIdentifiers) ? true : false;
     const bool decodeDataUriScheme = (flags & DicomFromJsonFlags_DecodeDataUriScheme) ? true : false;
 
-    std::auto_ptr<ParsedDicomFile> result(new ParsedDicomFile(generateIdentifiers));
+    std::unique_ptr<ParsedDicomFile> result(new ParsedDicomFile(generateIdentifiers));
     result->SetEncoding(FromDcmtkBridge::ExtractEncoding(json, GetDefaultDicomEncoding()));
 
     const Json::Value::Members tags = json.getMemberNames();
--- a/Core/FileStorage/StorageAccessor.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/FileStorage/StorageAccessor.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "../PrecompiledHeaders.h"
 #include "StorageAccessor.h"
 
+#include "../Compatibility.h"
 #include "../Compression/ZlibCompressor.h"
 #include "../MetricsRegistry.h"
 #include "../OrthancException.h"
@@ -54,7 +55,7 @@
   class StorageAccessor::MetricsTimer : public boost::noncopyable
   {
   private:
-    std::auto_ptr<MetricsRegistry::Timer>  timer_;
+    std::unique_ptr<MetricsRegistry::Timer>  timer_;
 
   public:
     MetricsTimer(StorageAccessor& that,
--- a/Core/HttpServer/EmbeddedResourceHttpHandler.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/HttpServer/EmbeddedResourceHttpHandler.h	Mon Mar 02 15:42:17 2020 +0100
@@ -51,7 +51,7 @@
       const std::string& baseUri,
       EmbeddedResources::DirectoryResourceId resourceId);
 
-    virtual bool CreateChunkedRequestReader(std::auto_ptr<IChunkedRequestReader>& target,
+    virtual bool CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target,
                                             RequestOrigin origin,
                                             const char* remoteIp,
                                             const char* username,
--- a/Core/HttpServer/FilesystemHttpHandler.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/HttpServer/FilesystemHttpHandler.h	Mon Mar 02 15:42:17 2020 +0100
@@ -53,7 +53,7 @@
     FilesystemHttpHandler(const std::string& baseUri,
                           const std::string& root);
 
-    virtual bool CreateChunkedRequestReader(std::auto_ptr<IChunkedRequestReader>& target,
+    virtual bool CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target,
                                             RequestOrigin origin,
                                             const char* remoteIp,
                                             const char* username,
--- a/Core/HttpServer/HttpContentNegociation.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/HttpServer/HttpContentNegociation.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -170,18 +170,22 @@
   }
 
 
-  void HttpContentNegociation::SelectBestMatch(std::auto_ptr<Reference>& best,
+  void HttpContentNegociation::SelectBestMatch(std::unique_ptr<Reference>& best,
                                                const Handler& handler,
                                                const std::string& type,
                                                const std::string& subtype,
                                                float quality)
   {
-    std::auto_ptr<Reference> match(new Reference(handler, type, subtype, quality));
+    std::unique_ptr<Reference> match(new Reference(handler, type, subtype, quality));
 
     if (best.get() == NULL ||
         *best < *match)
     {
-      best = match;
+#if __cplusplus < 201103L
+      best.reset(match.release());
+#else
+      best = std::move(match);
+#endif
     }
   }
 
@@ -227,7 +231,7 @@
     Tokens mediaRanges;
     Toolbox::TokenizeString(mediaRanges, accept, ',');
 
-    std::auto_ptr<Reference> bestMatch;
+    std::unique_ptr<Reference> bestMatch;
 
     for (Tokens::const_iterator it = mediaRanges.begin();
          it != mediaRanges.end(); ++it)
--- a/Core/HttpServer/HttpContentNegociation.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/HttpServer/HttpContentNegociation.h	Mon Mar 02 15:42:17 2020 +0100
@@ -32,6 +32,8 @@
 
 #pragma once
 
+#include "../Compatibility.h"
+
 #include <memory>
 #include <boost/noncopyable.hpp>
 #include <map>
@@ -95,7 +97,7 @@
 
     static float GetQuality(const Tokens& parameters);
 
-    static void SelectBestMatch(std::auto_ptr<Reference>& best,
+    static void SelectBestMatch(std::unique_ptr<Reference>& best,
                                 const Handler& handler,
                                 const std::string& type,
                                 const std::string& subtype,
--- a/Core/HttpServer/HttpServer.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/HttpServer/HttpServer.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -853,7 +853,7 @@
 
       if (!isMultipartForm)
       {
-        std::auto_ptr<IHttpHandler::IChunkedRequestReader> stream;
+        std::unique_ptr<IHttpHandler::IChunkedRequestReader> stream;
 
         if (server.HasHandler())
         {
--- a/Core/HttpServer/HttpStreamTranscoder.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/HttpServer/HttpStreamTranscoder.h	Mon Mar 02 15:42:17 2020 +0100
@@ -35,7 +35,9 @@
 
 #include "BufferHttpSender.h"
 
-#include <memory>  // For std::auto_ptr
+#include "../Compatibility.h"
+
+#include <memory>  // For std::unique_ptr
 
 namespace Orthanc
 {
@@ -49,7 +51,7 @@
     uint64_t           currentChunkOffset_;
     bool               ready_;
 
-    std::auto_ptr<BufferHttpSender>  uncompressed_;
+    std::unique_ptr<BufferHttpSender>  uncompressed_;
 
     void ReadSource(std::string& buffer);
 
--- a/Core/HttpServer/IHttpHandler.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/HttpServer/IHttpHandler.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../Compatibility.h"
 #include "../Toolbox.h"
 #include "HttpOutput.h"
 
@@ -73,7 +74,7 @@
      * This function allows to deal with chunked transfers (new in
      * Orthanc 1.5.7). It is only called if "method" is POST or PUT.
      **/
-    virtual bool CreateChunkedRequestReader(std::auto_ptr<IChunkedRequestReader>& target,
+    virtual bool CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target,
                                             RequestOrigin origin,
                                             const char* remoteIp,
                                             const char* username,
--- a/Core/Images/Font.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Images/Font.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -103,7 +103,7 @@
         throw OrthancException(ErrorCode_BadFont);
       }
 
-      std::auto_ptr<Character> c(new Character);
+      std::unique_ptr<Character> c(new Character);
       
       c->advance_ = info["Advance"].asUInt();
       c->height_ = info["Height"].asUInt();
@@ -407,7 +407,7 @@
     unsigned int width, height;
     ComputeTextExtent(width, height, utf8);
     
-    std::auto_ptr<ImageAccessor>  target(new Image(format, width, height, false));
+    std::unique_ptr<ImageAccessor>  target(new Image(format, width, height, false));
     ImageProcessing::Set(*target, 0, 0, 0, 255);
     Draw(*target, utf8, 0, 0, r, g, b);
 
@@ -420,7 +420,7 @@
     unsigned int width, height;
     ComputeTextExtent(width, height, utf8);
 
-    std::auto_ptr<ImageAccessor>  target(new Image(PixelFormat_Grayscale8, width, height, false));
+    std::unique_ptr<ImageAccessor>  target(new Image(PixelFormat_Grayscale8, width, height, false));
     ImageProcessing::Set(*target, 0);
     Draw(*target, utf8, 0, 0, 255);
 
--- a/Core/Images/FontRegistry.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Images/FontRegistry.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -51,7 +51,7 @@
 
   void FontRegistry::AddFromMemory(const std::string& font)
   {
-    std::auto_ptr<Font> f(new Font);
+    std::unique_ptr<Font> f(new Font);
     f->LoadFromMemory(font);
     fonts_.push_back(f.release());
   }
@@ -60,7 +60,7 @@
 #if ORTHANC_SANDBOXED == 0
   void FontRegistry::AddFromFile(const std::string& path)
   {
-    std::auto_ptr<Font> f(new Font);
+    std::unique_ptr<Font> f(new Font);
     f->LoadFromFile(path);
     fonts_.push_back(f.release());
   }
--- a/Core/Images/Image.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Images/Image.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #include "Image.h"
 
+#include "../Compatibility.h"
 #include "ImageProcessing.h"
 
 #include <memory>
@@ -54,7 +55,7 @@
 
   Image* Image::Clone(const ImageAccessor& source)
   {
-    std::auto_ptr<Image> target(new Image(source.GetFormat(), source.GetWidth(), source.GetHeight(), false));
+    std::unique_ptr<Image> target(new Image(source.GetFormat(), source.GetWidth(), source.GetHeight(), false));
     ImageProcessing::Copy(*target, source);
     return target.release();
   }
--- a/Core/Images/ImageProcessing.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Images/ImageProcessing.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -2058,8 +2058,8 @@
   ImageAccessor* ImageProcessing::Halve(const ImageAccessor& source,
                                         bool forceMinimalPitch)
   {
-    std::auto_ptr<Image> target(new Image(source.GetFormat(), source.GetWidth() / 2,
-                                          source.GetHeight() / 2, forceMinimalPitch));
+    std::unique_ptr<Image> target(new Image(source.GetFormat(), source.GetWidth() / 2,
+                                            source.GetHeight() / 2, forceMinimalPitch));
     Resize(*target, source);
     return target.release();
   }
@@ -2459,7 +2459,7 @@
                                           unsigned int width,
                                           unsigned int height)
   {
-    std::auto_ptr<ImageAccessor> target(new Image(source.GetFormat(), width, height, false));
+    std::unique_ptr<ImageAccessor> target(new Image(source.GetFormat(), width, height, false));
     FitSize(*target, source);
     return target.release();
   }
--- a/Core/JobsEngine/JobsEngine.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/JobsEngine/JobsEngine.h	Mon Mar 02 15:42:17 2020 +0100
@@ -35,6 +35,8 @@
 
 #include "JobsRegistry.h"
 
+#include "../Compatibility.h"
+
 #include <boost/thread.hpp>
 
 namespace Orthanc
@@ -52,7 +54,7 @@
 
     boost::mutex                 stateMutex_;
     State                        state_;
-    std::auto_ptr<JobsRegistry>  registry_;
+    std::unique_ptr<JobsRegistry>  registry_;
     boost::thread                retryHandler_;
     unsigned int                 threadSleep_;
     std::vector<boost::thread*>  workers_;
--- a/Core/JobsEngine/JobsRegistry.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/JobsEngine/JobsRegistry.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -58,7 +58,7 @@
     std::string                       id_;
     JobState                          state_;
     std::string                       jobType_;
-    std::auto_ptr<IJob>               job_;
+    std::unique_ptr<IJob>             job_;
     int                               priority_;  // "+inf()" means highest priority
     boost::posix_time::ptime          creationTime_;
     boost::posix_time::ptime          lastStateChangeTime_;
@@ -669,7 +669,7 @@
       throw OrthancException(ErrorCode_NullPointer);
     }
     
-    std::auto_ptr<JobHandler>  protection(handler);
+    std::unique_ptr<JobHandler>  protection(handler);
 
     {
       boost::mutex::scoped_lock lock(mutex_);
@@ -1396,7 +1396,7 @@
     for (Json::Value::Members::const_iterator it = members.begin();
          it != members.end(); ++it)
     {
-      std::auto_ptr<JobHandler> job;
+      std::unique_ptr<JobHandler> job;
 
       try
       {
--- a/Core/JobsEngine/Operations/JobOperationValues.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/JobsEngine/Operations/JobOperationValues.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -129,7 +129,7 @@
       throw OrthancException(ErrorCode_BadFileFormat);
     }
 
-    std::auto_ptr<JobOperationValues> result(new JobOperationValues);
+    std::unique_ptr<JobOperationValues> result(new JobOperationValues);
 
     result->Reserve(source.size());
     
--- a/Core/JobsEngine/Operations/SequenceOfOperationsJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/JobsEngine/Operations/SequenceOfOperationsJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -56,12 +56,12 @@
   class SequenceOfOperationsJob::Operation : public boost::noncopyable
   {
   private:
-    size_t                             index_;
-    std::auto_ptr<IJobOperation>       operation_;
-    std::auto_ptr<JobOperationValues>  originalInputs_;
-    std::auto_ptr<JobOperationValues>  workInputs_;
-    std::list<Operation*>              nextOperations_;
-    size_t                             currentInput_;
+    size_t                               index_;
+    std::unique_ptr<IJobOperation>       operation_;
+    std::unique_ptr<JobOperationValues>  originalInputs_;
+    std::unique_ptr<JobOperationValues>  workInputs_;
+    std::list<Operation*>                nextOperations_;
+    size_t                               currentInput_;
 
   public:
     Operation(size_t index,
--- a/Core/JobsEngine/SetOfCommandsJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/JobsEngine/SetOfCommandsJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -250,7 +250,7 @@
                                      const Json::Value& source) :
     started_(false)
   {
-    std::auto_ptr<ICommandUnserializer> raii(unserializer);
+    std::unique_ptr<ICommandUnserializer> raii(unserializer);
 
     permissive_ = SerializationToolbox::ReadBoolean(source, KEY_PERMISSIVE);
     position_ = SerializationToolbox::ReadUnsignedInteger(source, KEY_POSITION);
--- a/Core/Logging.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Logging.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -315,6 +315,7 @@
  * behavior from Google Log.
  *********************************************************/
 
+#include "Compatibility.h"
 #include "OrthancException.h"
 #include "Enumerations.h"
 #include "Toolbox.h"
@@ -344,7 +345,7 @@
     std::ostream* warning_;
     std::ostream* info_;
 
-    std::auto_ptr<std::ofstream> file_;
+    std::unique_ptr<std::ofstream> file_;
 
     LoggingContext() : 
       infoEnabled_(false),
@@ -372,7 +373,7 @@
 
 
 
-static std::auto_ptr<LoggingContext> loggingContext_;
+static std::unique_ptr<LoggingContext> loggingContext_;
 static boost::mutex  loggingMutex_;
 
 
@@ -424,7 +425,7 @@
     }
 
 
-    static void PrepareLogFolder(std::auto_ptr<std::ofstream>& file,
+    static void PrepareLogFolder(std::unique_ptr<std::ofstream>& file,
                                  const std::string& suffix,
                                  const std::string& directory)
     {
@@ -455,7 +456,7 @@
     void Reset()
     {
       // Recover the old logging context
-      std::auto_ptr<LoggingContext> old;
+      std::unique_ptr<LoggingContext> old;
 
       {
         boost::mutex::scoped_lock lock(loggingMutex_);
@@ -465,7 +466,11 @@
         }
         else
         {
-          old = loggingContext_;
+#if __cplusplus < 201103L
+          old.reset(loggingContext_.release());
+#else
+          old = std::move(loggingContext_);
+#endif
 
           // Create a new logging context, 
           loggingContext_.reset(new LoggingContext);
@@ -512,7 +517,7 @@
       if (!memento->valid_)
         throw std::runtime_error("Memento already used");
       memento->valid_ = false;
-      std::auto_ptr<LoggingMementoImpl> deleter(memento);
+      std::unique_ptr<LoggingMementoImpl> deleter(memento);
       {
         boost::mutex::scoped_lock lock(loggingMutex_);
         loggingContext_.reset(new LoggingContext);
@@ -584,7 +589,7 @@
     }
 
 
-    static void CheckFile(std::auto_ptr<std::ofstream>& f)
+    static void CheckFile(std::unique_ptr<std::ofstream>& f)
     {
       if (loggingContext_->file_.get() == NULL ||
           !loggingContext_->file_->is_open())
@@ -783,7 +788,14 @@
       std::ostream* infoStream)
     {
       boost::mutex::scoped_lock lock(loggingMutex_);
-      std::auto_ptr<LoggingContext> old = loggingContext_;
+      std::unique_ptr<LoggingContext> old;
+
+#if __cplusplus < 201103L
+      old.reset(loggingContext_.release());
+#else
+      old = std::move(loggingContext_);
+#endif
+      
       loggingContext_.reset(new LoggingContext);
       loggingContext_->error_ = errorStream;
       loggingContext_->warning_ = warningStream;
@@ -797,15 +809,15 @@
 
     FuncStreamBuf<decltype(emscripten_console_error)> 
       globalEmscriptenErrorStreamBuf(emscripten_console_error);
-    std::auto_ptr<std::ostream> globalEmscriptenErrorStream;
+    std::unique_ptr<std::ostream> globalEmscriptenErrorStream;
 
     FuncStreamBuf<decltype(emscripten_console_warn)>
       globalEmscriptenWarningStreamBuf(emscripten_console_warn);
-    std::auto_ptr<std::ostream> globalEmscriptenWarningStream;
+    std::unique_ptr<std::ostream> globalEmscriptenWarningStream;
 
     FuncStreamBuf<decltype(emscripten_console_log)>
       globalEmscriptenInfoStreamBuf(emscripten_console_log);
-    std::auto_ptr<std::ostream> globalEmscriptenInfoStream;
+    std::unique_ptr<std::ostream> globalEmscriptenInfoStream;
 
     void EnableEmscriptenLogging()
     {
--- a/Core/MetricsRegistry.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/MetricsRegistry.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,8 +34,9 @@
 #include "PrecompiledHeaders.h"
 #include "MetricsRegistry.h"
 
+#include "ChunkedBuffer.h"
+#include "Compatibility.h"
 #include "OrthancException.h"
-#include "ChunkedBuffer.h"
 
 namespace Orthanc
 {
@@ -228,7 +229,7 @@
 
     if (found == content_.end())
     {
-      std::auto_ptr<Item> item(new Item(type));
+      std::unique_ptr<Item> item(new Item(type));
       item->Update(value);
       content_[name] = item.release();
     }
--- a/Core/MultiThreading/RunnableWorkersPool.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/MultiThreading/RunnableWorkersPool.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -35,6 +35,7 @@
 #include "RunnableWorkersPool.h"
 
 #include "SharedMessageQueue.h"
+#include "../Compatibility.h"
 #include "../OrthancException.h"
 #include "../Logging.h"
 
@@ -55,7 +56,7 @@
         {
           try
           {
-            std::auto_ptr<IDynamicObject>  obj(that->queue_.Dequeue(100));
+            std::unique_ptr<IDynamicObject>  obj(that->queue_.Dequeue(100));
             if (obj.get() != NULL)
             {
               IRunnableBySteps& runnable = *dynamic_cast<IRunnableBySteps*>(obj.get());
--- a/Core/MultiThreading/SharedMessageQueue.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/MultiThreading/SharedMessageQueue.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -35,6 +35,8 @@
 #include "SharedMessageQueue.h"
 
 
+#include "../Compatibility.h"
+
 
 /**
  * FIFO (queue):
@@ -137,7 +139,7 @@
       }
     }
 
-    std::auto_ptr<IDynamicObject> message(queue_.front());
+    std::unique_ptr<IDynamicObject> message(queue_.front());
     queue_.pop_front();
 
     if (queue_.empty())
@@ -199,7 +201,7 @@
     {
       while (!queue_.empty())
       {
-        std::auto_ptr<IDynamicObject> message(queue_.front());
+        std::unique_ptr<IDynamicObject> message(queue_.front());
         queue_.pop_front();
       }
 
--- a/Core/OrthancException.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/OrthancException.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "Compatibility.h"
 #include "Enumerations.h"
 #include "Logging.h"
 
@@ -53,7 +54,7 @@
     HttpStatus httpStatus_;
 
     // New in Orthanc 1.5.0
-    std::auto_ptr<std::string>  details_;
+    std::unique_ptr<std::string>  details_;
     
   public:
     OrthancException(const OrthancException& other) : 
--- a/Core/PrecompiledHeaders.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/PrecompiledHeaders.h	Mon Mar 02 15:42:17 2020 +0100
@@ -39,11 +39,11 @@
 
 #if ORTHANC_USE_PRECOMPILED_HEADERS == 1
 
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/filesystem.hpp>
+//#include <boost/date_time/posix_time/posix_time.hpp>
+//#include <boost/filesystem.hpp>
 #include <boost/lexical_cast.hpp>
-#include <boost/locale.hpp>
-#include <boost/regex.hpp>
+//#include <boost/locale.hpp>
+//#include <boost/regex.hpp>
 #include <boost/thread.hpp>
 #include <boost/thread/shared_mutex.hpp>
 
@@ -53,6 +53,7 @@
 #  include <pugixml.hpp>
 #endif
 
+#include "../Core/Compatibility.h"
 #include "Enumerations.h"
 #include "Logging.h"
 #include "OrthancException.h"
--- a/Core/RestApi/RestApi.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/RestApi/RestApi.h	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #pragma once
 
 #include "RestApiHierarchy.h"
+#include "../Compatibility.h"
 
 #include <list>
 
@@ -47,7 +48,7 @@
   public:
     static void AutoListChildren(RestApiGetCall& call);
 
-    virtual bool CreateChunkedRequestReader(std::auto_ptr<IChunkedRequestReader>& target,
+    virtual bool CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target,
                                             RequestOrigin origin,
                                             const char* remoteIp,
                                             const char* username,
--- a/Core/Toolbox.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Core/Toolbox.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "PrecompiledHeaders.h"
 #include "Toolbox.h"
 
+#include "Compatibility.h"
 #include "OrthancException.h"
 #include "Logging.h"
 
@@ -1434,7 +1435,7 @@
 
 
 #if ORTHANC_ENABLE_LOCALE == 1
-  static std::auto_ptr<std::locale>  globalLocale_;
+  static std::unique_ptr<std::locale>  globalLocale_;
 
   static bool SetGlobalLocale(const char* locale)
   {
--- a/OrthancServer/Database/Compatibility/SetOfResources.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/Database/Compatibility/SetOfResources.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -55,7 +55,7 @@
       }
       else
       {
-        std::auto_ptr<Resources> filtered(new Resources);
+        std::unique_ptr<Resources> filtered(new Resources);
 
         for (std::list<int64_t>::const_iterator
                it = resources.begin(); it != resources.end(); ++it)
@@ -66,7 +66,11 @@
           }
         }
 
-        resources_ = filtered;
+#if __cplusplus < 201103L
+        resources_.reset(filtered.release());
+#else
+        resources_ = std::move(filtered);
+#endif
       }
     }
 
@@ -80,7 +84,7 @@
 
       if (resources_.get() != NULL)
       {
-        std::auto_ptr<Resources> children(new Resources);
+        std::unique_ptr<Resources> children(new Resources);
 
         for (Resources::const_iterator it = resources_->begin(); 
              it != resources_->end(); ++it)
@@ -95,7 +99,11 @@
           }
         }
 
-        resources_ = children;
+#if __cplusplus < 201103L
+        resources_.reset(children.release());
+#else
+        resources_ = std::move(children);
+#endif
       }
 
       switch (level_)
--- a/OrthancServer/Database/Compatibility/SetOfResources.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/Database/Compatibility/SetOfResources.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../../Core/Compatibility.h"
 #include "../IDatabaseWrapper.h"
 #include "ILookupResources.h"
 
@@ -48,9 +49,9 @@
     private:
       typedef std::set<int64_t>  Resources;
 
-      IDatabaseWrapper&         database_;
-      ResourceType              level_;
-      std::auto_ptr<Resources>  resources_;
+      IDatabaseWrapper&           database_;
+      ResourceType                level_;
+      std::unique_ptr<Resources>  resources_;
     
     public:
       SetOfResources(IDatabaseWrapper& database,
--- a/OrthancServer/Database/SQLiteDatabaseWrapper.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/Database/SQLiteDatabaseWrapper.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -583,9 +583,9 @@
   class SQLiteDatabaseWrapper::Transaction : public IDatabaseWrapper::ITransaction
   {
   private:
-    SQLiteDatabaseWrapper&              that_;
-    std::auto_ptr<SQLite::Transaction>  transaction_;
-    int64_t                             initialDiskSize_;
+    SQLiteDatabaseWrapper&                that_;
+    std::unique_ptr<SQLite::Transaction>  transaction_;
+    int64_t                               initialDiskSize_;
 
   public:
     Transaction(SQLiteDatabaseWrapper& that) :
@@ -1181,7 +1181,7 @@
     resourcesId.clear();
     instancesId.clear();
     
-    std::auto_ptr<SQLite::Statement> statement;
+    std::unique_ptr<SQLite::Statement> statement;
     
     switch (level)
     {
--- a/OrthancServer/DicomInstanceToStore.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/DicomInstanceToStore.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -157,7 +157,7 @@
     MetadataMap                          metadata_;
 
   private:
-    std::auto_ptr<DicomInstanceHasher>  hasher_;
+    std::unique_ptr<DicomInstanceHasher>  hasher_;
 
     void ComputeMissingInformation()
     {
--- a/OrthancServer/LuaScripting.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/LuaScripting.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -610,7 +610,7 @@
 
     if (operation == "modify")
     {
-      std::auto_ptr<DicomModification> modification(new DicomModification);
+      std::unique_ptr<DicomModification> modification(new DicomModification);
       modification->ParseModifyRequest(parameters);
 
       return lock.AddModifyInstanceOperation(context_, modification.release());
@@ -749,7 +749,7 @@
   {
     for (;;)
     {
-      std::auto_ptr<IDynamicObject> event(that->pendingEvents_.Dequeue(100));
+      std::unique_ptr<IDynamicObject> event(that->pendingEvents_.Dequeue(100));
 
       if (event.get() == NULL)
       {
--- a/OrthancServer/OrthancFindRequestHandler.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancFindRequestHandler.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -273,7 +273,7 @@
       throw OrthancException(ErrorCode_UnknownResource);  // The resource was deleted in between
     }
 
-    std::auto_ptr<DicomMap> result(new DicomMap);
+    std::unique_ptr<DicomMap> result(new DicomMap);
 
     switch (level)
     {
@@ -537,7 +537,7 @@
                        const DicomMap& mainDicomTags,
                        const Json::Value* dicomAsJson) 
     {
-      std::auto_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_));
+      std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_));
 
       AddAnswer(answers_, mainDicomTags, dicomAsJson,
                 queryAsArray_, sequencesToReturn_, counters.get());
--- a/OrthancServer/OrthancHttpHandler.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancHttpHandler.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -40,7 +40,7 @@
 namespace Orthanc
 {
   bool OrthancHttpHandler::CreateChunkedRequestReader(
-    std::auto_ptr<IHttpHandler::IChunkedRequestReader>& target,
+    std::unique_ptr<IHttpHandler::IChunkedRequestReader>& target,
     RequestOrigin origin,
     const char* remoteIp,
     const char* username,
--- a/OrthancServer/OrthancHttpHandler.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancHttpHandler.h	Mon Mar 02 15:42:17 2020 +0100
@@ -50,7 +50,7 @@
     {
     }
 
-    virtual bool CreateChunkedRequestReader(std::auto_ptr<IChunkedRequestReader>& target,
+    virtual bool CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target,
                                             RequestOrigin origin,
                                             const char* remoteIp,
                                             const char* username,
--- a/OrthancServer/OrthancMoveRequestHandler.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancMoveRequestHandler.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -59,7 +59,7 @@
       RemoteModalityParameters remote_;
       std::string originatorAet_;
       uint16_t originatorId_;
-      std::auto_ptr<DicomUserConnection> connection_;
+      std::unique_ptr<DicomUserConnection> connection_;
 
     public:
       SynchronousMove(ServerContext& context,
@@ -126,10 +126,10 @@
     class AsynchronousMove : public IMoveRequestIterator
     {
     private:
-      ServerContext&                        context_;
-      std::auto_ptr<DicomModalityStoreJob>  job_;
-      size_t                                position_;
-      size_t                                countInstances_;
+      ServerContext&                          context_;
+      std::unique_ptr<DicomModalityStoreJob>  job_;
+      size_t                                  position_;
+      size_t                                  countInstances_;
       
     public:
       AsynchronousMove(ServerContext& context,
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -116,7 +116,7 @@
   {
     std::string id = call.GetUriComponent("id", "");
 
-    std::auto_ptr<ParsedDicomFile> modified;
+    std::unique_ptr<ParsedDicomFile> modified;
 
     {
       ServerContext::DicomCacheLocker locker(OrthancRestApi::GetContext(call), id);
@@ -169,7 +169,7 @@
   }
 
 
-  static void SubmitModificationJob(std::auto_ptr<DicomModification>& modification,
+  static void SubmitModificationJob(std::unique_ptr<DicomModification>& modification,
                                     bool isAnonymization,
                                     RestApiPostCall& call,
                                     const Json::Value& body,
@@ -177,7 +177,7 @@
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
-    std::auto_ptr<ResourceModificationJob> job(new ResourceModificationJob(context));
+    std::unique_ptr<ResourceModificationJob> job(new ResourceModificationJob(context));
     
     job->SetModification(modification.release(), level, isAnonymization);
     job->SetOrigin(call);
@@ -192,7 +192,7 @@
   template <enum ResourceType resourceType>
   static void ModifyResource(RestApiPostCall& call)
   {
-    std::auto_ptr<DicomModification> modification(new DicomModification);
+    std::unique_ptr<DicomModification> modification(new DicomModification);
 
     Json::Value body;
     ParseModifyRequest(body, *modification, call);
@@ -207,7 +207,7 @@
   template <enum ResourceType resourceType>
   static void AnonymizeResource(RestApiPostCall& call)
   {
-    std::auto_ptr<DicomModification> modification(new DicomModification);
+    std::unique_ptr<DicomModification> modification(new DicomModification);
 
     Json::Value body;
     ParseAnonymizationRequest(body, *modification, call);
@@ -343,7 +343,7 @@
     {
       for (Json::ArrayIndex i = 0; i < content.size(); i++)
       {
-        std::auto_ptr<ParsedDicomFile> dicom(base.Clone(false));
+        std::unique_ptr<ParsedDicomFile> dicom(base.Clone(false));
         const Json::Value* payload = NULL;
 
         if (content[i].type() == Json::stringValue)
@@ -668,7 +668,7 @@
 
     const std::string study = call.GetUriComponent("id", "");
 
-    std::auto_ptr<SplitStudyJob> job(new SplitStudyJob(context, study));    
+    std::unique_ptr<SplitStudyJob> job(new SplitStudyJob(context, study));    
     job->SetOrigin(call);
 
     std::vector<std::string> series;
@@ -751,7 +751,7 @@
 
     const std::string study = call.GetUriComponent("id", "");
 
-    std::auto_ptr<MergeStudyJob> job(new MergeStudyJob(context, study));    
+    std::unique_ptr<MergeStudyJob> job(new MergeStudyJob(context, study));    
     job->SetOrigin(call);
 
     std::vector<std::string> resources;
--- a/OrthancServer/OrthancRestApi/OrthancRestApi.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestApi.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -254,7 +254,7 @@
                                         bool synchronous,
                                         int priority)
   {
-    std::auto_ptr<IJob> raii(job);
+    std::unique_ptr<IJob> raii(job);
     
     if (job == NULL)
     {
@@ -290,7 +290,7 @@
                                         bool isDefaultSynchronous,
                                         const Json::Value& body) const
   {
-    std::auto_ptr<IJob> raii(job);
+    std::unique_ptr<IJob> raii(job);
 
     if (body.type() != Json::objectValue)
     {
@@ -309,7 +309,7 @@
                                          bool isDefaultSynchronous,
                                          const Json::Value& body) const
   {
-    std::auto_ptr<SetOfCommandsJob> raii(job);
+    std::unique_ptr<SetOfCommandsJob> raii(job);
     
     if (body.type() != Json::objectValue)
     {
--- a/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -123,7 +123,7 @@
 
   static void SubmitJob(RestApiOutput& output,
                         ServerContext& context,
-                        std::auto_ptr<ArchiveJob>& job,
+                        std::unique_ptr<ArchiveJob>& job,
                         int priority,
                         bool synchronous,
                         const std::string& filename)
@@ -179,7 +179,7 @@
       int priority;
       GetJobParameters(synchronous, extended, priority, body, DEFAULT_IS_EXTENDED);
       
-      std::auto_ptr<ArchiveJob> job(new ArchiveJob(context, IS_MEDIA, extended));
+      std::unique_ptr<ArchiveJob> job(new ArchiveJob(context, IS_MEDIA, extended));
       AddResourcesOfInterest(*job, body);
       SubmitJob(call.GetOutput(), context, job, priority, synchronous, "Archive.zip");
     }
@@ -209,7 +209,7 @@
       extended = false;
     }
     
-    std::auto_ptr<ArchiveJob> job(new ArchiveJob(context, IS_MEDIA, extended));
+    std::unique_ptr<ArchiveJob> job(new ArchiveJob(context, IS_MEDIA, extended));
     job->AddResource(id);
 
     SubmitJob(call.GetOutput(), context, job, 0 /* priority */,
@@ -232,7 +232,7 @@
       int priority;
       GetJobParameters(synchronous, extended, priority, body, DEFAULT_IS_EXTENDED);
       
-      std::auto_ptr<ArchiveJob> job(new ArchiveJob(context, IS_MEDIA, extended));
+      std::unique_ptr<ArchiveJob> job(new ArchiveJob(context, IS_MEDIA, extended));
       job->AddResource(id);
       SubmitJob(call.GetOutput(), context, job, priority, synchronous, id + ".zip");
     }
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -416,7 +416,7 @@
    ***************************************************************************/
 
   static void AnswerQueryHandler(RestApiPostCall& call,
-                                 std::auto_ptr<QueryRetrieveHandler>& handler)
+                                 std::unique_ptr<QueryRetrieveHandler>& handler)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -466,7 +466,7 @@
     }
     else
     {
-      std::auto_ptr<QueryRetrieveHandler>  handler(new QueryRetrieveHandler(context));
+      std::unique_ptr<QueryRetrieveHandler>  handler(new QueryRetrieveHandler(context));
       
       handler->SetModality(call.GetUriComponent("id", ""));
       handler->SetLevel(StringToResourceType(request[KEY_LEVEL].asCString()));
@@ -618,7 +618,7 @@
       call.BodyToString(targetAet);
     }
     
-    std::auto_ptr<DicomMoveScuJob> job(new DicomMoveScuJob(context));
+    std::unique_ptr<DicomMoveScuJob> job(new DicomMoveScuJob(context));
     
     {
       QueryAccessor query(call);
@@ -744,7 +744,7 @@
     
     ServerContext& context = OrthancRestApi::GetContext(call);
 
-    std::auto_ptr<QueryRetrieveHandler>  handler(new QueryRetrieveHandler(context));
+    std::unique_ptr<QueryRetrieveHandler>  handler(new QueryRetrieveHandler(context));
       
     {
       const QueryAccessor parent(call);
@@ -944,7 +944,7 @@
     std::string remote = call.GetUriComponent("id", "");
 
     Json::Value request;
-    std::auto_ptr<DicomModalityStoreJob> job(new DicomModalityStoreJob(context));
+    std::unique_ptr<DicomModalityStoreJob> job(new DicomModalityStoreJob(context));
 
     GetInstancesToExport(request, *job, remote, call);
 
@@ -1084,7 +1084,7 @@
     std::string remote = call.GetUriComponent("id", "");
 
     Json::Value request;
-    std::auto_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context));
+    std::unique_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context));
 
     GetInstancesToExport(request, *job, remote, call);
     
@@ -1276,7 +1276,7 @@
       const RemoteModalityParameters remote =
         MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
 
-      std::auto_ptr<ParsedDicomFile> query
+      std::unique_ptr<ParsedDicomFile> query
         (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(0),
                                          "" /* no private creator */));
 
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Mar 02 15:42:17 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);
--- a/OrthancServer/Search/DatabaseLookup.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/Search/DatabaseLookup.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -117,9 +117,9 @@
       }
 
       std::set<DicomTag> ignoreTagLength;
-      std::auto_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
-                                      (*element, DicomToJsonFlags_None, 
-                                       0, encoding, hasCodeExtensions, ignoreTagLength));
+      std::unique_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
+                                        (*element, DicomToJsonFlags_None, 
+                                         0, encoding, hasCodeExtensions, ignoreTagLength));
 
       // WARNING: Also modify "HierarchicalMatcher::Setup()" if modifying this code
       if (value.get() == NULL ||
@@ -185,7 +185,7 @@
         fixedTag = DICOM_TAG_MODALITY;
       }
 
-      std::auto_ptr<DicomTagConstraint> constraint
+      std::unique_ptr<DicomTagConstraint> constraint
         (new DicomTagConstraint(fixedTag, ConstraintType_List, caseSensitive, mandatoryTag));
 
       std::vector<std::string> items;
--- a/OrthancServer/Search/HierarchicalMatcher.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/Search/HierarchicalMatcher.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -123,9 +123,9 @@
         flatTags_.insert(tag);
 
         std::set<DicomTag> ignoreTagLength;
-        std::auto_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
-                                        (*element, DicomToJsonFlags_None, 
-                                         0, encoding, hasCodeExtensions, ignoreTagLength));
+        std::unique_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
+                                          (*element, DicomToJsonFlags_None, 
+                                           0, encoding, hasCodeExtensions, ignoreTagLength));
 
         // WARNING: Also modify "DatabaseLookup::IsMatch()" if modifying this code
         if (value.get() == NULL ||
@@ -257,7 +257,7 @@
                                                    Encoding encoding,
                                                    bool hasCodeExtensions) const
   {
-    std::auto_ptr<DcmDataset> target(new DcmDataset);
+    std::unique_ptr<DcmDataset> target(new DcmDataset);
 
     for (std::set<DicomTag>::const_iterator it = flatTags_.begin();
          it != flatTags_.end(); ++it)
@@ -274,7 +274,7 @@
                                  "Not applicable to private tags: " + it->Format());
         }
         
-        std::auto_ptr<DcmElement> cloned(FromDcmtkBridge::CreateElementForTag(*it, "" /* no private creator */));
+        std::unique_ptr<DcmElement> cloned(FromDcmtkBridge::CreateElementForTag(*it, "" /* no private creator */));
         cloned->copyFrom(*element);
         target->insert(cloned.release());
       }
@@ -289,7 +289,7 @@
       if (source.findAndGetSequence(tag, sequence).good() &&
           sequence != NULL)
       {
-        std::auto_ptr<DcmSequenceOfItems> cloned(new DcmSequenceOfItems(tag));
+        std::unique_ptr<DcmSequenceOfItems> cloned(new DcmSequenceOfItems(tag));
 
         for (unsigned long i = 0; i < sequence->card(); i++)
         {
@@ -303,7 +303,7 @@
             // "DcmItem" object before it can be included in a
             // sequence. Otherwise, "dciodvfy" reports an error "Bad
             // tag in sequence - Expecting Item or Sequence Delimiter."
-            std::auto_ptr<DcmDataset> child(it->second->ExtractInternal(*sequence->getItem(i), encoding, hasCodeExtensions));
+            std::unique_ptr<DcmDataset> child(it->second->ExtractInternal(*sequence->getItem(i), encoding, hasCodeExtensions));
             cloned->append(new DcmItem(*child));
           }
         }
@@ -321,10 +321,10 @@
     bool hasCodeExtensions;
     Encoding encoding = dicom.DetectEncoding(hasCodeExtensions);
     
-    std::auto_ptr<DcmDataset> dataset(ExtractInternal(*dicom.GetDcmtkObject().getDataset(),
-                                                      encoding, hasCodeExtensions));
+    std::unique_ptr<DcmDataset> dataset(ExtractInternal(*dicom.GetDcmtkObject().getDataset(),
+                                                        encoding, hasCodeExtensions));
 
-    std::auto_ptr<ParsedDicomFile> result(new ParsedDicomFile(*dataset));
+    std::unique_ptr<ParsedDicomFile> result(new ParsedDicomFile(*dataset));
     result->SetEncoding(encoding);
 
     return result.release();
--- a/OrthancServer/ServerContext.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerContext.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -75,7 +75,7 @@
   {
     while (!that->done_)
     {
-      std::auto_ptr<IDynamicObject> obj(that->pendingChanges_.Dequeue(sleepDelay));
+      std::unique_ptr<IDynamicObject> obj(that->pendingChanges_.Dequeue(sleepDelay));
         
       if (obj.get() != NULL)
       {
@@ -664,7 +664,7 @@
     lock_(that_.dicomCacheMutex_)
   {
 #if ENABLE_DICOM_CACHE == 0
-    static std::auto_ptr<IDynamicObject> p;
+    static std::unique_ptr<IDynamicObject> p;
     p.reset(provider_.Provide(instancePublicId));
     dicom_ = dynamic_cast<ParsedDicomFile*>(p.get());
 #else
@@ -833,7 +833,7 @@
       // Optimization in Orthanc 1.5.1 - Don't read the full JSON from
       // the disk if only "main DICOM tags" are to be returned
 
-      std::auto_ptr<Json::Value> dicomAsJson;
+      std::unique_ptr<Json::Value> dicomAsJson;
 
       bool hasOnlyMainDicomTags;
       DicomMap dicom;
--- a/OrthancServer/ServerContext.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerContext.h	Mon Mar 02 15:42:17 2020 +0100
@@ -186,7 +186,7 @@
     LuaScripting mainLua_;
     LuaScripting filterLua_;
     LuaServerListener  luaListener_;
-    std::auto_ptr<SharedArchive>  mediaArchive_;
+    std::unique_ptr<SharedArchive>  mediaArchive_;
     
     // The "JobsEngine" must be *after* "LuaScripting", as
     // "LuaScripting" embeds "LuaJobManager" that registers as an
@@ -209,7 +209,7 @@
     boost::thread  changeThread_;
     boost::thread  saveJobsThread_;
         
-    std::auto_ptr<SharedArchive>  queryRetrieveArchive_;
+    std::unique_ptr<SharedArchive>  queryRetrieveArchive_;
     std::string defaultLocalAet_;
     OrthancHttpHandler  httpHandler_;
     bool saveJobs_;
@@ -217,7 +217,7 @@
     unsigned int limitFindInstances_;
     unsigned int limitFindResults_;
 
-    std::auto_ptr<MetricsRegistry>  metricsRegistry_;
+    std::unique_ptr<MetricsRegistry>  metricsRegistry_;
     bool isHttpServerSecure_;
     bool isExecuteLuaEnabled_;
 
--- a/OrthancServer/ServerIndex.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerIndex.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -241,7 +241,7 @@
   {
   private:
     ServerIndex& index_;
-    std::auto_ptr<IDatabaseWrapper::ITransaction> transaction_;
+    std::unique_ptr<IDatabaseWrapper::ITransaction> transaction_;
     bool isCommitted_;
 
   public:
--- a/OrthancServer/ServerIndex.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerIndex.h	Mon Mar 02 15:42:17 2020 +0100
@@ -65,14 +65,14 @@
     boost::thread flushThread_;
     boost::thread unstableResourcesMonitorThread_;
 
-    std::auto_ptr<Listener> listener_;
+    std::unique_ptr<Listener> listener_;
     IDatabaseWrapper& db_;
     LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload>  unstableResources_;
 
     uint64_t     maximumStorageSize_;
     unsigned int maximumPatients_;
     bool         overwrite_;
-    std::auto_ptr<MainDicomTagsRegistry>  mainDicomTagsRegistry_;
+    std::unique_ptr<MainDicomTagsRegistry>  mainDicomTagsRegistry_;
 
     static void FlushThread(ServerIndex* that,
                             unsigned int threadSleep);
--- a/OrthancServer/ServerJobs/ArchiveJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/ArchiveJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -276,7 +276,7 @@
       else if (previous == resources_.end())
       {
         // This is the first time we meet this resource
-        std::auto_ptr<ArchiveIndex> child(new ArchiveIndex(GetChildResourceType(level_)));
+        std::unique_ptr<ArchiveIndex> child(new ArchiveIndex(GetChildResourceType(level_)));
         child->Add(index, resource);
         resources_[id] = child.release();
       }
@@ -308,7 +308,7 @@
           std::list<std::string> children;
           index.GetChildren(children, it->first);
 
-          std::auto_ptr<ArchiveIndex> child(new ArchiveIndex(GetChildResourceType(level_)));
+          std::unique_ptr<ArchiveIndex> child(new ArchiveIndex(GetChildResourceType(level_)));
 
           for (std::list<std::string>::const_iterator 
                  it2 = children.begin(); it2 != children.end(); ++it2)
@@ -695,12 +695,12 @@
   class ArchiveJob::ZipWriterIterator : public boost::noncopyable
   {
   private:
-    TemporaryFile&                        target_;
-    ServerContext&                        context_;
-    ZipCommands                           commands_;
-    std::auto_ptr<HierarchicalZipWriter>  zip_;
-    std::auto_ptr<DicomDirWriter>         dicomDir_;
-    bool                                  isMedia_;
+    TemporaryFile&                          target_;
+    ServerContext&                          context_;
+    ZipCommands                             commands_;
+    std::unique_ptr<HierarchicalZipWriter>  zip_;
+    std::unique_ptr<DicomDirWriter>         dicomDir_;
+    bool                                    isMedia_;
 
   public:
     ZipWriterIterator(TemporaryFile& target,
@@ -902,7 +902,7 @@
     class DynamicTemporaryFile : public IDynamicObject
     {
     private:
-      std::auto_ptr<TemporaryFile>   file_;
+      std::unique_ptr<TemporaryFile>   file_;
 
     public:
       DynamicTemporaryFile(TemporaryFile* f) : file_(f)
--- a/OrthancServer/ServerJobs/ArchiveJob.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/ArchiveJob.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../Core/Compatibility.h"
 #include "../../Core/JobsEngine/IJob.h"
 #include "../../Core/TemporaryFile.h"
 
@@ -55,7 +56,7 @@
     class ZipWriterIterator;
     
     boost::shared_ptr<TemporaryFile>      synchronousTarget_;
-    std::auto_ptr<TemporaryFile>          asynchronousTarget_;
+    std::unique_ptr<TemporaryFile>        asynchronousTarget_;
     ServerContext&                        context_;
     boost::shared_ptr<ArchiveIndex>       archive_;
     bool                                  isMedia_;
--- a/OrthancServer/ServerJobs/DicomModalityStoreJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/DicomModalityStoreJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "../PrecompiledHeadersServer.h"
 #include "DicomModalityStoreJob.h"
 
+#include "../../Core/Compatibility.h"
 #include "../../Core/Logging.h"
 #include "../../Core/SerializationToolbox.h"
 #include "../ServerContext.h"
--- a/OrthancServer/ServerJobs/DicomModalityStoreJob.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/DicomModalityStoreJob.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../Core/Compatibility.h"
 #include "../../Core/JobsEngine/SetOfInstancesJob.h"
 #include "../../Core/DicomNetworking/DicomUserConnection.h"
 
@@ -43,12 +44,12 @@
   class DicomModalityStoreJob : public SetOfInstancesJob
   {
   private:
-    ServerContext&                      context_;
-    std::string                         localAet_;
-    RemoteModalityParameters            remote_;
-    std::string                         moveOriginatorAet_;
-    uint16_t                            moveOriginatorId_;
-    std::auto_ptr<DicomUserConnection>  connection_;
+    ServerContext&                        context_;
+    std::string                           localAet_;
+    RemoteModalityParameters              remote_;
+    std::string                           moveOriginatorAet_;
+    uint16_t                              moveOriginatorId_;
+    std::unique_ptr<DicomUserConnection>  connection_;
 
     void OpenConnection();
 
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/DicomMoveScuJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -46,8 +46,8 @@
   class DicomMoveScuJob::Command : public SetOfCommandsJob::ICommand
   {
   private:
-    DicomMoveScuJob&         that_;
-    std::auto_ptr<DicomMap>  findAnswer_;
+    DicomMoveScuJob&           that_;
+    std::unique_ptr<DicomMap>  findAnswer_;
 
   public:
     Command(DicomMoveScuJob& that,
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/DicomMoveScuJob.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../Core/Compatibility.h"
 #include "../../Core/JobsEngine/SetOfCommandsJob.h"
 #include "../../Core/DicomNetworking/DicomUserConnection.h"
 
@@ -48,12 +49,12 @@
     class Command;
     class Unserializer;
     
-    ServerContext&                      context_;
-    std::string                         localAet_;
-    std::string                         targetAet_;
-    RemoteModalityParameters            remote_;
-    std::auto_ptr<DicomUserConnection>  connection_;
-    Json::Value                         query_;
+    ServerContext&                        context_;
+    std::string                           localAet_;
+    std::string                           targetAet_;
+    RemoteModalityParameters              remote_;
+    std::unique_ptr<DicomUserConnection>  connection_;
+    Json::Value                           query_;
 
     void Retrieve(const DicomMap& findAnswer);
     
--- a/OrthancServer/ServerJobs/LuaJobManager.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/LuaJobManager.h	Mon Mar 02 15:42:17 2020 +0100
@@ -69,11 +69,11 @@
     class Lock : public boost::noncopyable
     {
     private:
-      LuaJobManager&                                that_;
-      boost::mutex::scoped_lock                     lock_;
-      JobsEngine&                                   engine_;
-      std::auto_ptr<SequenceOfOperationsJob::Lock>  jobLock_;
-      bool                                          isNewJob_;
+      LuaJobManager&                                  that_;
+      boost::mutex::scoped_lock                       lock_;
+      JobsEngine&                                     engine_;
+      std::unique_ptr<SequenceOfOperationsJob::Lock>  jobLock_;
+      bool                                            isNewJob_;
 
     public:
       Lock(LuaJobManager& that,
--- a/OrthancServer/ServerJobs/MergeStudyJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/MergeStudyJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -85,7 +85,7 @@
      * Retrieve the DICOM instance to be modified
      **/
     
-    std::auto_ptr<ParsedDicomFile> modified;
+    std::unique_ptr<ParsedDicomFile> modified;
 
     try
     {
--- a/OrthancServer/ServerJobs/Operations/ModifyInstanceOperation.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/Operations/ModifyInstanceOperation.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -94,7 +94,7 @@
 
     LOG(INFO) << "Lua: Modifying instance " << instance.GetId();
 
-    std::auto_ptr<ParsedDicomFile> modified;
+    std::unique_ptr<ParsedDicomFile> modified;
     
     {
       ServerContext::DicomCacheLocker lock(context_, instance.GetId());
--- a/OrthancServer/ServerJobs/Operations/ModifyInstanceOperation.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/Operations/ModifyInstanceOperation.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,8 +33,9 @@
 
 #pragma once
 
+#include "../../../Core/Compatibility.h"
+#include "../../../Core/DicomParsing/DicomModification.h"
 #include "../../../Core/JobsEngine/Operations/IJobOperation.h"
-#include "../../../Core/DicomParsing/DicomModification.h"
 
 namespace Orthanc
 {
@@ -43,9 +44,9 @@
   class ModifyInstanceOperation : public IJobOperation
   {
   private:
-    ServerContext&                    context_;
-    RequestOrigin                     origin_;
-    std::auto_ptr<DicomModification>  modification_;
+    ServerContext&                      context_;
+    RequestOrigin                       origin_;
+    std::unique_ptr<DicomModification>  modification_;
     
   public:
     ModifyInstanceOperation(ServerContext& context,
--- a/OrthancServer/ServerJobs/Operations/StoreScuOperation.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/Operations/StoreScuOperation.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -46,7 +46,7 @@
                                 const JobOperationValue& input,
                                 IDicomConnectionManager& connectionManager)
   {
-    std::auto_ptr<IDicomConnectionManager::IResource> resource
+    std::unique_ptr<IDicomConnectionManager::IResource> resource
       (connectionManager.AcquireConnection(localAet_, modality_));
 
     if (resource.get() == NULL)
--- a/OrthancServer/ServerJobs/Operations/SystemCallOperation.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/Operations/SystemCallOperation.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -81,7 +81,7 @@
 
     arguments.reserve(arguments.size() + postArguments_.size() + 1);
 
-    std::auto_ptr<TemporaryFile> tmp;
+    std::unique_ptr<TemporaryFile> tmp;
     
     switch (input.GetType())
     {
--- a/OrthancServer/ServerJobs/OrthancJobUnserializer.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/OrthancJobUnserializer.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -65,7 +65,7 @@
 #if ORTHANC_ENABLE_PLUGINS == 1
     if (context_.HasPlugins())
     {
-      std::auto_ptr<IJob> job(context_.GetPlugins().UnserializeJob(type, source));
+      std::unique_ptr<IJob> job(context_.GetPlugins().UnserializeJob(type, source));
       if (job.get() != NULL)
       {
         return job.release();
--- a/OrthancServer/ServerJobs/OrthancPeerStoreJob.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/OrthancPeerStoreJob.h	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../Core/Compatibility.h"
 #include "../../Core/JobsEngine/SetOfInstancesJob.h"
 #include "../../Core/HttpClient.h"
 
@@ -44,9 +45,9 @@
   class OrthancPeerStoreJob : public SetOfInstancesJob
   {
   private:
-    ServerContext&             context_;
-    WebServiceParameters       peer_;
-    std::auto_ptr<HttpClient>  client_;
+    ServerContext&               context_;
+    WebServiceParameters         peer_;
+    std::unique_ptr<HttpClient>  client_;
 
   protected:
     virtual bool HandleInstance(const std::string& instance);
--- a/OrthancServer/ServerJobs/ResourceModificationJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/ResourceModificationJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -147,8 +147,8 @@
      * Retrieve the original instance from the DICOM cache.
      **/
     
-    std::auto_ptr<DicomInstanceHasher> originalHasher;
-    std::auto_ptr<ParsedDicomFile> modified;
+    std::unique_ptr<DicomInstanceHasher> originalHasher;
+    std::unique_ptr<ParsedDicomFile> modified;
 
     try
     {
--- a/OrthancServer/ServerJobs/ResourceModificationJob.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/ResourceModificationJob.h	Mon Mar 02 15:42:17 2020 +0100
@@ -46,11 +46,11 @@
   private:
     class Output;
     
-    ServerContext&                    context_;
-    std::auto_ptr<DicomModification>  modification_;
-    boost::shared_ptr<Output>         output_;
-    bool                              isAnonymization_;
-    DicomInstanceOrigin               origin_;
+    ServerContext&                      context_;
+    std::unique_ptr<DicomModification>  modification_;
+    boost::shared_ptr<Output>           output_;
+    bool                                isAnonymization_;
+    DicomInstanceOrigin                 origin_;
 
   protected:
     virtual bool HandleInstance(const std::string& instance);
--- a/OrthancServer/ServerJobs/SplitStudyJob.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/ServerJobs/SplitStudyJob.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -71,7 +71,7 @@
      * Retrieve the DICOM instance to be modified
      **/
     
-    std::auto_ptr<ParsedDicomFile> modified;
+    std::unique_ptr<ParsedDicomFile> modified;
 
     try
     {
--- a/OrthancServer/main.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/OrthancServer/main.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -190,7 +190,7 @@
 
   virtual IFindRequestHandler* ConstructFindRequestHandler()
   {
-    std::auto_ptr<OrthancFindRequestHandler> result(new OrthancFindRequestHandler(context_));
+    std::unique_ptr<OrthancFindRequestHandler> result(new OrthancFindRequestHandler(context_));
 
     {
       OrthancConfiguration::ReaderLock lock;
@@ -1361,8 +1361,8 @@
                              bool upgradeDatabase,
                              bool loadJobsFromDatabase)
 {
-  std::auto_ptr<IDatabaseWrapper>  databasePtr;
-  std::auto_ptr<IStorageArea>  storage;
+  std::unique_ptr<IDatabaseWrapper>  databasePtr;
+  std::unique_ptr<IStorageArea>  storage;
 
 #if ORTHANC_ENABLE_PLUGINS == 1
   OrthancPlugins plugins;
--- a/Plugins/Engine/OrthancPlugins.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -367,7 +367,7 @@
       
     public:
       DicomWebBinaryFormatter(const _OrthancPluginEncodeDicomWeb& parameters) :
-      callback_(parameters.callback)
+        callback_(parameters.callback)
       {
       }
       
@@ -435,7 +435,7 @@
       };
 
       HttpOutput&                 output_;
-      std::auto_ptr<std::string>  errorDetails_;
+      std::unique_ptr<std::string>  errorDetails_;
       bool                        logDetails_;
       MultipartState              multipartState_;
       std::string                 multipartSubType_;
@@ -665,8 +665,8 @@
 
     public:
       ChunkedRestCallback(_OrthancPluginChunkedRestCallback parameters) :
-      parameters_(parameters),
-      regex_(parameters.pathRegularExpression)
+        parameters_(parameters),
+        regex_(parameters.pathRegularExpression)
       {
       }
 
@@ -794,8 +794,8 @@
 
     public:
       ServerContextLock(PImpl& that) : 
-      lock_(that.contextMutex_),
-      context_(that.context_)
+        lock_(that.contextMutex_),
+        context_(that.context_)
       {
         if (context_ == NULL)
         {
@@ -846,7 +846,7 @@
     IncomingHttpRequestFilters2 incomingHttpRequestFilters2_;
     RefreshMetricsCallbacks refreshMetricsCallbacks_;
     StorageCommitmentScpCallbacks storageCommitmentScpCallbacks_;
-    std::auto_ptr<StorageAreaFactory>  storageArea_;
+    std::unique_ptr<StorageAreaFactory>  storageArea_;
 
     boost::recursive_mutex restCallbackMutex_;
     boost::recursive_mutex storedCallbackMutex_;
@@ -862,7 +862,7 @@
     Properties properties_;
     int argc_;
     char** argv_;
-    std::auto_ptr<OrthancPluginDatabase>  database_;
+    std::unique_ptr<OrthancPluginDatabase>  database_;
     PluginsErrorDictionary  dictionary_;
 
     PImpl() : 
@@ -882,8 +882,8 @@
   {
   private:
     OrthancPlugins&  that_;
-    std::auto_ptr<HierarchicalMatcher> matcher_;
-    std::auto_ptr<ParsedDicomFile>     filtered_;
+    std::unique_ptr<HierarchicalMatcher> matcher_;
+    std::unique_ptr<ParsedDicomFile>     filtered_;
     ParsedDicomFile* currentQuery_;
 
     void Reset()
@@ -996,7 +996,7 @@
       }
 
       ParsedDicomFile f(dicom, size);
-      std::auto_ptr<ParsedDicomFile> summary(matcher_->Extract(f));
+      std::unique_ptr<ParsedDicomFile> summary(matcher_->Extract(f));
       reinterpret_cast<DicomFindAnswers*>(answers)->Add(*summary);
     }
   };
@@ -1006,7 +1006,7 @@
   {
   private:
     OrthancPlugins&            that_;
-    std::auto_ptr<DicomArray>  currentQuery_;
+    std::unique_ptr<DicomArray>  currentQuery_;
 
     void Reset()
     {
@@ -1466,7 +1466,7 @@
       
     public:
       RestCallbackMatcher(const UriComponents& uri) :
-      flatUri_(Toolbox::FlattenUri(uri))
+        flatUri_(Toolbox::FlattenUri(uri))
       {
       }
 
@@ -2483,7 +2483,7 @@
     std::string result;
 
     {
-      std::auto_ptr<DeflateBaseCompressor> compressor;
+      std::unique_ptr<DeflateBaseCompressor> compressor;
 
       switch (p.compression)
       {
@@ -2533,14 +2533,14 @@
   }
 
 
-  static OrthancPluginImage* ReturnImage(std::auto_ptr<ImageAccessor>& image)
+  static OrthancPluginImage* ReturnImage(std::unique_ptr<ImageAccessor>& image)
   {
     // Images returned to plugins are assumed to be writeable. If the
     // input image is read-only, we return a copy so that it can be modified.
 
     if (image->IsReadOnly())
     {
-      std::auto_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight(), false));
+      std::unique_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight(), false));
       ImageProcessing::Copy(*copy, *image);
       image.reset(NULL);
       return reinterpret_cast<OrthancPluginImage*>(copy.release());
@@ -2556,7 +2556,7 @@
   {
     const _OrthancPluginUncompressImage& p = *reinterpret_cast<const _OrthancPluginUncompressImage*>(parameters);
 
-    std::auto_ptr<ImageAccessor> image;
+    std::unique_ptr<ImageAccessor> image;
 
     switch (p.format)
     {
@@ -2940,7 +2940,7 @@
     const _OrthancPluginConvertPixelFormat& p = *reinterpret_cast<const _OrthancPluginConvertPixelFormat*>(parameters);
     const ImageAccessor& source = *reinterpret_cast<const ImageAccessor*>(p.source);
 
-    std::auto_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight(), false));
+    std::unique_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight(), false));
     ImageProcessing::Convert(*target, source);
 
     *(p.target) = ReturnImage(target);
@@ -2993,7 +2993,7 @@
     const _OrthancPluginDicomToJson& p =
       *reinterpret_cast<const _OrthancPluginDicomToJson*>(parameters);
 
-    std::auto_ptr<ParsedDicomFile> dicom;
+    std::unique_ptr<ParsedDicomFile> dicom;
 
     if (service == _OrthancPluginService_DicomBufferToJson)
     {
@@ -3058,7 +3058,7 @@
         privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator();
       }
       
-      std::auto_ptr<ParsedDicomFile> file
+      std::unique_ptr<ParsedDicomFile> file
         (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(p.flags),
                                          privateCreator));
 
@@ -3122,7 +3122,7 @@
     const _OrthancPluginCreateImage& p =
       *reinterpret_cast<const _OrthancPluginCreateImage*>(parameters);
 
-    std::auto_ptr<ImageAccessor> result;
+    std::unique_ptr<ImageAccessor> result;
 
     switch (service)
     {
@@ -4612,7 +4612,7 @@
   };
 
 
-  bool OrthancPlugins::CreateChunkedRequestReader(std::auto_ptr<IChunkedRequestReader>& target,
+  bool OrthancPlugins::CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target,
                                                   RequestOrigin origin,
                                                   const char* remoteIp,
                                                   const char* username,
--- a/Plugins/Engine/OrthancPlugins.h	Mon Mar 02 10:13:34 2020 +0100
+++ b/Plugins/Engine/OrthancPlugins.h	Mon Mar 02 15:42:17 2020 +0100
@@ -338,7 +338,7 @@
     void RefreshMetrics();
 
     // New in Orthanc 1.5.7
-    virtual bool CreateChunkedRequestReader(std::auto_ptr<IChunkedRequestReader>& target,
+    virtual bool CreateChunkedRequestReader(std::unique_ptr<IChunkedRequestReader>& target,
                                             RequestOrigin origin,
                                             const char* remoteIp,
                                             const char* username,
--- a/Plugins/Engine/PluginsErrorDictionary.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Plugins/Engine/PluginsErrorDictionary.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -69,7 +69,7 @@
                                                           uint16_t httpStatus,
                                                           const char* message)
   {
-    std::auto_ptr<Error> error(new Error);
+    std::unique_ptr<Error> error(new Error);
 
     error->pluginName_ = PluginsManager::GetPluginName(library);
     error->pluginCode_ = pluginCode;
--- a/Plugins/Engine/PluginsManager.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/Plugins/Engine/PluginsManager.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -249,7 +249,7 @@
       return;
     }
 
-    std::auto_ptr<Plugin> plugin(new Plugin(*this, path));
+    std::unique_ptr<Plugin> plugin(new Plugin(*this, path));
 
     if (!IsOrthancPlugin(plugin->GetSharedLibrary()))
     {
--- a/UnitTestsSources/DicomMapTests.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/UnitTestsSources/DicomMapTests.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "PrecompiledHeadersUnitTests.h"
 #include "gtest/gtest.h"
 
+#include "../Core/Compatibility.h"
 #include "../Core/OrthancException.h"
 #include "../Core/DicomFormat/DicomMap.h"
 #include "../Core/DicomParsing/FromDcmtkBridge.h"
@@ -121,7 +122,7 @@
   ASSERT_EQ(1u, s.size());
   ASSERT_EQ(DICOM_TAG_PATIENT_NAME, *s.begin());
 
-  std::auto_ptr<DicomMap> mm(m.Clone());
+  std::unique_ptr<DicomMap> mm(m.Clone());
   ASSERT_EQ("PatientName", mm->GetValue(DICOM_TAG_PATIENT_NAME).GetContent());  
 
   m.SetValue(DICOM_TAG_PATIENT_ID, "Hello", false);
@@ -450,10 +451,10 @@
   dataset.insertEmptyElement(DCM_StudyID, OFFalse);
 
   {
-    std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_ReferencedSeriesSequence));
+    std::unique_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_ReferencedSeriesSequence));
 
     {
-      std::auto_ptr<DcmItem> item(new DcmItem);
+      std::unique_ptr<DcmItem> item(new DcmItem);
       item->putAndInsertString(DCM_ReferencedSOPInstanceUID, "nope", OFFalse);
       ASSERT_TRUE(sequence->insert(item.release(), false, false).good());
     }
@@ -695,7 +696,7 @@
   // "dicom.GetDcmtkObject().getDataset()->putAndInsertTagKey(tag,
   // value)" that was not available in DCMTK 3.6.0
 
-  std::auto_ptr<DcmAttributeTag> element(new DcmAttributeTag(ToDcmtkBridge::Convert(tag)));
+  std::unique_ptr<DcmAttributeTag> element(new DcmAttributeTag(ToDcmtkBridge::Convert(tag)));
 
   DcmTagKey v = ToDcmtkBridge::Convert(value);
   if (!element->putTagVal(v).good())
@@ -938,11 +939,11 @@
   ParsedDicomFile dicom(false);
   
   {
-    std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_ReferencedSeriesSequence));
+    std::unique_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_ReferencedSeriesSequence));
 
     for (unsigned int i = 0; i < 3; i++)
     {
-      std::auto_ptr<DcmItem> item(new DcmItem);
+      std::unique_ptr<DcmItem> item(new DcmItem);
       std::string s = "item" + boost::lexical_cast<std::string>(i);
       item->putAndInsertString(DCM_ReferencedSOPInstanceUID, s.c_str(), OFFalse);
       ASSERT_TRUE(sequence->insert(item.release(), false, false).good());
--- a/UnitTestsSources/FromDcmtkTests.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/UnitTestsSources/FromDcmtkTests.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "PrecompiledHeadersUnitTests.h"
 #include "gtest/gtest.h"
 
+#include "../Core/Compatibility.h"
 #include "../Core/DicomNetworking/DicomFindAnswers.h"
 #include "../Core/DicomParsing/DicomModification.h"
 #include "../Core/DicomParsing/DicomWebJsonVisitor.h"
@@ -95,7 +96,7 @@
   {
     char b[1024];
     sprintf(b, "UnitTestsResults/anon%06d.dcm", i);
-    std::auto_ptr<ParsedDicomFile> f(o.Clone(false));
+    std::unique_ptr<ParsedDicomFile> f(o.Clone(false));
     if (i > 4)
       o.ReplacePlainString(DICOM_TAG_SERIES_INSTANCE_UID, "coucou");
     m.Apply(*f);
@@ -402,7 +403,7 @@
   // https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#private-class-members
   TEST(FromDcmtkBridge, FromJson)
   {
-    std::auto_ptr<DcmElement> element;
+    std::unique_ptr<DcmElement> element;
 
     {
       Json::Value a;
@@ -817,7 +818,7 @@
 
 
   {
-    std::auto_ptr<ParsedDicomFile> dicom
+    std::unique_ptr<ParsedDicomFile> dicom
       (ParsedDicomFile::CreateFromJson(v, static_cast<DicomFromJsonFlags>(DicomFromJsonFlags_GenerateIdentifiers), ""));
 
     Json::Value vv;
@@ -833,7 +834,7 @@
 
 
   {
-    std::auto_ptr<ParsedDicomFile> dicom
+    std::unique_ptr<ParsedDicomFile> dicom
       (ParsedDicomFile::CreateFromJson(v, static_cast<DicomFromJsonFlags>(DicomFromJsonFlags_GenerateIdentifiers), ""));
 
     Json::Value vv;
@@ -847,7 +848,7 @@
 
 
   {
-    std::auto_ptr<ParsedDicomFile> dicom
+    std::unique_ptr<ParsedDicomFile> dicom
       (ParsedDicomFile::CreateFromJson(v, static_cast<DicomFromJsonFlags>(DicomFromJsonFlags_DecodeDataUriScheme), ""));
 
     Json::Value vv;
@@ -916,7 +917,7 @@
     Orthanc::SystemToolbox::ReadFile(s, PATH);
     Orthanc::ParsedDicomFile f(s);
     
-    std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
+    std::unique_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
     ASSERT_EQ(256u, decoded->GetWidth());
     ASSERT_EQ(256u, decoded->GetHeight());
     ASSERT_EQ(Orthanc::PixelFormat_Grayscale8, decoded->GetFormat());
@@ -978,7 +979,7 @@
     Orthanc::SystemToolbox::ReadFile(s, PATH);
     Orthanc::ParsedDicomFile f(s);
     
-    std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
+    std::unique_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
     ASSERT_EQ(384u, decoded->GetWidth());
     ASSERT_EQ(256u, decoded->GetHeight());
     ASSERT_EQ(Orthanc::PixelFormat_RGB24, decoded->GetFormat());
@@ -1035,7 +1036,7 @@
     Orthanc::SystemToolbox::ReadFile(s, PATH);
     Orthanc::ParsedDicomFile f(s);
     
-    std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
+    std::unique_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
     ASSERT_EQ(256u, decoded->GetWidth());
     ASSERT_EQ(256u, decoded->GetHeight());
     ASSERT_EQ(Orthanc::PixelFormat_Grayscale16, decoded->GetFormat());
@@ -1091,7 +1092,7 @@
     Orthanc::SystemToolbox::ReadFile(s, PATH);
     Orthanc::ParsedDicomFile f(s);
     
-    std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
+    std::unique_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0));
     ASSERT_EQ(256u, decoded->GetWidth());
     ASSERT_EQ(256u, decoded->GetHeight());
     ASSERT_EQ(Orthanc::PixelFormat_SignedGrayscale16, decoded->GetFormat());
--- a/UnitTestsSources/ImageProcessingTests.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/UnitTestsSources/ImageProcessingTests.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "PrecompiledHeadersUnitTests.h"
 #include "gtest/gtest.h"
 
+#include "../Core/Compatibility.h"
 #include "../Core/DicomFormat/DicomImageInformation.h"
 #include "../Core/Images/Image.h"
 #include "../Core/Images/ImageProcessing.h"
@@ -92,7 +93,7 @@
   class TestImageTraits : public ::testing::Test
   {
   private:
-    std::auto_ptr<Image>  image_;
+    std::unique_ptr<Image>  image_;
 
   protected:
     virtual void SetUp() ORTHANC_OVERRIDE
@@ -547,7 +548,7 @@
     SetGrayscale8Pixel(dirac, 4, 0, 100);
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k1, 2, k2, 0);
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 0, 0));
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 1, 0, 0));
@@ -561,7 +562,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k1, 2);
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 0, 0));
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 1, 0, 0));
@@ -575,7 +576,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k2, 0);
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 0, 0));
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 1, 0, 0));
@@ -595,7 +596,7 @@
     SetGrayscale8Pixel(dirac, 0, 4, 100);
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k1, 2);
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 0, 0));
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 1, 0));
@@ -609,7 +610,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k1, 2, k2, 0);
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 0, 0));
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 1, 0));
@@ -623,7 +624,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k2, 0);
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 0, 0));
       ASSERT_TRUE(TestGrayscale8Pixel(*image, 0, 1, 0));
@@ -643,7 +644,7 @@
     SetRGB24Pixel(dirac, 4, 0, 100, 120, 140);
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k1, 2, k2, 0);
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 0, 0, 0, 0));
       ASSERT_TRUE(TestRGB24Pixel(*image, 1, 0, 0, 0, 0));
@@ -657,7 +658,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k1, 2);
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 0, 0, 0, 0));
       ASSERT_TRUE(TestRGB24Pixel(*image, 1, 0, 0, 0, 0));
@@ -671,7 +672,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k2, 0);
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 0, 0, 0, 0));
       ASSERT_TRUE(TestRGB24Pixel(*image, 1, 0, 0, 0, 0));
@@ -691,7 +692,7 @@
     SetRGB24Pixel(dirac, 0, 4, 100, 120, 140);
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k1, 2);
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 0, 0, 0, 0));
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 1, 0, 0, 0));
@@ -705,7 +706,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k1, 2, k2, 0);
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 0, 0, 0, 0));
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 1, 0, 0, 0));
@@ -719,7 +720,7 @@
     }
 
     {
-      std::auto_ptr<ImageAccessor> image(Image::Clone(dirac));
+      std::unique_ptr<ImageAccessor> image(Image::Clone(dirac));
       ImageProcessing::SeparableConvolution(*image, k2, 0, k2, 0);
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 0, 0, 0, 0));
       ASSERT_TRUE(TestRGB24Pixel(*image, 0, 1, 0, 0, 0));
--- a/UnitTestsSources/MultiThreadingTests.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/UnitTestsSources/MultiThreadingTests.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "PrecompiledHeadersUnitTests.h"
 #include "gtest/gtest.h"
 
+#include "../Core/Compatibility.h"
 #include "../Core/FileStorage/MemoryStorageArea.h"
 #include "../Core/JobsEngine/JobsEngine.h"
 #include "../Core/Logging.h"
@@ -272,7 +273,7 @@
   q.Enqueue(new DynamicInteger(30, s));
   q.Enqueue(new DynamicInteger(40, s));
 
-  std::auto_ptr<DynamicInteger> i;
+  std::unique_ptr<DynamicInteger> i;
   i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(10, i->GetValue());
   i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(20, i->GetValue());
   i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(30, i->GetValue());
@@ -747,7 +748,7 @@
   SequenceOfOperationsJob* job = NULL;
 
   {
-    std::auto_ptr<SequenceOfOperationsJob> a(new SequenceOfOperationsJob);
+    std::unique_ptr<SequenceOfOperationsJob> a(new SequenceOfOperationsJob);
     job = a.get();
     engine.GetRegistry().Submit(id, a.release(), 0);
   }
@@ -837,7 +838,7 @@
   }
   else
   {
-    std::auto_ptr<IJob> unserialized(unserializer.UnserializeJob(a));
+    std::unique_ptr<IJob> unserialized(unserializer.UnserializeJob(a));
   
     Json::Value b = 43;
     if (unserialized->Serialize(b))
@@ -863,7 +864,7 @@
   }
   else
   {
-    std::auto_ptr<SetOfInstancesJob> unserialized
+    std::unique_ptr<SetOfInstancesJob> unserialized
       (dynamic_cast<SetOfInstancesJob*>(unserializer.UnserializeJob(a)));
   
     Json::Value b = 43;
@@ -889,7 +890,7 @@
   Json::Value a = 42;
   operation.Serialize(a);
   
-  std::auto_ptr<IJobOperation> unserialized(unserializer.UnserializeOperation(a));
+  std::unique_ptr<IJobOperation> unserialized(unserializer.UnserializeOperation(a));
   
   Json::Value b = 43;
   unserialized->Serialize(b);
@@ -904,7 +905,7 @@
   Json::Value a = 42;
   value.Serialize(a);
   
-  std::auto_ptr<JobOperationValue> unserialized(unserializer.UnserializeValue(a));
+  std::unique_ptr<JobOperationValue> unserialized(unserializer.UnserializeValue(a));
   
   Json::Value b = 43;
   unserialized->Serialize(b);
@@ -957,7 +958,7 @@
 
   {
     GenericJobUnserializer unserializer;
-    std::auto_ptr<JobOperationValues> values(JobOperationValues::Unserialize(unserializer, s));
+    std::unique_ptr<JobOperationValues> values(JobOperationValues::Unserialize(unserializer, s));
     ASSERT_EQ(3u, values->GetSize());
     ASSERT_EQ(JobOperationValue::Type_Null, values->GetValue(0).GetType());
     ASSERT_EQ(JobOperationValue::Type_String, values->GetValue(1).GetType());
@@ -984,7 +985,7 @@
   ASSERT_THROW(unserializer.UnserializeJob(s), OrthancException);
   ASSERT_THROW(unserializer.UnserializeOperation(s), OrthancException);
 
-  std::auto_ptr<JobOperationValue> value;
+  std::unique_ptr<JobOperationValue> value;
   value.reset(unserializer.UnserializeValue(s));
   
   ASSERT_EQ(JobOperationValue::Type_Null, value->GetType());
@@ -1021,7 +1022,7 @@
   ASSERT_THROW(unserializer.UnserializeValue(s), OrthancException);
 
   {
-    std::auto_ptr<IJobOperation> operation;
+    std::unique_ptr<IJobOperation> operation;
     operation.reset(unserializer.UnserializeOperation(s));
 
     // Make sure that we have indeed unserialized a log operation
@@ -1065,7 +1066,7 @@
     ASSERT_THROW(unserializer.UnserializeValue(s), OrthancException);
     ASSERT_THROW(unserializer.UnserializeOperation(s), OrthancException);
 
-    std::auto_ptr<IJob> job;
+    std::unique_ptr<IJob> job;
     job.reset(unserializer.UnserializeJob(s));
 
     const DummyInstancesJob& tmp = dynamic_cast<const DummyInstancesJob&>(*job);
@@ -1116,7 +1117,7 @@
     ASSERT_THROW(unserializer.UnserializeValue(s), OrthancException);
     ASSERT_THROW(unserializer.UnserializeOperation(s), OrthancException);
 
-    std::auto_ptr<IJob> job;
+    std::unique_ptr<IJob> job;
     job.reset(unserializer.UnserializeJob(s));
 
     std::string tmp;
@@ -1147,7 +1148,7 @@
   source.Insert(DICOM_TAG_SERIES_DESCRIPTION, "Test 2", false, "");
   source.Insert(DICOM_TAG_PATIENT_NAME, "Test 3", false, "");
 
-  std::auto_ptr<ParsedDicomFile> modified(source.Clone(true));
+  std::unique_ptr<ParsedDicomFile> modified(source.Clone(true));
 
   {
     DicomModification modification;
@@ -1166,7 +1167,7 @@
     DicomModification modification(s);
     ASSERT_EQ(ResourceType_Series, modification.GetLevel());
     
-    std::auto_ptr<ParsedDicomFile> second(source.Clone(true));
+    std::unique_ptr<ParsedDicomFile> second(source.Clone(true));
     modification.Apply(*second);
 
     std::string s;
@@ -1282,7 +1283,7 @@
   private:
     MemoryStorageArea              storage_;
     SQLiteDatabaseWrapper          db_;   // The SQLite DB is in memory
-    std::auto_ptr<ServerContext>   context_;
+    std::unique_ptr<ServerContext>   context_;
     TimeoutDicomConnectionManager  manager_;
 
   public:
@@ -1336,7 +1337,7 @@
     instance.Serialize(s);
   }
 
-  std::auto_ptr<JobOperationValue> value;
+  std::unique_ptr<JobOperationValue> value;
   value.reset(unserializer.UnserializeValue(s));
   ASSERT_EQ(JobOperationValue::Type_DicomInstance, value->GetType());
   ASSERT_EQ(id, dynamic_cast<DicomInstanceOperationValue&>(*value).GetId());
@@ -1369,7 +1370,7 @@
     operation.Serialize(s);
   }
 
-  std::auto_ptr<IJobOperation> operation;
+  std::unique_ptr<IJobOperation> operation;
 
   {
     operation.reset(unserializer.UnserializeOperation(s));
@@ -1456,7 +1457,7 @@
   // ModifyInstanceOperation
 
   {
-    std::auto_ptr<DicomModification> modification(new DicomModification);
+    std::unique_ptr<DicomModification> modification(new DicomModification);
     modification->SetupAnonymization(DicomVersion_2008);
     
     ModifyInstanceOperation operation(GetContext(), RequestOrigin_Lua, modification.release());
@@ -1507,7 +1508,7 @@
   }
 
   {
-    std::auto_ptr<IJob> job;
+    std::unique_ptr<IJob> job;
     job.reset(unserializer.UnserializeJob(s));
 
     DicomModalityStoreJob& tmp = dynamic_cast<DicomModalityStoreJob&>(*job);
@@ -1537,7 +1538,7 @@
   }
 
   {
-    std::auto_ptr<IJob> job;
+    std::unique_ptr<IJob> job;
     job.reset(unserializer.UnserializeJob(s));
 
     OrthancPeerStoreJob& tmp = dynamic_cast<OrthancPeerStoreJob&>(*job);
@@ -1550,7 +1551,7 @@
   // ResourceModificationJob
 
   {
-    std::auto_ptr<DicomModification> modification(new DicomModification);
+    std::unique_ptr<DicomModification> modification(new DicomModification);
     modification->SetupAnonymization(DicomVersion_2008);    
 
     ResourceModificationJob job(GetContext());
@@ -1562,7 +1563,7 @@
   }
 
   {
-    std::auto_ptr<IJob> job;
+    std::unique_ptr<IJob> job;
     job.reset(unserializer.UnserializeJob(s));
 
     ResourceModificationJob& tmp = dynamic_cast<ResourceModificationJob&>(*job);
@@ -1629,7 +1630,7 @@
     }
 
     {
-      std::auto_ptr<IJob> job;
+      std::unique_ptr<IJob> job;
       job.reset(unserializer.UnserializeJob(s));
 
       SplitStudyJob& tmp = dynamic_cast<SplitStudyJob&>(*job);
@@ -1693,7 +1694,7 @@
   }
 
   {
-    std::auto_ptr<IJob> job;
+    std::unique_ptr<IJob> job;
     job.reset(unserializer.UnserializeJob(s));
 
     MergeStudyJob& tmp = dynamic_cast<MergeStudyJob&>(*job);
--- a/UnitTestsSources/ServerIndexTests.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/UnitTestsSources/ServerIndexTests.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -34,6 +34,7 @@
 #include "PrecompiledHeadersUnitTests.h"
 #include "gtest/gtest.h"
 
+#include "../Core/Compatibility.h"
 #include "../Core/FileStorage/FilesystemStorage.h"
 #include "../Core/FileStorage/MemoryStorageArea.h"
 #include "../Core/Logging.h"
@@ -95,8 +96,8 @@
   class DatabaseWrapperTest : public ::testing::Test
   {
   protected:
-    std::auto_ptr<TestDatabaseListener>  listener_;
-    std::auto_ptr<SQLiteDatabaseWrapper> index_;
+    std::unique_ptr<TestDatabaseListener>  listener_;
+    std::unique_ptr<SQLiteDatabaseWrapper> index_;
 
   public:
     DatabaseWrapperTest()
--- a/UnitTestsSources/ToolboxTests.cpp	Mon Mar 02 10:13:34 2020 +0100
+++ b/UnitTestsSources/ToolboxTests.cpp	Mon Mar 02 15:42:17 2020 +0100
@@ -33,6 +33,8 @@
 
 #include "PrecompiledHeadersUnitTests.h"
 #include "gtest/gtest.h"
+#include "../Core/Compatibility.h"
+#include "../Core/IDynamicObject.h"
 #include "../Core/OrthancException.h"
 #include "../Core/Toolbox.h"
 
@@ -159,35 +161,6 @@
 }
 
 
-
-#include "../Core/IDynamicObject.h"
-
-#if __cplusplus < 201103L
-/**
- * "std::unique_ptr" was introduced in C++11. We emulate it using
- * boost. "The smart pointer unique_ptr [is] a drop-in replacement for
- * std::unique_ptr, usable also from C++03 compilers." This is only
- * available on Boost >= 1.57.0 (from November 2014).
- * https://www.boost.org/doc/libs/1_57_0/doc/html/move/reference.html#header.boost.move.unique_ptr_hpp
- **/
-
-#include <boost/move/unique_ptr.hpp>
-
-namespace std
-{
-  template <typename T>
-  class unique_ptr : public boost::movelib::unique_ptr<T>
-  {
-  public:
-    unique_ptr(T* p) :
-      boost::movelib::unique_ptr<T>(p)
-    {
-    }      
-  };
-}
-
-#endif
-
 TEST(Toolbox, UniquePtr)
 {
   std::unique_ptr<int> i(new int(42));