comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4483:a926f8995d0b

sample for OrthancPluginRegisterStorageArea2()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Jan 2021 16:59:40 +0100
parents 0a2c9790cb41
children 64f06e7d5fc7
comparison
equal deleted inserted replaced
4482:8efeaba1b7f9 4483:a926f8995d0b
262 PluginsErrorDictionary& errorDictionary) : 262 PluginsErrorDictionary& errorDictionary) :
263 create_(create), 263 create_(create),
264 remove_(remove), 264 remove_(remove),
265 errorDictionary_(errorDictionary) 265 errorDictionary_(errorDictionary)
266 { 266 {
267 if (create_ == NULL ||
268 remove_ == NULL)
269 {
270 throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement all the required primitives");
271 }
267 } 272 }
268 273
269 virtual void Create(const std::string& uuid, 274 virtual void Create(const std::string& uuid,
270 const void* content, 275 const void* content,
271 size_t size, 276 size_t size,
315 PluginsErrorDictionary& errorDictionary) : 320 PluginsErrorDictionary& errorDictionary) :
316 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary), 321 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary),
317 read_(callbacks.read), 322 read_(callbacks.read),
318 free_(callbacks.free) 323 free_(callbacks.free)
319 { 324 {
325 if (read_ == NULL)
326 {
327 throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement the \"Read\" primitive");
328 }
320 } 329 }
321 330
322 virtual void Read(std::string& content, 331 virtual void Read(std::string& content,
323 const std::string& uuid, 332 const std::string& uuid,
324 FileContentType type) ORTHANC_OVERRIDE 333 FileContentType type) ORTHANC_OVERRIDE
367 PluginsErrorDictionary& errorDictionary) : 376 PluginsErrorDictionary& errorDictionary) :
368 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary), 377 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary),
369 readWhole_(callbacks.readWhole), 378 readWhole_(callbacks.readWhole),
370 readRange_(callbacks.readRange) 379 readRange_(callbacks.readRange)
371 { 380 {
381 if (readWhole_ == NULL)
382 {
383 throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement the \"ReadWhole\" primitive");
384 }
372 } 385 }
373 386
374 virtual void Read(std::string& content, 387 virtual void Read(std::string& content,
375 const std::string& uuid, 388 const std::string& uuid,
376 FileContentType type) ORTHANC_OVERRIDE 389 FileContentType type) ORTHANC_OVERRIDE