comparison Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp @ 3768:6110a4995ace

replacing std::auto_ptr by std::unique_ptr in GDCM sample plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 Mar 2020 15:02:23 +0100
parents 94f4a18a79cc
children 7e33516965f8
comparison
equal deleted inserted replaced
3767:c6658187e4b1 3768:6110a4995ace
19 **/ 19 **/
20 20
21 21
22 #include "GdcmDecoderCache.h" 22 #include "GdcmDecoderCache.h"
23 23
24 #include "../../../Core/Compatibility.h"
24 #include "OrthancImageWrapper.h" 25 #include "OrthancImageWrapper.h"
25 26
26 namespace OrthancPlugins 27 namespace OrthancPlugins
27 { 28 {
28 std::string GdcmDecoderCache::ComputeMd5(OrthancPluginContext* context, 29 std::string GdcmDecoderCache::ComputeMd5(OrthancPluginContext* context,
81 return new OrthancImageWrapper(context, decoder_->Decode(context, frameIndex)); 82 return new OrthancImageWrapper(context, decoder_->Decode(context, frameIndex));
82 } 83 }
83 } 84 }
84 85
85 // This is not the same image 86 // This is not the same image
86 std::auto_ptr<GdcmImageDecoder> decoder(new GdcmImageDecoder(dicom, size)); 87 std::unique_ptr<GdcmImageDecoder> decoder(new GdcmImageDecoder(dicom, size));
87 std::auto_ptr<OrthancImageWrapper> image(new OrthancImageWrapper(context, decoder->Decode(context, frameIndex))); 88 std::unique_ptr<OrthancImageWrapper> image(new OrthancImageWrapper(context, decoder->Decode(context, frameIndex)));
88 89
89 { 90 {
90 // Cache the newly created decoder for further use 91 // Cache the newly created decoder for further use
91 boost::mutex::scoped_lock lock(mutex_); 92 boost::mutex::scoped_lock lock(mutex_);
92 decoder_ = decoder; 93 decoder_.reset(decoder.release());
93 size_ = size; 94 size_ = size;
94 md5_ = md5; 95 md5_ = md5;
95 } 96 }
96 97
97 return image.release(); 98 return image.release();