# HG changeset patch # User Alain Mazy # Date 1727100413 -7200 # Node ID 77c8544bbd7df2374ea0bf28eff374ade0351d28 # Parent 22bbce1f88ff7f79ed1a16b7ab89243b21b6ed05# Parent a7f841fc4a9f00567430ef929c15f28913298f90 merge diff -r 22bbce1f88ff -r 77c8544bbd7d Framework/Plugins/DatabaseBackendAdapterV4.cpp --- a/Framework/Plugins/DatabaseBackendAdapterV4.cpp Mon Sep 23 16:03:24 2024 +0200 +++ b/Framework/Plugins/DatabaseBackendAdapterV4.cpp Mon Sep 23 16:06:53 2024 +0200 @@ -27,6 +27,7 @@ # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) #include "IndexConnectionsPool.h" +#include "MessagesToolbox.h" #include // Include protobuf messages @@ -97,7 +98,6 @@ Orthanc::DatabasePluginMessages::DeleteAttachment::Response* deleteAttachment_; Orthanc::DatabasePluginMessages::DeleteResource::Response* deleteResource_; Orthanc::DatabasePluginMessages::GetChanges::Response* getChanges_; - Orthanc::DatabasePluginMessages::GetChangesExtended::Response* getChangesExtended_; Orthanc::DatabasePluginMessages::GetExportedResources::Response* getExportedResources_; Orthanc::DatabasePluginMessages::GetLastChange::Response* getLastChange_; Orthanc::DatabasePluginMessages::GetLastExportedResource::Response* getLastExportedResource_; @@ -105,18 +105,25 @@ Orthanc::DatabasePluginMessages::LookupAttachment::Response* lookupAttachment_; Orthanc::DatabasePluginMessages::LookupResources::Response* lookupResources_; +#if ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED == 1 + Orthanc::DatabasePluginMessages::GetChangesExtended::Response* getChangesExtended_; +#endif + void Clear() { deleteAttachment_ = NULL; deleteResource_ = NULL; getChanges_ = NULL; - getChangesExtended_ = NULL; getExportedResources_ = NULL; getLastChange_ = NULL; getLastExportedResource_ = NULL; getMainDicomTags_ = NULL; lookupAttachment_ = NULL; lookupResources_ = NULL; + +#if ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED == 1 + getChangesExtended_ = NULL; +#endif } public: @@ -138,11 +145,13 @@ getChanges_ = &getChanges; } +#if ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED == 1 Output(Orthanc::DatabasePluginMessages::GetChangesExtended::Response& getChangesExtended) { Clear(); getChangesExtended_ = &getChangesExtended; } +#endif Output(Orthanc::DatabasePluginMessages::GetExportedResources::Response& getExportedResources) { @@ -296,10 +305,12 @@ { change = getChanges_->add_changes(); } +#if ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED == 1 else if (getChangesExtended_ != NULL) { change = getChangesExtended_->add_changes(); } +#endif else if (getLastChange_ != NULL) { if (getLastChange_->found()) @@ -429,7 +440,7 @@ response.mutable_get_system_information()->set_has_measure_latency(accessor.GetBackend().HasMeasureLatency()); #endif -#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) +#if ORTHANC_PLUGINS_HAS_INTEGRATED_FIND == 1 response.mutable_get_system_information()->set_supports_find(accessor.GetBackend().HasFindSupport()); response.mutable_get_system_information()->set_has_extended_changes(accessor.GetBackend().HasExtendedChanges()); #endif @@ -777,7 +788,7 @@ response.mutable_get_changes()->set_done(done); break; } -#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) +#if ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED == 1 case Orthanc::DatabasePluginMessages::OPERATION_GET_CHANGES_EXTENDED: { Output output(*response.mutable_get_changes_extended()); @@ -1310,11 +1321,13 @@ break; } +#if ORTHANC_PLUGINS_HAS_INTEGRATED_FIND == 1 case Orthanc::DatabasePluginMessages::OPERATION_FIND: { backend.ExecuteFind(response, manager, request.find()); break; } +#endif default: LOG(ERROR) << "Not implemented transaction operation from protobuf: " << request.operation(); diff -r 22bbce1f88ff -r 77c8544bbd7d Framework/Plugins/IndexBackend.cpp --- a/Framework/Plugins/IndexBackend.cpp Mon Sep 23 16:03:24 2024 +0200 +++ b/Framework/Plugins/IndexBackend.cpp Mon Sep 23 16:06:53 2024 +0200 @@ -125,13 +125,7 @@ } - void IndexBackend::ReadChangesInternal(IDatabaseBackendOutput& output, - bool& done, - DatabaseManager& manager, - DatabaseManager::CachedStatement& statement, - const Dictionary& args, - uint32_t limit, - bool returnFirstResults) + namespace // Anonymous namespace to avoid clashes between compilation modules { struct Change { @@ -146,7 +140,17 @@ { } }; - + } + + + void IndexBackend::ReadChangesInternal(IDatabaseBackendOutput& output, + bool& done, + DatabaseManager& manager, + DatabaseManager::CachedStatement& statement, + const Dictionary& args, + uint32_t limit, + bool returnFirstResults) + { statement.Execute(args); std::list changes; @@ -647,10 +651,12 @@ hasTo = true; filters.push_back("seq<=${to}"); } +#if ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED == 1 if (changeTypes.size() > 0) { filters.push_back("changeType IN (" + JoinChanges(changeTypes) + ") "); } +#endif std::string filtersString; if (filters.size() > 0) diff -r 22bbce1f88ff -r 77c8544bbd7d Framework/Plugins/IndexBackend.h --- a/Framework/Plugins/IndexBackend.h Mon Sep 23 16:03:24 2024 +0200 +++ b/Framework/Plugins/IndexBackend.h Mon Sep 23 16:06:53 2024 +0200 @@ -429,11 +429,13 @@ virtual uint64_t MeasureLatency(DatabaseManager& manager) ORTHANC_OVERRIDE; +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) // New primitive since Orthanc 1.12.5 virtual bool HasExtendedChanges() const ORTHANC_OVERRIDE { return true; } +#endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) virtual bool HasFindSupport() const ORTHANC_OVERRIDE; diff -r 22bbce1f88ff -r 77c8544bbd7d Framework/Plugins/MessagesToolbox.h --- a/Framework/Plugins/MessagesToolbox.h Mon Sep 23 16:03:24 2024 +0200 +++ b/Framework/Plugins/MessagesToolbox.h Mon Sep 23 16:06:53 2024 +0200 @@ -24,17 +24,11 @@ #pragma once #include +#include // Ensure that "ORTHANC_PLUGINS_VERSION_IS_ABOVE" is defined #include "../../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" -#if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1 -# if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) -# include -# endif -#endif - - #define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 0 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) @@ -55,6 +49,16 @@ #endif +#define ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED 0 + +#if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) +# if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) +# undef ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED +# define ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED 1 +# endif +#endif + + #include