comparison OrthancServer/Sources/OrthancInitialization.cpp @ 4484:64f06e7d5fc7

new abstraction IMemoryBuffer to avoid unnecessary copies of std::string buffers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Jan 2021 19:03:19 +0100
parents d9473bd5ed43
children fa2311f94d9f
comparison
equal deleted inserted replaced
4483:a926f8995d0b 4484:64f06e7d5fc7
357 } 357 }
358 358
359 virtual void Create(const std::string& uuid, 359 virtual void Create(const std::string& uuid,
360 const void* content, 360 const void* content,
361 size_t size, 361 size_t size,
362 FileContentType type) 362 FileContentType type) ORTHANC_OVERRIDE
363 { 363 {
364 if (type != FileContentType_Dicom) 364 if (type != FileContentType_Dicom)
365 { 365 {
366 storage_.Create(uuid, content, size, type); 366 storage_.Create(uuid, content, size, type);
367 } 367 }
368 } 368 }
369 369
370 virtual void Read(std::string& content, 370 virtual IMemoryBuffer* Read(const std::string& uuid,
371 const std::string& uuid, 371 FileContentType type) ORTHANC_OVERRIDE
372 FileContentType type)
373 { 372 {
374 if (type != FileContentType_Dicom) 373 if (type != FileContentType_Dicom)
375 { 374 {
376 storage_.Read(content, uuid, type); 375 return storage_.Read(uuid, type);
377 } 376 }
378 else 377 else
379 { 378 {
380 throw OrthancException(ErrorCode_UnknownResource); 379 throw OrthancException(ErrorCode_UnknownResource);
381 } 380 }
382 } 381 }
383 382
384 virtual void Remove(const std::string& uuid, 383 virtual void Remove(const std::string& uuid,
385 FileContentType type) 384 FileContentType type) ORTHANC_OVERRIDE
386 { 385 {
387 if (type != FileContentType_Dicom) 386 if (type != FileContentType_Dicom)
388 { 387 {
389 storage_.Remove(uuid, type); 388 storage_.Remove(uuid, type);
390 } 389 }