Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Toolbox.h Thu Mar 10 19:00:43 2022 +0100 +++ b/OrthancFramework/Sources/Toolbox.h Fri Mar 11 17:38:16 2022 +0100 @@ -185,6 +185,48 @@ const std::string& source, char separator); + // returns true if all element of 'needles' are found in 'haystack' + template <typename T> static bool IsSetInSet(const std::set<T>& needles, const std::set<T>& haystack) + { + for (typename std::set<T>::const_iterator it = needles.begin(); + it != needles.end(); it++) + { + if (haystack.count(*it) == 0) + { + return false; + } + } + + return true; + } + + // returns the set of elements from 'needles' that are not in 'haystack' + template <typename T> static size_t GetMissingsFromSet(std::set<T>& missings, const std::set<T>& needles, const std::set<T>& haystack) + { + missings.clear(); + + for (typename std::set<T>::const_iterator it = needles.begin(); + it != needles.end(); it++) + { + if (haystack.count(*it) == 0) + { + missings.insert(*it); + } + } + + return missings.size(); + } + + template <typename T> static void AppendSets(std::set<T>& target, const std::set<T>& toAppend) + { + for (typename std::set<T>::const_iterator it = toAppend.begin(); + it != toAppend.end(); it++) + { + target.insert(*it); + } + } + + #if ORTHANC_ENABLE_PUGIXML == 1 static void JsonToXml(std::string& target, const Json::Value& source,