diff OrthancServer/Search/DatabaseConstraint.h @ 3077:aae1d6d31fef db-changes

compatibility with orthanc-databases
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 03 Jan 2019 10:06:42 +0100
parents 495c5edce708
children df1b17be20f6
line wrap: on
line diff
--- a/OrthancServer/Search/DatabaseConstraint.h	Wed Jan 02 19:04:15 2019 +0100
+++ b/OrthancServer/Search/DatabaseConstraint.h	Thu Jan 03 10:06:42 2019 +0100
@@ -36,12 +36,40 @@
 #include "../../Core/DicomFormat/DicomMap.h"
 #include "../ServerEnumerations.h"
 
+#define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 0
+
 #if ORTHANC_ENABLE_PLUGINS == 1
-#  include "../../Plugins/Include/orthanc/OrthancCDatabasePlugin.h"
+#  include <orthanc/OrthancCDatabasePlugin.h>
+#  if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)      // Macro introduced in 1.3.1
+#    if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 2)
+#      undef  ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT
+#      define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 1
+#    endif
+#  endif
 #endif
 
 namespace Orthanc
 {
+  namespace Plugins
+  {
+#if ORTHANC_ENABLE_PLUGINS == 1
+    OrthancPluginResourceType Convert(ResourceType type);
+#endif
+
+#if ORTHANC_ENABLE_PLUGINS == 1
+    ResourceType Convert(OrthancPluginResourceType type);
+#endif
+
+#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
+    OrthancPluginConstraintType Convert(ConstraintType constraint);
+#endif
+
+#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
+    ConstraintType Convert(OrthancPluginConstraintType constraint);
+#endif
+  }
+
+
   // This class is also used by the "orthanc-databases" project
   class DatabaseConstraint
   {
@@ -63,7 +91,7 @@
                        bool caseSensitive,
                        bool mandatory);
 
-#if ORTHANC_ENABLE_PLUGINS == 1
+#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
     DatabaseConstraint(const OrthancPluginDatabaseConstraint& constraint);
 #endif
     
@@ -108,7 +136,7 @@
 
     bool IsMatch(const DicomMap& dicom) const;
 
-#if ORTHANC_ENABLE_PLUGINS == 1
+#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
     void EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint,
                           std::vector<const char*>& tmpValues) const;
 #endif