Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
5079:4366b4c41441 | 5080:d7274e43ea7c |
---|---|
30 #include <string> | 30 #include <string> |
31 | 31 |
32 | 32 |
33 namespace Orthanc | 33 namespace Orthanc |
34 { | 34 { |
35 class DicomInstanceToStore; | |
36 | |
35 class IStorageArea : public boost::noncopyable | 37 class IStorageArea : public boost::noncopyable |
36 { | 38 { |
37 public: | 39 public: |
38 virtual ~IStorageArea() | 40 virtual ~IStorageArea() |
39 { | 41 { |
40 } | 42 } |
41 | 43 |
44 virtual void CreateInstance(std::string& customData, | |
45 const DicomInstanceToStore& instance, | |
46 const std::string& uuid, | |
47 const void* content, | |
48 size_t size, | |
49 FileContentType type, | |
50 bool isCompressed) = 0; | |
51 | |
52 virtual void CreateAttachment(std::string& customData, | |
53 const std::string& resourceId, | |
54 ResourceType resourceLevel, | |
55 const std::string& uuid, | |
56 const void* content, | |
57 size_t size, | |
58 FileContentType type, | |
59 bool isCompressed) = 0; | |
60 | |
61 virtual IMemoryBuffer* Read(const std::string& uuid, | |
62 FileContentType type, | |
63 const std::string& customData) = 0; | |
64 | |
65 virtual IMemoryBuffer* ReadRange(const std::string& uuid, | |
66 FileContentType type, | |
67 uint64_t start /* inclusive */, | |
68 uint64_t end /* exclusive */, | |
69 const std::string& customData) = 0; | |
70 | |
71 virtual bool HasReadRange() const = 0; | |
72 | |
73 virtual void Remove(const std::string& uuid, | |
74 FileContentType type, | |
75 const std::string& customData) = 0; | |
76 }; | |
77 | |
78 // storage area without customData (customData are used only in plugins) | |
79 class ICoreStorageArea : public IStorageArea | |
80 { | |
81 public: | |
82 virtual void CreateInstance(std::string& customData, | |
83 const DicomInstanceToStore& instance, | |
84 const std::string& uuid, | |
85 const void* content, | |
86 size_t size, | |
87 FileContentType type, | |
88 bool isCompressed) | |
89 { | |
90 Create(uuid, content, size, type); | |
91 } | |
92 | |
93 virtual void CreateAttachment(std::string& customData, | |
94 const std::string& resourceId, | |
95 ResourceType resourceLevel, | |
96 const std::string& uuid, | |
97 const void* content, | |
98 size_t size, | |
99 FileContentType type, | |
100 bool isCompressed) | |
101 { | |
102 Create(uuid, content, size, type); | |
103 } | |
104 | |
105 virtual IMemoryBuffer* Read(const std::string& uuid, | |
106 FileContentType type, | |
107 const std::string& /*customData*/) | |
108 { | |
109 return Read(uuid, type); | |
110 } | |
111 | |
112 virtual IMemoryBuffer* ReadRange(const std::string& uuid, | |
113 FileContentType type, | |
114 uint64_t start /* inclusive */, | |
115 uint64_t end /* exclusive */, | |
116 const std::string& /*customData */) | |
117 { | |
118 return ReadRange(uuid, type, start, end); | |
119 } | |
120 | |
121 virtual void Remove(const std::string& uuid, | |
122 FileContentType type, | |
123 const std::string& customData) | |
124 { | |
125 Remove(uuid, type); | |
126 } | |
127 | |
42 virtual void Create(const std::string& uuid, | 128 virtual void Create(const std::string& uuid, |
43 const void* content, | 129 const void* content, |
44 size_t size, | 130 size_t size, |
45 FileContentType type) = 0; | 131 FileContentType type) = 0; |
46 | 132 |
47 virtual IMemoryBuffer* Read(const std::string& uuid, | 133 virtual IMemoryBuffer* Read(const std::string& uuid, |
48 FileContentType type) = 0; | 134 FileContentType type) = 0; |
50 virtual IMemoryBuffer* ReadRange(const std::string& uuid, | 136 virtual IMemoryBuffer* ReadRange(const std::string& uuid, |
51 FileContentType type, | 137 FileContentType type, |
52 uint64_t start /* inclusive */, | 138 uint64_t start /* inclusive */, |
53 uint64_t end /* exclusive */) = 0; | 139 uint64_t end /* exclusive */) = 0; |
54 | 140 |
55 virtual bool HasReadRange() const = 0; | |
56 | |
57 virtual void Remove(const std::string& uuid, | 141 virtual void Remove(const std::string& uuid, |
58 FileContentType type) = 0; | 142 FileContentType type) = 0; |
143 | |
59 }; | 144 }; |
60 } | 145 } |