Mercurial > hg > orthanc
diff OrthancFramework/Sources/FileStorage/IStorageArea.h @ 5080:d7274e43ea7c attach-custom-data
allow plugins to store a customData in the Attachments table to e.g. store custom paths without requiring an external DB
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 08 Sep 2022 17:42:08 +0200 |
parents | 43e613a7756b |
children | 8279eaab0d1d |
line wrap: on
line diff
--- a/OrthancFramework/Sources/FileStorage/IStorageArea.h Wed Aug 31 10:36:38 2022 +0200 +++ b/OrthancFramework/Sources/FileStorage/IStorageArea.h Thu Sep 08 17:42:08 2022 +0200 @@ -32,6 +32,8 @@ namespace Orthanc { + class DicomInstanceToStore; + class IStorageArea : public boost::noncopyable { public: @@ -39,8 +41,92 @@ { } + virtual void CreateInstance(std::string& customData, + const DicomInstanceToStore& instance, + const std::string& uuid, + const void* content, + size_t size, + FileContentType type, + bool isCompressed) = 0; + + virtual void CreateAttachment(std::string& customData, + const std::string& resourceId, + ResourceType resourceLevel, + const std::string& uuid, + const void* content, + size_t size, + FileContentType type, + bool isCompressed) = 0; + + virtual IMemoryBuffer* Read(const std::string& uuid, + FileContentType type, + const std::string& customData) = 0; + + virtual IMemoryBuffer* ReadRange(const std::string& uuid, + FileContentType type, + uint64_t start /* inclusive */, + uint64_t end /* exclusive */, + const std::string& customData) = 0; + + virtual bool HasReadRange() const = 0; + + virtual void Remove(const std::string& uuid, + FileContentType type, + const std::string& customData) = 0; + }; + + // storage area without customData (customData are used only in plugins) + class ICoreStorageArea : public IStorageArea + { + public: + virtual void CreateInstance(std::string& customData, + const DicomInstanceToStore& instance, + const std::string& uuid, + const void* content, + size_t size, + FileContentType type, + bool isCompressed) + { + Create(uuid, content, size, type); + } + + virtual void CreateAttachment(std::string& customData, + const std::string& resourceId, + ResourceType resourceLevel, + const std::string& uuid, + const void* content, + size_t size, + FileContentType type, + bool isCompressed) + { + Create(uuid, content, size, type); + } + + virtual IMemoryBuffer* Read(const std::string& uuid, + FileContentType type, + const std::string& /*customData*/) + { + return Read(uuid, type); + } + + virtual IMemoryBuffer* ReadRange(const std::string& uuid, + FileContentType type, + uint64_t start /* inclusive */, + uint64_t end /* exclusive */, + const std::string& /*customData */) + { + return ReadRange(uuid, type, start, end); + } + + virtual void Remove(const std::string& uuid, + FileContentType type, + const std::string& customData) + { + Remove(uuid, type); + } + virtual void Create(const std::string& uuid, - const void* content, + const void* content, size_t size, FileContentType type) = 0; @@ -52,9 +138,8 @@ uint64_t start /* inclusive */, uint64_t end /* exclusive */) = 0; - virtual bool HasReadRange() const = 0; - virtual void Remove(const std::string& uuid, FileContentType type) = 0; + }; }