Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyDicomLayer.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 a72c2c9af49a |
comparison
equal
deleted
inserted
replaced
1296:86400fa16091 | 1298:8a0a62189f46 |
---|---|
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image) // Takes ownership | 98 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image) // Takes ownership |
99 { | 99 { |
100 std::auto_ptr<Orthanc::ImageAccessor> raii(image); | 100 std::unique_ptr<Orthanc::ImageAccessor> raii(image); |
101 | 101 |
102 if (image == NULL) | 102 if (image == NULL) |
103 { | 103 { |
104 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | 104 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
105 } | 105 } |
106 | 106 |
107 SetSize(image->GetWidth(), image->GetHeight()); | 107 SetSize(image->GetWidth(), image->GetHeight()); |
108 | 108 |
109 source_ = raii; | 109 #if __cplusplus < 201103L |
110 source_.reset(raii.release()); | |
111 #else | |
112 source_ = std::move(raii); | |
113 #endif | |
114 | |
110 ApplyConverter(); | 115 ApplyConverter(); |
111 | 116 |
112 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); | 117 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); |
113 } | 118 } |
114 | 119 |
115 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY, bool emitLayerEditedEvent) // Takes ownership | 120 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY, bool emitLayerEditedEvent) // Takes ownership |
116 { | 121 { |
117 std::auto_ptr<Orthanc::ImageAccessor> raii(image); | 122 std::unique_ptr<Orthanc::ImageAccessor> raii(image); |
118 | 123 |
119 if (image == NULL) | 124 if (image == NULL) |
120 { | 125 { |
121 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | 126 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
122 } | 127 } |
123 | 128 |
124 SetSize(image->GetWidth(), image->GetHeight(), false); | 129 SetSize(image->GetWidth(), image->GetHeight(), false); |
125 | 130 |
126 source_ = raii; | 131 #if __cplusplus < 201103L |
132 source_.reset(raii.release()); | |
133 #else | |
134 source_ = std::move(raii); | |
135 #endif | |
136 | |
127 ApplyConverter(); | 137 ApplyConverter(); |
128 | 138 |
129 SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false); | 139 SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false); |
130 | 140 |
131 if (emitLayerEditedEvent) | 141 if (emitLayerEditedEvent) |