Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
4603:c125bfd31023 | 4604:2c702cfae274 |
---|---|
1193 int argc_; | 1193 int argc_; |
1194 char** argv_; | 1194 char** argv_; |
1195 std::unique_ptr<OrthancPluginDatabase> database_; | 1195 std::unique_ptr<OrthancPluginDatabase> database_; |
1196 std::unique_ptr<OrthancPluginDatabaseV3> databaseV3_; // New in Orthanc 1.9.2 | 1196 std::unique_ptr<OrthancPluginDatabaseV3> databaseV3_; // New in Orthanc 1.9.2 |
1197 PluginsErrorDictionary dictionary_; | 1197 PluginsErrorDictionary dictionary_; |
1198 | 1198 std::string databaseServerIdentifier_; // New in Orthanc 1.9.2 |
1199 PImpl() : | 1199 |
1200 PImpl(const std::string& databaseServerIdentifier) : | |
1200 context_(NULL), | 1201 context_(NULL), |
1201 findCallback_(NULL), | 1202 findCallback_(NULL), |
1202 worklistCallback_(NULL), | 1203 worklistCallback_(NULL), |
1203 argc_(1), | 1204 argc_(1), |
1204 argv_(NULL) | 1205 argv_(NULL), |
1206 databaseServerIdentifier_(databaseServerIdentifier) | |
1205 { | 1207 { |
1206 memset(&moveCallbacks_, 0, sizeof(moveCallbacks_)); | 1208 memset(&moveCallbacks_, 0, sizeof(moveCallbacks_)); |
1207 } | 1209 } |
1208 }; | 1210 }; |
1209 | 1211 |
1673 } | 1675 } |
1674 } | 1676 } |
1675 }; | 1677 }; |
1676 | 1678 |
1677 | 1679 |
1678 OrthancPlugins::OrthancPlugins() | 1680 OrthancPlugins::OrthancPlugins(const std::string& databaseServerIdentifier) |
1679 { | 1681 { |
1680 /* Sanity check of the compiler */ | 1682 /* Sanity check of the compiler */ |
1681 if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) || | 1683 if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) || |
1682 sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) || | 1684 sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) || |
1683 sizeof(int32_t) != sizeof(_OrthancPluginService) || | 1685 sizeof(int32_t) != sizeof(_OrthancPluginService) || |
1713 | 1715 |
1714 { | 1716 { |
1715 throw OrthancException(ErrorCode_Plugin); | 1717 throw OrthancException(ErrorCode_Plugin); |
1716 } | 1718 } |
1717 | 1719 |
1718 pimpl_.reset(new PImpl()); | 1720 pimpl_.reset(new PImpl(databaseServerIdentifier)); |
1719 pimpl_->manager_.RegisterServiceProvider(*this); | 1721 pimpl_->manager_.RegisterServiceProvider(*this); |
1720 } | 1722 } |
1721 | 1723 |
1722 | 1724 |
1723 void OrthancPlugins::SetServerContext(ServerContext& context) | 1725 void OrthancPlugins::SetServerContext(ServerContext& context) |
4946 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackendV3*>(parameters); | 4948 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackendV3*>(parameters); |
4947 | 4949 |
4948 if (pimpl_->database_.get() == NULL && | 4950 if (pimpl_->database_.get() == NULL && |
4949 pimpl_->databaseV3_.get() == NULL) | 4951 pimpl_->databaseV3_.get() == NULL) |
4950 { | 4952 { |
4951 pimpl_->databaseV3_.reset(new OrthancPluginDatabaseV3(plugin, GetErrorDictionary(), | 4953 pimpl_->databaseV3_.reset(new OrthancPluginDatabaseV3(plugin, GetErrorDictionary(), p.backend, |
4952 p.backend, p.backendSize, p.database)); | 4954 p.backendSize, p.database, pimpl_->databaseServerIdentifier_)); |
4953 } | 4955 } |
4954 else | 4956 else |
4955 { | 4957 { |
4956 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered); | 4958 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered); |
4957 } | 4959 } |