changeset 1507:169adf9090a6

replacing deprecated std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 06 Jul 2020 16:47:40 +0200
parents f88265c3f8a0
children dd1d1cc0575d
files Samples/Common/RtViewerView.cpp Samples/Sdl/RtViewer/RtViewerSdl.cpp Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h
diffstat 6 files changed, 37 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/Samples/Common/RtViewerView.cpp	Tue Jun 30 22:00:38 2020 +0200
+++ b/Samples/Common/RtViewerView.cpp	Mon Jul 06 16:47:40 2020 +0200
@@ -48,6 +48,7 @@
 #include "../../Framework/Volumes/VolumeSceneLayerSource.h"
 
 // Orthanc
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -286,7 +287,7 @@
     /**
     Configure the CT
     */
-    std::auto_ptr<GrayscaleStyleConfigurator> style(new GrayscaleStyleConfigurator);
+    std::unique_ptr<GrayscaleStyleConfigurator> style(new GrayscaleStyleConfigurator);
     style->SetLinearInterpolation(true);
 
     this->SetCtVolumeSlicer(ctLoader, style.release());
--- a/Samples/Sdl/RtViewer/RtViewerSdl.cpp	Tue Jun 30 22:00:38 2020 +0200
+++ b/Samples/Sdl/RtViewer/RtViewerSdl.cpp	Mon Jul 06 16:47:40 2020 +0200
@@ -32,6 +32,7 @@
 #include "../../../Framework/StoneInitialization.h"
 
 // Orthanc (a.o. for screenshot capture)
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Images/Image.h>
 #include <Images/ImageProcessing.h>
 #include <Images/PngWriter.h>
@@ -360,7 +361,7 @@
             boost::shared_ptr<RtViewerView> view = GetViewFromWindowId(
               views, sdlEvent.window.windowID);
 
