Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyDicomLayer.cpp @ 1299:c38c89684d83 broker
replacing std::auto_ptr by std::unique_ptr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Mar 2020 17:21:24 +0100 |
parents | 68579a31eeb4 |
children | 257f2c9a02ac |
comparison
equal
deleted
inserted
replaced
1297:6ab03e429f06 | 1299:c38c89684d83 |
---|---|
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image) // Takes ownership | 99 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image) // Takes ownership |
100 { | 100 { |
101 std::auto_ptr<Orthanc::ImageAccessor> raii(image); | 101 std::unique_ptr<Orthanc::ImageAccessor> raii(image); |
102 | 102 |
103 if (image == NULL) | 103 if (image == NULL) |
104 { | 104 { |
105 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | 105 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
106 } | 106 } |
107 | 107 |
108 SetSize(image->GetWidth(), image->GetHeight()); | 108 SetSize(image->GetWidth(), image->GetHeight()); |
109 | 109 |
110 source_ = raii; | 110 #if __cplusplus < 201103L |
111 source_.reset(raii.release()); | |
112 #else | |
113 source_ = std::move(raii); | |
114 #endif | |
115 | |
111 ApplyConverter(); | 116 ApplyConverter(); |
112 | 117 |
113 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); | 118 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); |
114 } | 119 } |
115 | 120 |
116 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY, bool emitLayerEditedEvent) // Takes ownership | 121 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY, bool emitLayerEditedEvent) // Takes ownership |
117 { | 122 { |
118 std::auto_ptr<Orthanc::ImageAccessor> raii(image); | 123 std::unique_ptr<Orthanc::ImageAccessor> raii(image); |
119 | 124 |
120 if (image == NULL) | 125 if (image == NULL) |
121 { | 126 { |
122 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | 127 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
123 } | 128 } |
124 | 129 |
125 SetSize(image->GetWidth(), image->GetHeight(), false); | 130 SetSize(image->GetWidth(), image->GetHeight(), false); |
126 | 131 |
127 source_ = raii; | 132 #if __cplusplus < 201103L |
133 source_.reset(raii.release()); | |
134 #else | |
135 source_ = std::move(raii); | |
136 #endif | |
137 | |
128 ApplyConverter(); | 138 ApplyConverter(); |
129 | 139 |
130 SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false); | 140 SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false); |
131 | 141 |
132 if (emitLayerEditedEvent) | 142 if (emitLayerEditedEvent) |