Mercurial > hg > orthanc
diff OrthancServer/LookupIdentifierQuery.cpp @ 1746:d143db00a794 db-changes
SetOfResources
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 26 Oct 2015 16:04:58 +0100 |
parents | 38dda23c7d7d |
children |
line wrap: on
line diff
--- a/OrthancServer/LookupIdentifierQuery.cpp Mon Oct 26 13:47:50 2015 +0100 +++ b/OrthancServer/LookupIdentifierQuery.cpp Mon Oct 26 16:04:58 2015 +0100 @@ -34,7 +34,7 @@ #include "LookupIdentifierQuery.h" #include "../Core/OrthancException.h" - +#include "SetOfResources.h" #include <cassert> @@ -70,27 +70,6 @@ DICOM_TAG_SOP_INSTANCE_UID }; - - LookupIdentifierQuery::~LookupIdentifierQuery() - { - for (Constraints::iterator it = constraints_.begin(); - it != constraints_.end(); ++it) - { - delete *it; - } - } - - - - void LookupIdentifierQuery::CheckIndex(size_t index) const - { - if (index >= constraints_.size()) - { - throw OrthancException(ErrorCode_ParameterOutOfRange); - } - } - - static void LoadIdentifiers(const DicomTag*& tags, size_t& size, ResourceType level) @@ -123,6 +102,27 @@ } + + LookupIdentifierQuery::~LookupIdentifierQuery() + { + for (Constraints::iterator it = constraints_.begin(); + it != constraints_.end(); ++it) + { + delete *it; + } + } + + + + void LookupIdentifierQuery::CheckIndex(size_t index) const + { + if (index >= constraints_.size()) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + bool LookupIdentifierQuery::IsIdentifier(const DicomTag& tag) const { const DicomTag* tags; @@ -202,4 +202,20 @@ } } } + + + void LookupIdentifierQuery::Apply(std::list<std::string>& result, + IDatabaseWrapper& database) + { + SetOfResources resources(database, level_); + + for (size_t i = 0; i < GetSize(); i++) + { + std::list<int64_t> tmp; + database.LookupIdentifier(tmp, level_, GetTag(i), GetType(i), GetValue(i)); + resources.Intersect(tmp); + } + + resources.Flatten(result); + } }