comparison Plugins/Engine/OrthancPluginDatabase.h @ 3050:d8a91acb7424 db-changes

working on a database compatibility layer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 Dec 2018 16:42:35 +0100
parents 53d583d2c775
children 39db63e68dcf
comparison
equal deleted inserted replaced
3049:6a2c7e206ebb 3050:d8a91acb7424
94 const OrthancPluginDatabaseBackend& backend, 94 const OrthancPluginDatabaseBackend& backend,
95 const OrthancPluginDatabaseExtensions* extensions, 95 const OrthancPluginDatabaseExtensions* extensions,
96 size_t extensionsSize, 96 size_t extensionsSize,
97 void *payload); 97 void *payload);
98 98
99 virtual void Open(); 99 virtual void Open()
100 100 ORTHANC_OVERRIDE;
101 virtual void Close() 101
102 virtual void Close()
103 ORTHANC_OVERRIDE
102 { 104 {
103 CheckSuccess(backend_.close(payload_)); 105 CheckSuccess(backend_.close(payload_));
104 } 106 }
105 107
106 const SharedLibrary& GetSharedLibrary() const 108 const SharedLibrary& GetSharedLibrary() const
107 { 109 {
108 return library_; 110 return library_;
109 } 111 }
110 112
111 virtual void AddAttachment(int64_t id, 113 virtual void AddAttachment(int64_t id,
112 const FileInfo& attachment); 114 const FileInfo& attachment)
115 ORTHANC_OVERRIDE;
113 116
114 virtual void AttachChild(int64_t parent, 117 virtual void AttachChild(int64_t parent,
115 int64_t child); 118 int64_t child)
116 119 ORTHANC_OVERRIDE;
117 virtual void ClearChanges(); 120
118 121 virtual void ClearChanges()
119 virtual void ClearExportedResources(); 122 ORTHANC_OVERRIDE;
123
124 virtual void ClearExportedResources()
125 ORTHANC_OVERRIDE;
120 126
121 virtual int64_t CreateResource(const std::string& publicId, 127 virtual int64_t CreateResource(const std::string& publicId,
122 ResourceType type); 128 ResourceType type)
129 ORTHANC_OVERRIDE;
123 130
124 virtual void DeleteAttachment(int64_t id, 131 virtual void DeleteAttachment(int64_t id,
125 FileContentType attachment); 132 FileContentType attachment)
133 ORTHANC_OVERRIDE;
126 134
127 virtual void DeleteMetadata(int64_t id, 135 virtual void DeleteMetadata(int64_t id,
128 MetadataType type); 136 MetadataType type)
129 137 ORTHANC_OVERRIDE;
130 virtual void DeleteResource(int64_t id); 138
131 139 virtual void DeleteResource(int64_t id)
132 virtual void FlushToDisk() 140 ORTHANC_OVERRIDE;
133 { 141
134 } 142 virtual void FlushToDisk()
135 143 ORTHANC_OVERRIDE
136 virtual bool HasFlushToDisk() const 144 {
145 }
146
147 virtual bool HasFlushToDisk() const
148 ORTHANC_OVERRIDE
137 { 149 {
138 return false; 150 return false;
139 } 151 }
140 152
141 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, 153 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target,
142 int64_t id); 154 int64_t id)
155 ORTHANC_OVERRIDE;
143 156
144 virtual void GetAllInternalIds(std::list<int64_t>& target, 157 virtual void GetAllInternalIds(std::list<int64_t>& target,
145 ResourceType resourceType); 158 ResourceType resourceType)
159 ORTHANC_OVERRIDE;
146 160
147 virtual void GetAllPublicIds(std::list<std::string>& target, 161 virtual void GetAllPublicIds(std::list<std::string>& target,
148 ResourceType resourceType); 162 ResourceType resourceType)
163 ORTHANC_OVERRIDE;
149 164
150 virtual void GetAllPublicIds(std::list<std::string>& target, 165 virtual void GetAllPublicIds(std::list<std::string>& target,
151 ResourceType resourceType, 166 ResourceType resourceType,
152 size_t since, 167 size_t since,
153 size_t limit); 168 size_t limit)
169 ORTHANC_OVERRIDE;
154 170
155 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, 171 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/,
156 bool& done /*out*/, 172 bool& done /*out*/,
157 int64_t since, 173 int64_t since,
158 uint32_t maxResults); 174 uint32_t maxResults)
175 ORTHANC_OVERRIDE;
159 176
160 virtual void GetChildrenInternalId(std::list<int64_t>& target, 177 virtual void GetChildrenInternalId(std::list<int64_t>& target,
161 int64_t id); 178 int64_t id)
179 ORTHANC_OVERRIDE;
162 180
163 virtual void GetChildrenPublicId(std::list<std::string>& target, 181 virtual void GetChildrenPublicId(std::list<std::string>& target,
164 int64_t id); 182 int64_t id)
183 ORTHANC_OVERRIDE;
165 184
166 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, 185 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/,
167 bool& done /*out*/, 186 bool& done /*out*/,
168 int64_t since, 187 int64_t since,
169 uint32_t maxResults); 188 uint32_t maxResults)
170 189 ORTHANC_OVERRIDE;
171 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/); 190
172 191 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/)
173 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/); 192 ORTHANC_OVERRIDE;
193
194 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/)
195 ORTHANC_OVERRIDE;
174 196
175 virtual void GetMainDicomTags(DicomMap& map, 197 virtual void GetMainDicomTags(DicomMap& map,
176 int64_t id); 198 int64_t id)
177 199 ORTHANC_OVERRIDE;
178 virtual std::string GetPublicId(int64_t resourceId); 200
179 201 virtual std::string GetPublicId(int64_t resourceId)
180 virtual uint64_t GetResourceCount(ResourceType resourceType); 202 ORTHANC_OVERRIDE;
181 203
182 virtual ResourceType GetResourceType(int64_t resourceId); 204 virtual uint64_t GetResourceCount(ResourceType resourceType)
183 205 ORTHANC_OVERRIDE;
184 virtual uint64_t GetTotalCompressedSize(); 206
207 virtual ResourceType GetResourceType(int64_t resourceId)
208 ORTHANC_OVERRIDE;
209
210 virtual uint64_t GetTotalCompressedSize()
211 ORTHANC_OVERRIDE;
185 212
186 virtual uint64_t GetTotalUncompressedSize(); 213 virtual uint64_t GetTotalUncompressedSize()
187 214 ORTHANC_OVERRIDE;
188 virtual bool IsExistingResource(int64_t internalId); 215
189 216 virtual bool IsExistingResource(int64_t internalId)
190 virtual bool IsProtectedPatient(int64_t internalId); 217 ORTHANC_OVERRIDE;
218
219 virtual bool IsProtectedPatient(int64_t internalId)
220 ORTHANC_OVERRIDE;
191 221
192 virtual void ListAvailableMetadata(std::list<MetadataType>& target, 222 virtual void ListAvailableMetadata(std::list<MetadataType>& target,
193 int64_t id); 223 int64_t id)
224 ORTHANC_OVERRIDE;
194 225
195 virtual void ListAvailableAttachments(std::list<FileContentType>& target, 226 virtual void ListAvailableAttachments(std::list<FileContentType>& target,
196 int64_t id); 227 int64_t id)
228 ORTHANC_OVERRIDE;
197 229
198 virtual void LogChange(int64_t internalId, 230 virtual void LogChange(int64_t internalId,
199 const ServerIndexChange& change); 231 const ServerIndexChange& change)
200 232 ORTHANC_OVERRIDE;
201 virtual void LogExportedResource(const ExportedResource& resource); 233
234 virtual void LogExportedResource(const ExportedResource& resource)
235 ORTHANC_OVERRIDE;
202 236
203 virtual bool LookupAttachment(FileInfo& attachment, 237 virtual bool LookupAttachment(FileInfo& attachment,
204 int64_t id, 238 int64_t id,
205 FileContentType contentType); 239 FileContentType contentType)
240 ORTHANC_OVERRIDE;
206 241
207 virtual bool LookupGlobalProperty(std::string& target, 242 virtual bool LookupGlobalProperty(std::string& target,
208 GlobalProperty property); 243 GlobalProperty property)
244 ORTHANC_OVERRIDE;
209 245
210 virtual bool LookupMetadata(std::string& target, 246 virtual bool LookupMetadata(std::string& target,
211 int64_t id, 247 int64_t id,
212 MetadataType type); 248 MetadataType type)
249 ORTHANC_OVERRIDE;
213 250
214 virtual bool LookupParent(int64_t& parentId, 251 virtual bool LookupParent(int64_t& parentId,
215 int64_t resourceId); 252 int64_t resourceId)
253 ORTHANC_OVERRIDE;
216 254
217 virtual bool LookupResource(int64_t& id, 255 virtual bool LookupResource(int64_t& id,
218 ResourceType& type, 256 ResourceType& type,
219 const std::string& publicId); 257 const std::string& publicId)
220 258 ORTHANC_OVERRIDE;
221 virtual bool SelectPatientToRecycle(int64_t& internalId); 259
260 virtual bool SelectPatientToRecycle(int64_t& internalId)
261 ORTHANC_OVERRIDE;
222 262
223 virtual bool SelectPatientToRecycle(int64_t& internalId, 263 virtual bool SelectPatientToRecycle(int64_t& internalId,
224 int64_t patientIdToAvoid); 264 int64_t patientIdToAvoid)
265 ORTHANC_OVERRIDE;
225 266
226 virtual void SetGlobalProperty(GlobalProperty property, 267 virtual void SetGlobalProperty(GlobalProperty property,
227 const std::string& value); 268 const std::string& value)
228 269 ORTHANC_OVERRIDE;
229 virtual void ClearMainDicomTags(int64_t id); 270
271 virtual void ClearMainDicomTags(int64_t id)
272 ORTHANC_OVERRIDE;
230 273
231 virtual void SetMainDicomTag(int64_t id, 274 virtual void SetMainDicomTag(int64_t id,
232 const DicomTag& tag, 275 const DicomTag& tag,
233 const std::string& value); 276 const std::string& value)
277 ORTHANC_OVERRIDE;
234 278
235 virtual void SetIdentifierTag(int64_t id, 279 virtual void SetIdentifierTag(int64_t id,
236 const DicomTag& tag, 280 const DicomTag& tag,
237 const std::string& value); 281 const std::string& value)
282 ORTHANC_OVERRIDE;
238 283
239 virtual void SetMetadata(int64_t id, 284 virtual void SetMetadata(int64_t id,
240 MetadataType type, 285 MetadataType type,
241 const std::string& value); 286 const std::string& value)
287 ORTHANC_OVERRIDE;
242 288
243 virtual void SetProtectedPatient(int64_t internalId, 289 virtual void SetProtectedPatient(int64_t internalId,
244 bool isProtected); 290 bool isProtected)
245 291 ORTHANC_OVERRIDE;
246 virtual IDatabaseWrapper::ITransaction* StartTransaction(); 292
247 293 virtual IDatabaseWrapper::ITransaction* StartTransaction()
248 virtual void SetListener(IDatabaseListener& listener) 294 ORTHANC_OVERRIDE;
295
296 virtual void SetListener(IDatabaseListener& listener)
297 ORTHANC_OVERRIDE
249 { 298 {
250 listener_ = &listener; 299 listener_ = &listener;
251 } 300 }
252 301
253 virtual unsigned int GetDatabaseVersion(); 302 virtual unsigned int GetDatabaseVersion()
303 ORTHANC_OVERRIDE;
254 304
255 virtual void Upgrade(unsigned int targetVersion, 305 virtual void Upgrade(unsigned int targetVersion,
256 IStorageArea& storageArea); 306 IStorageArea& storageArea)
257 307 ORTHANC_OVERRIDE;
258 void AnswerReceived(const _OrthancPluginDatabaseAnswer& answer); 308
259 309 void AnswerReceived(const _OrthancPluginDatabaseAnswer& answer)
260 virtual bool IsDiskSizeAbove(uint64_t threshold); 310 ORTHANC_OVERRIDE;
311
312 virtual bool IsDiskSizeAbove(uint64_t threshold)
313 ORTHANC_OVERRIDE;
261 314
262 virtual void ApplyLookupResources(std::vector<std::string>& patientsId, 315 virtual void ApplyLookupResources(std::vector<std::string>& patientsId,
263 std::vector<std::string>* instancesId, 316 std::vector<std::string>* instancesId,
264 const std::vector<DatabaseConstraint>& lookup, 317 const std::vector<DatabaseConstraint>& lookup,
265 ResourceType queryLevel, 318 ResourceType queryLevel,
266 size_t limit); 319 size_t limit)
320 ORTHANC_OVERRIDE;
321
322 // From the "CompatibilityDatabaseWrapper" interface
323 virtual void LookupIdentifier(std::list<int64_t>& result,
324 ResourceType level,
325 const DicomTag& tag,
326 IdentifierConstraintType type,
327 const std::string& value)
328 ORTHANC_OVERRIDE;
329
330 // From the "CompatibilityDatabaseWrapper" interface
331 virtual void LookupIdentifierRange(std::list<int64_t>& result,
332 ResourceType level,
333 const DicomTag& tag,
334 const std::string& start,
335 const std::string& end)
336 ORTHANC_OVERRIDE;
267 }; 337 };
268 } 338 }
269 339
270 #endif 340 #endif