diff 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
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Thu Jan 28 15:54:30 2021 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Thu Jan 28 16:59:40 2021 +0100
@@ -264,6 +264,11 @@
         remove_(remove),
         errorDictionary_(errorDictionary)
       {
+        if (create_ == NULL ||
+            remove_ == NULL)
+        {
+          throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement all the required primitives");
+        }
       }
 
       virtual void Create(const std::string& uuid,
@@ -317,6 +322,10 @@
         read_(callbacks.read),
         free_(callbacks.free)
       {
+        if (read_ == NULL)
+        {
+          throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement the \"Read\" primitive");
+        }
       }
 
       virtual void Read(std::string& content,
@@ -369,6 +378,10 @@
         readWhole_(callbacks.readWhole),
         readRange_(callbacks.readRange)
       {
+        if (readWhole_ == NULL)
+        {
+          throw OrthancException(ErrorCode_Plugin, "Storage area plugin doesn't implement the \"ReadWhole\" primitive");
+        }
       }
 
       virtual void Read(std::string& content,