Mercurial > hg > orthanc
changeset 5893:1c23f71858a2 find-refactoring
removed useless class BaseDatabaseWrapper
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 30 Nov 2024 21:53:37 +0100 |
parents | e92f196afd04 |
children | cdb8b2a3aad5 |
files | OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp OrthancServer/Plugins/Engine/OrthancPluginDatabase.h OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.h OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp OrthancServer/Sources/Database/BaseDatabaseWrapper.h OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h |
diffstat | 7 files changed, 94 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp Sat Nov 30 21:33:10 2024 +0100 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp Sat Nov 30 21:53:37 2024 +0100 @@ -44,7 +44,7 @@ namespace Orthanc { class OrthancPluginDatabase::Transaction : - public BaseDatabaseWrapper::BaseTransaction, + public BaseTransaction, public Compatibility::ICreateInstance, public Compatibility::IGetChildrenMetadata, public Compatibility::ILookupResources, @@ -1660,4 +1660,9 @@ LOG(WARNING) << "Received an answer from the database index plugin, but not transaction is active"; } } + + uint64_t OrthancPluginDatabase::MeasureLatency() + { + throw OrthancException(ErrorCode_NotImplemented); + } }
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabase.h Sat Nov 30 21:33:10 2024 +0100 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabase.h Sat Nov 30 21:53:37 2024 +0100 @@ -46,7 +46,7 @@ * able to rollback the modifications. Read-only accesses didn't * start a transaction, as they were protected by the global mutex. **/ - class OrthancPluginDatabase : public BaseDatabaseWrapper + class OrthancPluginDatabase : public IDatabaseWrapper { private: class Transaction; @@ -111,6 +111,13 @@ } void AnswerReceived(const _OrthancPluginDatabaseAnswer& answer); + + uint64_t MeasureLatency() ORTHANC_OVERRIDE; + + bool HasIntegratedFind() const ORTHANC_OVERRIDE + { + return false; + } }; }
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Sat Nov 30 21:33:10 2024 +0100 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Sat Nov 30 21:53:37 2024 +0100 @@ -46,8 +46,7 @@ namespace Orthanc { - class OrthancPluginDatabaseV3::Transaction : - public BaseDatabaseWrapper::BaseTransaction + class OrthancPluginDatabaseV3::Transaction : public BaseTransaction { private: OrthancPluginDatabaseV3& that_; @@ -1257,4 +1256,9 @@ } } + uint64_t OrthancPluginDatabaseV3::MeasureLatency() + { + throw OrthancException(ErrorCode_NotImplemented); + } + }
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.h Sat Nov 30 21:33:10 2024 +0100 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.h Sat Nov 30 21:53:37 2024 +0100 @@ -32,7 +32,7 @@ namespace Orthanc { - class OrthancPluginDatabaseV3 : public BaseDatabaseWrapper + class OrthancPluginDatabaseV3 : public IDatabaseWrapper { private: class Transaction; @@ -82,6 +82,13 @@ { return dbCapabilities_; } + + uint64_t MeasureLatency() ORTHANC_OVERRIDE; + + bool HasIntegratedFind() const ORTHANC_OVERRIDE + { + return false; + } }; }
--- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp Sat Nov 30 21:33:10 2024 +0100 +++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp Sat Nov 30 21:53:37 2024 +0100 @@ -28,77 +28,66 @@ namespace Orthanc { - int64_t BaseDatabaseWrapper::BaseTransaction::IncrementGlobalProperty(GlobalProperty property, - int64_t increment, - bool shared) + int64_t BaseTransaction::IncrementGlobalProperty(GlobalProperty property, + int64_t increment, + bool shared) { throw OrthancException(ErrorCode_NotImplemented); // Not supported } - - void BaseDatabaseWrapper::BaseTransaction::UpdateAndGetStatistics(int64_t& patientsCount, - int64_t& studiesCount, - int64_t& seriesCount, - int64_t& instancesCount, - int64_t& compressedSize, - int64_t& uncompressedSize) + void BaseTransaction::UpdateAndGetStatistics(int64_t& patientsCount, + int64_t& studiesCount, + int64_t& seriesCount, + int64_t& instancesCount, + int64_t& compressedSize, + int64_t& uncompressedSize) { throw OrthancException(ErrorCode_NotImplemented); // Not supported } - void BaseDatabaseWrapper::BaseTransaction::PerformDbHousekeeping() + void BaseTransaction::PerformDbHousekeeping() { throw OrthancException(ErrorCode_NotImplemented); // Not supported } - void BaseDatabaseWrapper::BaseTransaction::GetChangesExtended(std::list<ServerIndexChange>& target /*out*/, - bool& done /*out*/, - int64_t since, - int64_t to, - uint32_t limit, - const std::set<ChangeType>& filterType) + void BaseTransaction::GetChangesExtended(std::list<ServerIndexChange>& target /*out*/, + bool& done /*out*/, + int64_t since, + int64_t to, + uint32_t limit, + const std::set<ChangeType>& filterType) { throw OrthancException(ErrorCode_NotImplemented); // Not supported } - - - void BaseDatabaseWrapper::BaseTransaction::ExecuteCount(uint64_t& count, - const FindRequest& request, - const Capabilities& capabilities) + void BaseTransaction::ExecuteCount(uint64_t& count, + const FindRequest& request, + const IDatabaseWrapper::Capabilities& capabilities) { throw OrthancException(ErrorCode_NotImplemented); // Not supported } - void BaseDatabaseWrapper::BaseTransaction::ExecuteFind(FindResponse& response, - const FindRequest& request, - const Capabilities& capabilities) + void BaseTransaction::ExecuteFind(FindResponse& response, + const FindRequest& request, + const IDatabaseWrapper::Capabilities& capabilities) { throw OrthancException(ErrorCode_NotImplemented); // Not supported } - - - void BaseDatabaseWrapper::BaseTransaction::ExecuteFind(std::list<std::string>& identifiers, - const Capabilities& capabilities, - const FindRequest& request) + + void BaseTransaction::ExecuteFind(std::list<std::string>& identifiers, + const IDatabaseWrapper::Capabilities& capabilities, + const FindRequest& request) { Compatibility::GenericFind find(*this, *this); find.ExecuteFind(identifiers, capabilities, request); } - - void BaseDatabaseWrapper::BaseTransaction::ExecuteExpand(FindResponse& response, - const Capabilities& capabilities, - const FindRequest& request, - const std::string& identifier) + void BaseTransaction::ExecuteExpand(FindResponse& response, + const IDatabaseWrapper::Capabilities& capabilities, + const FindRequest& request, + const std::string& identifier) { Compatibility::GenericFind find(*this, *this); find.ExecuteExpand(response, capabilities, request, identifier); } - - - uint64_t BaseDatabaseWrapper::MeasureLatency() - { - throw OrthancException(ErrorCode_NotImplemented); // only implemented in V4 - } }
--- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.h Sat Nov 30 21:33:10 2024 +0100 +++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.h Sat Nov 30 21:53:37 2024 +0100 @@ -31,57 +31,48 @@ * This class provides a default "not implemented" implementation * for all recent methods (1.12.X) **/ - class BaseDatabaseWrapper : public IDatabaseWrapper + + class BaseTransaction : + public IDatabaseWrapper::ITransaction, + public IDatabaseWrapper::ICompatibilityTransaction { public: - class BaseTransaction : - public IDatabaseWrapper::ITransaction, - public IDatabaseWrapper::ICompatibilityTransaction - { - public: - virtual int64_t IncrementGlobalProperty(GlobalProperty property, - int64_t increment, - bool shared) ORTHANC_OVERRIDE; + virtual int64_t IncrementGlobalProperty(GlobalProperty property, + int64_t increment, + bool shared) ORTHANC_OVERRIDE; - virtual void UpdateAndGetStatistics(int64_t& patientsCount, - int64_t& studiesCount, - int64_t& seriesCount, - int64_t& instancesCount, - int64_t& compressedSize, - int64_t& uncompressedSize) ORTHANC_OVERRIDE; + virtual void UpdateAndGetStatistics(int64_t& patientsCount, + int64_t& studiesCount, + int64_t& seriesCount, + int64_t& instancesCount, + int64_t& compressedSize, + int64_t& uncompressedSize) ORTHANC_OVERRIDE; - virtual void PerformDbHousekeeping() ORTHANC_OVERRIDE; + virtual void PerformDbHousekeeping() ORTHANC_OVERRIDE; - virtual void ExecuteCount(uint64_t& count, - const FindRequest& request, - const Capabilities& capabilities) ORTHANC_OVERRIDE; - - virtual void ExecuteFind(FindResponse& response, - const FindRequest& request, - const Capabilities& capabilities) ORTHANC_OVERRIDE; + virtual void ExecuteCount(uint64_t& count, + const FindRequest& request, + const IDatabaseWrapper::Capabilities& capabilities) ORTHANC_OVERRIDE; - virtual void ExecuteFind(std::list<std::string>& identifiers, - const Capabilities& capabilities, - const FindRequest& request) ORTHANC_OVERRIDE; + virtual void ExecuteFind(FindResponse& response, + const FindRequest& request, + const IDatabaseWrapper::Capabilities& capabilities) ORTHANC_OVERRIDE; - virtual void ExecuteExpand(FindResponse& response, - const Capabilities& capabilities, - const FindRequest& request, - const std::string& identifier) ORTHANC_OVERRIDE; + virtual void ExecuteFind(std::list<std::string>& identifiers, + const IDatabaseWrapper::Capabilities& capabilities, + const FindRequest& request) ORTHANC_OVERRIDE; - virtual void GetChangesExtended(std::list<ServerIndexChange>& target /*out*/, - bool& done /*out*/, - int64_t since, - int64_t to, - uint32_t limit, - const std::set<ChangeType>& filterType) ORTHANC_OVERRIDE; - }; + virtual void ExecuteExpand(FindResponse& response, + const IDatabaseWrapper::Capabilities& capabilities, + const FindRequest& request, + const std::string& identifier) ORTHANC_OVERRIDE; - virtual uint64_t MeasureLatency() ORTHANC_OVERRIDE; + virtual void GetChangesExtended(std::list<ServerIndexChange>& target /*out*/, + bool& done /*out*/, + int64_t since, + int64_t to, + uint32_t limit, + const std::set<ChangeType>& filterType) ORTHANC_OVERRIDE; + }; - virtual bool HasIntegratedFind() const ORTHANC_OVERRIDE - { - return false; - } - }; }
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h Sat Nov 30 21:33:10 2024 +0100 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h Sat Nov 30 21:53:37 2024 +0100 @@ -36,7 +36,7 @@ * translates low-level requests into SQL statements. Mutual * exclusion MUST be implemented at a higher level. **/ - class SQLiteDatabaseWrapper : public BaseDatabaseWrapper + class SQLiteDatabaseWrapper : public IDatabaseWrapper { private: class TransactionBase; @@ -112,7 +112,7 @@ * "UnitTestsTransaction" give access to additional information * about the underlying SQLite database to be used in unit tests. **/ - class UnitTestsTransaction : public BaseDatabaseWrapper::BaseTransaction + class UnitTestsTransaction : public BaseTransaction { protected: SQLite::Connection& db_;