comparison OrthancServer/DicomInstanceToStore.cpp @ 2898:e5e3253a1164

DicomInstanceToStore::GetHasher()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Oct 2018 11:44:17 +0200
parents a27b0e9a3fd9
children bbfd95a0c429
comparison
equal deleted inserted replaced
2897:9ff17eb830ec 2898:e5e3253a1164
144 } 144 }
145 }; 145 };
146 } 146 }
147 147
148 148
149 struct DicomInstanceToStore::PImpl 149 class DicomInstanceToStore::PImpl
150 { 150 {
151 DicomInstanceOrigin origin_; 151 public:
152 SmartContainer<std::string> buffer_; 152 DicomInstanceOrigin origin_;
153 SmartContainer<ParsedDicomFile> parsed_; 153 SmartContainer<std::string> buffer_;
154 SmartContainer<DicomMap> summary_; 154 SmartContainer<ParsedDicomFile> parsed_;
155 SmartContainer<Json::Value> json_; 155 SmartContainer<DicomMap> summary_;
156 MetadataMap metadata_; 156 SmartContainer<Json::Value> json_;
157 MetadataMap metadata_;
158
159 private:
160 std::auto_ptr<DicomInstanceHasher> hasher_;
157 161
158 void ComputeMissingInformation() 162 void ComputeMissingInformation()
159 { 163 {
160 if (buffer_.HasContent() && 164 if (buffer_.HasContent() &&
161 summary_.HasContent() && 165 summary_.HasContent() &&
223 ignoreTagLength); 227 ignoreTagLength);
224 } 228 }
225 } 229 }
226 230
227 231
232 public:
228 const char* GetBufferData() 233 const char* GetBufferData()
229 { 234 {
230 ComputeMissingInformation(); 235 ComputeMissingInformation();
231 236
232 if (!buffer_.HasContent()) 237 if (!buffer_.HasContent())
282 287
283 return json_.GetConstContent(); 288 return json_.GetConstContent();
284 } 289 }
285 290
286 291
292 DicomInstanceHasher& GetHasher()
293 {
294 if (hasher_.get() == NULL)
295 {
296 hasher_.reset(new DicomInstanceHasher(GetSummary()));
297 }
298
299 if (hasher_.get() == NULL)
300 {
301 throw OrthancException(ErrorCode_InternalError);
302 }
303
304 return *hasher_;
305 }
306
307
287 bool LookupTransferSyntax(std::string& result) 308 bool LookupTransferSyntax(std::string& result)
288 { 309 {
289 ComputeMissingInformation(); 310 ComputeMissingInformation();
290 311
291 DicomMap header; 312 DicomMap header;
394 415
395 bool DicomInstanceToStore::LookupTransferSyntax(std::string& result) 416 bool DicomInstanceToStore::LookupTransferSyntax(std::string& result)
396 { 417 {
397 return pimpl_->LookupTransferSyntax(result); 418 return pimpl_->LookupTransferSyntax(result);
398 } 419 }
420
421
422 DicomInstanceHasher& DicomInstanceToStore::GetHasher()
423 {
424 return pimpl_->GetHasher();
425 }
399 } 426 }