comparison OrthancServer/Sources/Search/DatabaseConstraint.h @ 5680:68fc5af30c03

added container class DatabaseConstraints
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jul 2024 10:09:57 +0200
parents f7adfb22e20e
children 77875b51cf95
comparison
equal deleted inserted replaced
5678:e47ac5e133b1 5680:68fc5af30c03
44 # define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 1 44 # define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 1
45 # endif 45 # endif
46 # endif 46 # endif
47 #endif 47 #endif
48 48
49 #include <deque>
50
49 namespace Orthanc 51 namespace Orthanc
50 { 52 {
51 enum ConstraintType 53 enum ConstraintType
52 { 54 {
53 ConstraintType_Equal, 55 ConstraintType_Equal,
76 #endif 78 #endif
77 } 79 }
78 80
79 81
80 // This class is also used by the "orthanc-databases" project 82 // This class is also used by the "orthanc-databases" project
81 class DatabaseConstraint 83 class DatabaseConstraint : public boost::noncopyable
82 { 84 {
83 private: 85 private:
84 ResourceType level_; 86 ResourceType level_;
85 DicomTag tag_; 87 DicomTag tag_;
86 bool isIdentifier_; 88 bool isIdentifier_;
146 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 148 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
147 void EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint, 149 void EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint,
148 std::vector<const char*>& tmpValues) const; 150 std::vector<const char*>& tmpValues) const;
149 #endif 151 #endif
150 }; 152 };
153
154
155 class DatabaseConstraints : public boost::noncopyable
156 {
157 private:
158 std::deque<DatabaseConstraint*> constraints_;
159
160 public:
161 ~DatabaseConstraints()
162 {
163 Clear();
164 }
165
166 void Clear();
167
168 void AddConstraint(DatabaseConstraint* constraint); // Takes ownership
169
170 bool IsEmpty() const
171 {
172 return constraints_.empty();
173 }
174
175 size_t GetSize() const
176 {
177 return constraints_.size();
178 }
179
180 const DatabaseConstraint& GetConstraint(size_t index) const;
181 };
151 } 182 }