Mercurial > hg > orthanc
comparison OrthancFramework/Sources/Toolbox.h @ 4936:8422e4f99a18 more-tags
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 11 Mar 2022 17:38:16 +0100 |
parents | 43e613a7756b |
children | f630796a59b1 |
comparison
equal
deleted
inserted
replaced
4935:acd3f72e2a21 | 4936:8422e4f99a18 |
---|---|
183 | 183 |
184 static void TokenizeString(std::vector<std::string>& result, | 184 static void TokenizeString(std::vector<std::string>& result, |
185 const std::string& source, | 185 const std::string& source, |
186 char separator); | 186 char separator); |
187 | 187 |
188 // returns true if all element of 'needles' are found in 'haystack' | |
189 template <typename T> static bool IsSetInSet(const std::set<T>& needles, const std::set<T>& haystack) | |
190 { | |
191 for (typename std::set<T>::const_iterator it = needles.begin(); | |
192 it != needles.end(); it++) | |
193 { | |
194 if (haystack.count(*it) == 0) | |
195 { | |
196 return false; | |
197 } | |
198 } | |
199 | |
200 return true; | |
201 } | |
202 | |
203 // returns the set of elements from 'needles' that are not in 'haystack' | |
204 template <typename T> static size_t GetMissingsFromSet(std::set<T>& missings, const std::set<T>& needles, const std::set<T>& haystack) | |
205 { | |
206 missings.clear(); | |
207 | |
208 for (typename std::set<T>::const_iterator it = needles.begin(); | |
209 it != needles.end(); it++) | |
210 { | |
211 if (haystack.count(*it) == 0) | |
212 { | |
213 missings.insert(*it); | |
214 } | |
215 } | |
216 | |
217 return missings.size(); | |
218 } | |
219 | |
220 template <typename T> static void AppendSets(std::set<T>& target, const std::set<T>& toAppend) | |
221 { | |
222 for (typename std::set<T>::const_iterator it = toAppend.begin(); | |
223 it != toAppend.end(); it++) | |
224 { | |
225 target.insert(*it); | |
226 } | |
227 } | |
228 | |
229 | |
188 #if ORTHANC_ENABLE_PUGIXML == 1 | 230 #if ORTHANC_ENABLE_PUGIXML == 1 |
189 static void JsonToXml(std::string& target, | 231 static void JsonToXml(std::string& target, |
190 const Json::Value& source, | 232 const Json::Value& source, |
191 const std::string& rootElement = "root", | 233 const std::string& rootElement = "root", |
192 const std::string& arrayElement = "item"); | 234 const std::string& arrayElement = "item"); |