comparison 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
comparison
equal deleted inserted replaced
3076:8bc2cb1335f4 3077:aae1d6d31fef
34 #pragma once 34 #pragma once
35 35
36 #include "../../Core/DicomFormat/DicomMap.h" 36 #include "../../Core/DicomFormat/DicomMap.h"
37 #include "../ServerEnumerations.h" 37 #include "../ServerEnumerations.h"
38 38
39 #define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 0
40
39 #if ORTHANC_ENABLE_PLUGINS == 1 41 #if ORTHANC_ENABLE_PLUGINS == 1
40 # include "../../Plugins/Include/orthanc/OrthancCDatabasePlugin.h" 42 # include <orthanc/OrthancCDatabasePlugin.h>
43 # if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1
44 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 2)
45 # undef ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT
46 # define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 1
47 # endif
48 # endif
41 #endif 49 #endif
42 50
43 namespace Orthanc 51 namespace Orthanc
44 { 52 {
53 namespace Plugins
54 {
55 #if ORTHANC_ENABLE_PLUGINS == 1
56 OrthancPluginResourceType Convert(ResourceType type);
57 #endif
58
59 #if ORTHANC_ENABLE_PLUGINS == 1
60 ResourceType Convert(OrthancPluginResourceType type);
61 #endif
62
63 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
64 OrthancPluginConstraintType Convert(ConstraintType constraint);
65 #endif
66
67 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
68 ConstraintType Convert(OrthancPluginConstraintType constraint);
69 #endif
70 }
71
72
45 // This class is also used by the "orthanc-databases" project 73 // This class is also used by the "orthanc-databases" project
46 class DatabaseConstraint 74 class DatabaseConstraint
47 { 75 {
48 private: 76 private:
49 ResourceType level_; 77 ResourceType level_;
61 ConstraintType type, 89 ConstraintType type,
62 const std::vector<std::string>& values, 90 const std::vector<std::string>& values,
63 bool caseSensitive, 91 bool caseSensitive,
64 bool mandatory); 92 bool mandatory);
65 93
66 #if ORTHANC_ENABLE_PLUGINS == 1 94 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
67 DatabaseConstraint(const OrthancPluginDatabaseConstraint& constraint); 95 DatabaseConstraint(const OrthancPluginDatabaseConstraint& constraint);
68 #endif 96 #endif
69 97
70 ResourceType GetLevel() const 98 ResourceType GetLevel() const
71 { 99 {
106 return mandatory_; 134 return mandatory_;
107 } 135 }
108 136
109 bool IsMatch(const DicomMap& dicom) const; 137 bool IsMatch(const DicomMap& dicom) const;
110 138
111 #if ORTHANC_ENABLE_PLUGINS == 1 139 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
112 void EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint, 140 void EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint,
113 std::vector<const char*>& tmpValues) const; 141 std::vector<const char*>& tmpValues) const;
114 #endif 142 #endif
115 }; 143 };
116 } 144 }