Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerContext.cpp @ 4509:98b7b9d21d83
removed ServerContext::ReadAttachment()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Feb 2021 17:11:37 +0100 |
parents | 8f9090b137f1 |
children | 1ec156a0da38 |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp Thu Feb 11 11:00:05 2021 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Thu Feb 11 17:11:37 2021 +0100 @@ -813,7 +813,8 @@ FileInfo attachment; if (index_.LookupAttachment(attachment, instancePublicId, FileContentType_DicomAsJson)) { - ReadAttachment(result, attachment); + StorageAccessor accessor(area_, GetMetricsRegistry()); + accessor.Read(result, attachment); } else { @@ -886,6 +887,13 @@ } + void ServerContext::ReadDicom(std::string& dicom, + const std::string& instancePublicId) + { + ReadAttachment(dicom, instancePublicId, FileContentType_Dicom, true /* uncompress */); + } + + void ServerContext::ReadAttachment(std::string& result, const std::string& instancePublicId, FileContentType content, @@ -901,29 +909,23 @@ assert(attachment.GetContentType() == content); - if (uncompressIfNeeded) { - ReadAttachment(result, attachment); - } - else - { - // Do not uncompress the content of the storage area, return the - // raw data StorageAccessor accessor(area_, GetMetricsRegistry()); - accessor.ReadRaw(result, attachment); + + if (uncompressIfNeeded) + { + accessor.Read(result, attachment); + } + else + { + // Do not uncompress the content of the storage area, return the + // raw data + accessor.ReadRaw(result, attachment); + } } } - void ServerContext::ReadAttachment(std::string& result, - const FileInfo& attachment) - { - // This will decompress the attachment - StorageAccessor accessor(area_, GetMetricsRegistry()); - accessor.Read(result, attachment); - } - - ServerContext::DicomCacheLocker::DicomCacheLocker(ServerContext& context, const std::string& instancePublicId) : context_(context),