comparison Framework/Radiography/RadiographyAlphaLayer.cpp @ 1298:8a0a62189f46

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 16:31:30 +0100
parents 1c7ae79c426d
children 257f2c9a02ac
comparison
equal deleted inserted replaced
1296:86400fa16091 1298:8a0a62189f46
21 21
22 #include "RadiographyAlphaLayer.h" 22 #include "RadiographyAlphaLayer.h"
23 23
24 #include "RadiographyScene.h" 24 #include "RadiographyScene.h"
25 25
26 #include <Core/Compatibility.h>
26 #include <Core/Images/Image.h> 27 #include <Core/Images/Image.h>
27 #include <Core/OrthancException.h> 28 #include <Core/OrthancException.h>
29
28 #include "../Toolbox/ImageGeometry.h" 30 #include "../Toolbox/ImageGeometry.h"
29 31
30 namespace OrthancStone 32 namespace OrthancStone
31 { 33 {
32 34
33 void RadiographyAlphaLayer::SetAlpha(Orthanc::ImageAccessor* image) 35 void RadiographyAlphaLayer::SetAlpha(Orthanc::ImageAccessor* image)
34 { 36 {
35 std::auto_ptr<Orthanc::ImageAccessor> raii(image); 37 std::unique_ptr<Orthanc::ImageAccessor> raii(image);
36 38
37 if (image == NULL) 39 if (image == NULL)
38 { 40 {
39 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); 41 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
40 } 42 }
43 { 45 {
44 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); 46 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat);
45 } 47 }
46 48
47 SetSize(image->GetWidth(), image->GetHeight()); 49 SetSize(image->GetWidth(), image->GetHeight());
48 alpha_ = raii; 50
51 #if __cplusplus < 201103L
52 alpha_.reset(raii.release());
53 #else
54 alpha_ = std::move(raii);
55 #endif
49 56
50 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); 57 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
51 } 58 }
52 59
53 void RadiographyAlphaLayer::Render(Orthanc::ImageAccessor& buffer, 60 void RadiographyAlphaLayer::Render(Orthanc::ImageAccessor& buffer,