Mercurial > hg > orthanc-transfers
comparison Framework/OrthancInstancesCache.cpp @ 8:4c3437217518
fix for compatibility with simplified OrthancPluginCppWrapper
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 Dec 2018 09:16:51 +0100 |
parents | 95226b754d9e |
children | 7e207ade2f1a |
comparison
equal
deleted
inserted
replaced
7:151e29acbb13 | 8:4c3437217518 |
---|---|
151 CheckInvariants(); | 151 CheckInvariants(); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 | 155 |
156 OrthancInstancesCache::OrthancInstancesCache(OrthancPluginContext* context) : | 156 OrthancInstancesCache::OrthancInstancesCache() : |
157 context_(context), | |
158 memorySize_(0), | 157 memorySize_(0), |
159 maxMemorySize_(512 * MB) // 512 MB by default | 158 maxMemorySize_(512 * MB) // 512 MB by default |
160 { | 159 { |
161 if (context == NULL) | |
162 { | |
163 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | |
164 } | |
165 } | 160 } |
166 | 161 |
167 | 162 |
168 OrthancInstancesCache::~OrthancInstancesCache() | 163 OrthancInstancesCache::~OrthancInstancesCache() |
169 { | 164 { |
225 return; | 220 return; |
226 } | 221 } |
227 } | 222 } |
228 | 223 |
229 // The instance was not in the cache, load it | 224 // The instance was not in the cache, load it |
230 std::auto_ptr<SourceDicomInstance> instance(new SourceDicomInstance(context_, instanceId)); | 225 std::auto_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId)); |
231 size = instance->GetInfo().GetSize(); | 226 size = instance->GetInfo().GetSize(); |
232 md5 = instance->GetInfo().GetMD5(); | 227 md5 = instance->GetInfo().GetMD5(); |
233 | 228 |
234 // Store the just-loaded DICOM instance into the cache | 229 // Store the just-loaded DICOM instance into the cache |
235 { | 230 { |
254 return; | 249 return; |
255 } | 250 } |
256 } | 251 } |
257 | 252 |
258 // The instance was not in the cache, load it | 253 // The instance was not in the cache, load it |
259 std::auto_ptr<SourceDicomInstance> instance(new SourceDicomInstance(context_, instanceId)); | 254 std::auto_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId)); |
260 instance->GetChunk(chunk, md5, 0, instance->GetInfo().GetSize()); | 255 instance->GetChunk(chunk, md5, 0, instance->GetInfo().GetSize()); |
261 | 256 |
262 // Store the just-loaded DICOM instance into the cache | 257 // Store the just-loaded DICOM instance into the cache |
263 { | 258 { |
264 boost::mutex::scoped_lock lock(mutex_); | 259 boost::mutex::scoped_lock lock(mutex_); |