diff OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4604:2c702cfae274 db-changes

New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 10:39:59 +0200
parents c125bfd31023
children d01702fb29a9
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Wed Mar 24 15:30:06 2021 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Tue Mar 30 10:39:59 2021 +0200
@@ -1195,13 +1195,15 @@
     std::unique_ptr<OrthancPluginDatabase>  database_;
     std::unique_ptr<OrthancPluginDatabaseV3>  databaseV3_;  // New in Orthanc 1.9.2
     PluginsErrorDictionary  dictionary_;
-
-    PImpl() : 
+    std::string databaseServerIdentifier_;   // New in Orthanc 1.9.2
+
+    PImpl(const std::string& databaseServerIdentifier) : 
       context_(NULL), 
       findCallback_(NULL),
       worklistCallback_(NULL),
       argc_(1),
-      argv_(NULL)
+      argv_(NULL),
+      databaseServerIdentifier_(databaseServerIdentifier)
     {
       memset(&moveCallbacks_, 0, sizeof(moveCallbacks_));
     }
@@ -1675,7 +1677,7 @@
   };
 
 
-  OrthancPlugins::OrthancPlugins()
+  OrthancPlugins::OrthancPlugins(const std::string& databaseServerIdentifier)
   {
     /* Sanity check of the compiler */
     if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) ||
@@ -1715,7 +1717,7 @@
       throw OrthancException(ErrorCode_Plugin);
     }
 
-    pimpl_.reset(new PImpl());
+    pimpl_.reset(new PImpl(databaseServerIdentifier));
     pimpl_->manager_.RegisterServiceProvider(*this);
   }
 
@@ -4948,8 +4950,8 @@
         if (pimpl_->database_.get() == NULL &&
             pimpl_->databaseV3_.get() == NULL)
         {
-          pimpl_->databaseV3_.reset(new OrthancPluginDatabaseV3(plugin, GetErrorDictionary(),
-                                                                p.backend, p.backendSize, p.database));
+          pimpl_->databaseV3_.reset(new OrthancPluginDatabaseV3(plugin, GetErrorDictionary(), p.backend,
+                                                                p.backendSize, p.database, pimpl_->databaseServerIdentifier_));
         }
         else
         {