Mercurial > hg > orthanc
comparison OrthancServer/Search/LookupIdentifierQuery.h @ 1749:99f4a05f39fa db-changes
various types of constraints
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 27 Oct 2015 10:54:51 +0100 |
parents | 92203f713205 |
children | 55d52567bebb |
comparison
equal
deleted
inserted
replaced
1748:92203f713205 | 1749:99f4a05f39fa |
---|---|
74 Constraint(const DicomTag& tag, | 74 Constraint(const DicomTag& tag, |
75 IdentifierConstraintType type, | 75 IdentifierConstraintType type, |
76 const std::string& value) : | 76 const std::string& value) : |
77 tag_(tag), | 77 tag_(tag), |
78 type_(type), | 78 type_(type), |
79 value_(value) | 79 value_(NormalizeIdentifier(value)) |
80 { | 80 { |
81 } | 81 } |
82 | 82 |
83 const DicomTag& GetTag() const | 83 const DicomTag& GetTag() const |
84 { | 84 { |
95 return value_; | 95 return value_; |
96 } | 96 } |
97 }; | 97 }; |
98 | 98 |
99 | 99 |
100 private: | 100 class Disjunction : public boost::noncopyable |
101 class Union | |
102 { | 101 { |
103 private: | 102 private: |
104 std::vector<Constraint*> union_; | 103 std::vector<Constraint*> disjunction_; |
105 | 104 |
106 public: | 105 public: |
107 ~Union(); | 106 ~Disjunction(); |
108 | 107 |
109 void Add(const Constraint& constraint); | 108 void Add(const DicomTag& tag, |
109 IdentifierConstraintType type, | |
110 const std::string& value); | |
110 | 111 |
111 size_t GetSize() const | 112 size_t GetSize() const |
112 { | 113 { |
113 return union_.size(); | 114 return disjunction_.size(); |
114 } | 115 } |
115 | 116 |
116 const Constraint& GetConstraint(size_t i) const | 117 const Constraint& GetConstraint(size_t i) const |
117 { | 118 { |
118 return *union_[i]; | 119 return *disjunction_[i]; |
119 } | 120 } |
120 }; | 121 }; |
121 | 122 |
122 | 123 |
123 typedef std::vector<Union*> Constraints; | 124 private: |
125 typedef std::vector<Disjunction*> Constraints; | |
124 | 126 |
125 ResourceType level_; | 127 ResourceType level_; |
126 Constraints constraints_; | 128 Constraints constraints_; |
127 | 129 |
128 static std::string NormalizeIdentifier(const std::string& value); | 130 static std::string NormalizeIdentifier(const std::string& value); |
141 | 143 |
142 void AddConstraint(DicomTag tag, | 144 void AddConstraint(DicomTag tag, |
143 IdentifierConstraintType type, | 145 IdentifierConstraintType type, |
144 const std::string& value); | 146 const std::string& value); |
145 | 147 |
146 void AddDisjunction(const std::list<Constraint>& constraints); | 148 Disjunction& AddDisjunction(); |
147 | 149 |
148 ResourceType GetLevel() const | 150 ResourceType GetLevel() const |
149 { | 151 { |
150 return level_; | 152 return level_; |
151 } | 153 } |
157 | 159 |
158 // The database must be locked | 160 // The database must be locked |
159 void Apply(std::list<std::string>& result, | 161 void Apply(std::list<std::string>& result, |
160 IDatabaseWrapper& database); | 162 IDatabaseWrapper& database); |
161 | 163 |
164 static void LoadIdentifiers(const DicomTag*& tags, | |
165 size_t& size, | |
166 ResourceType level); | |
167 | |
162 static bool IsIdentifier(const DicomTag& tag, | 168 static bool IsIdentifier(const DicomTag& tag, |
163 ResourceType level); | 169 ResourceType level); |
164 | 170 |
165 static void StoreIdentifiers(IDatabaseWrapper& database, | 171 static void StoreIdentifiers(IDatabaseWrapper& database, |
166 int64_t resource, | 172 int64_t resource, |