-            std::auto_ptr<OrthancStone::IViewport::ILock> lock(view->GetViewport()->Lock());
+            std::unique_ptr<OrthancStone::IViewport::ILock> lock(view->GetViewport()->Lock());
             if (lock->HasCompositor())
             {
               OrthancStone::PointerEvent p;
--- a/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Tue Jun 30 22:00:38 2020 +0200
+++ b/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Mon Jul 06 16:47:40 2020 +0200
@@ -29,6 +29,7 @@
 #include "../../../Framework/StoneInitialization.h"
 #include "../../../Framework/Viewport/SdlViewport.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <OrthancException.h>
 
 #include <boost/program_options.hpp>
@@ -198,7 +199,7 @@
                        event.type == SDL_MOUSEMOTION ||
                        event.type == SDL_MOUSEBUTTONUP)
               {
-                std::auto_ptr<OrthancStone::IViewport::ILock> lock(viewport->Lock());
+                std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport->Lock());
                 if (lock->HasCompositor())
                 {
                   OrthancStone::PointerEvent p;
--- a/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h	Tue Jun 30 22:00:38 2020 +0200
+++ b/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h	Mon Jul 06 16:47:40 2020 +0200
@@ -27,6 +27,8 @@
 #include "../../../Framework/Loaders/SeriesFramesLoader.h"
 #include "../../../Framework/Loaders/SeriesThumbnailsLoader.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
+
 #include <boost/make_shared.hpp>
 
 
@@ -56,7 +58,7 @@
     boost::shared_ptr<SdlSimpleViewerApplication> application(new SdlSimpleViewerApplication(context, viewport));
 
     {
-      std::auto_ptr<ILoadersContext::ILock> lock(context.Lock());
+      std::unique_ptr<ILoadersContext::ILock> lock(context.Lock());
       application->dicomLoader_ = DicomResourcesLoader::Create(*lock);
     }
 
@@ -67,7 +69,7 @@
 
   void LoadOrthancFrame(const DicomSource& source, const std::string& instanceId, unsigned int frame)
   {
-    std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());
+    std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
 
     dicomLoader_->ScheduleLoadOrthancResource(boost::make_shared<LoadedDicomResources>(Orthanc::DICOM_TAG_SOP_INSTANCE_UID),
                                               0, source, Orthanc::ResourceType_Instance, instanceId,
@@ -81,7 +83,7 @@
                          const std::string& sopInstanceUid,
                          unsigned int frame)
   {
-    std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());
+    std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
 
     // We first must load the "/metadata" to know the number of frames
     dicomLoader_->ScheduleGetDicomWeb(
@@ -93,7 +95,7 @@
 
   void FitContent()
   {
-    std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
+    std::unique_ptr<IViewport::ILock> lock(viewport_->Lock());
     lock->GetCompositor().FitContent(lock->GetController().GetScene());
     lock->Invalidate();
   }
@@ -117,12 +119,12 @@
       << message.GetImage().GetWidth() << "x" << message.GetImage().GetHeight()
       << " " << Orthanc::EnumerationToString(message.GetImage().GetFormat());
 
-    std::auto_ptr<TextureBaseSceneLayer> layer(
+    std::unique_ptr<TextureBaseSceneLayer> layer(
       message.GetInstanceParameters().CreateTexture(message.GetImage()));
     layer->SetLinearInterpolation(true);
 
     {
-      std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
+      std::unique_ptr<IViewport::ILock> lock(viewport_->Lock());
       lock->GetController().GetScene().SetLayer(0, layer.release());
       lock->GetCompositor().FitContent(lock->GetController().GetScene());
       lock->Invalidate();
@@ -139,7 +141,7 @@
     //message.GetResources()->GetResource(0).Print(stdout);
 
     {
-      std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());
+      std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
       SeriesFramesLoader::Factory f(*message.GetResources());
 
       framesLoader_ = boost::dynamic_pointer_cast<SeriesFramesLoader>(
--- a/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp	Tue Jun 30 22:00:38 2020 +0200
+++ b/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp	Mon Jul 06 16:47:40 2020 +0200
@@ -25,6 +25,7 @@
 #include "../../../Framework/StoneException.h"
 #include "../../../Framework/StoneInitialization.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Toolbox.h>
 
 #include <emscripten.h>
@@ -66,7 +67,7 @@
 {
 }
 
-static std::auto_ptr<OrthancStone::WebAssemblyLoadersContext>  context_;
+static std::unique_ptr<OrthancStone::WebAssemblyLoadersContext>  context_;
 static boost::shared_ptr<OrthancStone::Application>  application_;
 
 extern "C"
--- a/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Tue Jun 30 22:00:38 2020 +0200
+++ b/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h	Mon Jul 06 16:47:40 2020 +0200
@@ -27,6 +27,8 @@
 #include "../../../Framework/Loaders/SeriesThumbnailsLoader.h"
 #include "../../../Framework/Viewport/IViewport.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
+
 #include <boost/make_shared.hpp>
 
 
@@ -53,12 +55,12 @@
                 << message.GetImage().GetWidth() << "x" << message.GetImage().GetHeight()
                 << " " << Orthanc::EnumerationToString(message.GetImage().GetFormat());
 
-      std::auto_ptr<TextureBaseSceneLayer> layer(
+      std::unique_ptr<TextureBaseSceneLayer> layer(
         message.GetInstanceParameters().CreateTexture(message.GetImage()));
       layer->SetLinearInterpolation(true);
 
       {
-        std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
+        std::unique_ptr<IViewport::ILock> lock(viewport_->Lock());
         lock->GetController().GetScene().SetLayer(0, layer.release());
         lock->GetCompositor().FitContent(lock->GetController().GetScene());
         lock->Invalidate();
@@ -75,7 +77,7 @@
       //message.GetResources()->GetResource(0).Print(stdout);
 
       {
-        std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());
+        std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
         SeriesFramesLoader::Factory f(*message.GetResources());
 
         framesLoader_ = boost::dynamic_pointer_cast<SeriesFramesLoader>(f.Create(*lock));
@@ -100,7 +102,7 @@
       boost::shared_ptr<Application> application(new Application(context, viewport));
 
       {
-        std::auto_ptr<ILoadersContext::ILock> lock(context.Lock());
+        std::unique_ptr<ILoadersContext::ILock> lock(context.Lock());
         application->dicomLoader_ = DicomResourcesLoader::Create(*lock);
       }
 
@@ -113,7 +115,7 @@
                           const std::string& instanceId,
                           unsigned int frame)
     {
-      std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());
+      std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
 
       dicomLoader_->ScheduleLoadOrthancResource(
         boost::make_shared<LoadedDicomResources>(Orthanc::DICOM_TAG_SOP_INSTANCE_UID), 
@@ -127,7 +129,7 @@
                            const std::string& sopInstanceUid,
                            unsigned int frame)
     {
-      std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());
+      std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
 
       // We first must load the "/metadata" to know the number of frames
       dicomLoader_->ScheduleGetDicomWeb(
@@ -138,7 +140,7 @@
 
     void FitContent()
     {
-      std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
+      std::unique_ptr<IViewport::ILock> lock(viewport_->Lock());
       lock->GetCompositor().FitContent(lock->GetController().GetScene());
       lock->Invalidate();
     }
@@ -174,7 +176,7 @@
     };
 
     ILoadersContext&                           context_;
-    std::auto_ptr<IWebViewerLoadersObserver>   observer_;
+    std::unique_ptr<IWebViewerLoadersObserver>   observer_;
     bool                                       loadThumbnails_;
     DicomSource                                source_;
     std::set<std::string>                      scheduledSeries_;
@@ -310,7 +312,7 @@
       application->loadThumbnails_ = loadThumbnails;
 
       {
-        std::auto_ptr<ILoadersContext::ILock> lock(context.Lock());
+        std::unique_ptr<ILoadersContext::ILock> lock(context.Lock());
 
         application->resourcesLoader_ = DicomResourcesLoader::Create(*lock);
 
@@ -337,7 +339,7 @@
     
     void AddDicomAllSeries()
     {
-      std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());
+      std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());
 
       if (source_.IsDicomWeb())
       {
@@ -348,7 +350,7 @@
       }
       else if (source_.IsOrthanc())
       {
-        std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
+        std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
         command->SetMethod(Orthanc::HttpMethod_Get);
         command->SetUri("/series");
         lock->Schedule(GetSharedObserver(), PRIORITY_ADD_RESOURCES, command.release());
@@ -374,7 +376,7 @@
           std::set<Orthanc::DicomTag> tags;
           
           {
-            std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());      
+            std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());      
             
             resourcesLoader_->ScheduleQido(loadedStudies_, PRIORITY_ADD_RESOURCES, source_,
                                            Orthanc::ResourceType_Study, filter, tags, CreatePayload(Type_DicomWeb));
@@ -385,7 +387,7 @@
         }
         else if (source_.IsOrthanc())
         {
-          std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
+          std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
           command->SetMethod(Orthanc::HttpMethod_Post);
           command->SetUri("/tools/find");
 
@@ -396,7 +398,7 @@
           command->SetBody(body);
 
           {
-            std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());      
+            std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());      
             lock->Schedule(GetSharedObserver(), PRIORITY_ADD_RESOURCES, command.release());
           }
         }
@@ -412,7 +414,7 @@
     {
       std::set<Orthanc::DicomTag> tags;
 
-      std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());      
+      std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());      
 
       if (scheduledStudies_.find(studyInstanceUid) == scheduledStudies_.end())
       {
@@ -443,7 +445,7 @@
         }
         else if (source_.IsOrthanc())
         {
-          std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
+          std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand);
           command->SetMethod(Orthanc::HttpMethod_Post);
           command->SetUri("/tools/find");
 
@@ -467,7 +469,7 @@
     {
       if (source_.IsOrthanc())
       {
-        std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());      
+        std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());      
         resourcesLoader_->ScheduleLoadOrthancResources(
           loadedSeries_, PRIORITY_ADD_RESOURCES, source_,
           Orthanc::ResourceType_Study, orthancId, Orthanc::ResourceType_Series,
@@ -484,7 +486,7 @@
     {
       if (source_.IsOrthanc())
       {
-        std::auto_ptr<ILoadersContext::ILock> lock(context_.Lock());      
+        std::unique_ptr<ILoadersContext::ILock> lock(context_.Lock());      
         resourcesLoader_->ScheduleLoadOrthancResource(
           loadedSeries_, PRIORITY_ADD_RESOURCES,
           source_, Orthanc::ResourceType_Series, orthancId,