diff Framework/Plugins/DatabaseBackendAdapterV4.cpp @ 565:373cf7d747cc find-refactoring

fix build against orthanc mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 22 Sep 2024 10:03:36 +0200
parents 7f45f23b10d0
children 77c8544bbd7d
line wrap: on
line diff
--- a/Framework/Plugins/DatabaseBackendAdapterV4.cpp	Fri Sep 20 18:36:52 2024 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV4.cpp	Sun Sep 22 10:03:36 2024 +0200
@@ -27,6 +27,7 @@
 #  if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
 
 #include "IndexConnectionsPool.h"
+#include "MessagesToolbox.h"
 
 #include <OrthancDatabasePlugin.pb.h>  // 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());
@@ -1304,11 +1315,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();