comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4441:453cd3a5a0da

better warning about no support of file ranges in storage area
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 09 Jan 2021 13:13:06 +0100
parents eddb212b2df9
children 16392fe89ce0
comparison
equal deleted inserted replaced
4440:eddb212b2df9 4441:453cd3a5a0da
367 PluginsErrorDictionary& errorDictionary) : 367 PluginsErrorDictionary& errorDictionary) :
368 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary), 368 StorageAreaBase(callbacks.create, callbacks.remove, errorDictionary),
369 readWhole_(callbacks.readWhole), 369 readWhole_(callbacks.readWhole),
370 readRange_(callbacks.readRange) 370 readRange_(callbacks.readRange)
371 { 371 {
372 if (readRange_)
373 {
374 LOG(WARNING) << "Performance warning: The storage area plugin doesn't implement reading of file ranges";
375 }
376 } 372 }
377 373
378 virtual void Read(std::string& content, 374 virtual void Read(std::string& content,
379 const std::string& uuid, 375 const std::string& uuid,
380 FileContentType type) ORTHANC_OVERRIDE 376 FileContentType type) ORTHANC_OVERRIDE
408 Version version_; 404 Version version_;
409 _OrthancPluginRegisterStorageArea callbacks_; 405 _OrthancPluginRegisterStorageArea callbacks_;
410 _OrthancPluginRegisterStorageArea2 callbacks2_; 406 _OrthancPluginRegisterStorageArea2 callbacks2_;
411 PluginsErrorDictionary& errorDictionary_; 407 PluginsErrorDictionary& errorDictionary_;
412 408
409 static void WarnNoReadRange()
410 {
411 LOG(WARNING) << "Performance warning: The storage area plugin doesn't implement reading of file ranges";
412 }
413
413 public: 414 public:
414 StorageAreaFactory(SharedLibrary& sharedLibrary, 415 StorageAreaFactory(SharedLibrary& sharedLibrary,
415 const _OrthancPluginRegisterStorageArea& callbacks, 416 const _OrthancPluginRegisterStorageArea& callbacks,
416 PluginsErrorDictionary& errorDictionary) : 417 PluginsErrorDictionary& errorDictionary) :
417 sharedLibrary_(sharedLibrary), 418 sharedLibrary_(sharedLibrary),
418 version_(Version1), 419 version_(Version1),
419 callbacks_(callbacks), 420 callbacks_(callbacks),
420 errorDictionary_(errorDictionary) 421 errorDictionary_(errorDictionary)
421 { 422 {
422 LOG(WARNING) << "Performance warning: The storage area plugin doesn't " 423 WarnNoReadRange();
423 << "use OrthancPluginRegisterStorageArea2()";
424 } 424 }
425 425
426 StorageAreaFactory(SharedLibrary& sharedLibrary, 426 StorageAreaFactory(SharedLibrary& sharedLibrary,
427 const _OrthancPluginRegisterStorageArea2& callbacks, 427 const _OrthancPluginRegisterStorageArea2& callbacks,
428 PluginsErrorDictionary& errorDictionary) : 428 PluginsErrorDictionary& errorDictionary) :
429 sharedLibrary_(sharedLibrary), 429 sharedLibrary_(sharedLibrary),
430 version_(Version2), 430 version_(Version2),
431 callbacks2_(callbacks), 431 callbacks2_(callbacks),
432 errorDictionary_(errorDictionary) 432 errorDictionary_(errorDictionary)
433 { 433 {
434 if (callbacks.readRange == NULL)
435 {
436 WarnNoReadRange();
437 }
434 } 438 }
435 439
436 SharedLibrary& GetSharedLibrary() 440 SharedLibrary& GetSharedLibrary()
437 { 441 {
438 return sharedLibrary_; 442 return sharedLibrary_;