Mercurial > hg > orthanc
diff OrthancServer/Search/DicomTagConstraint.cpp @ 3025:039a9d262d64 db-changes
preparing to speed up find in databases
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 17 Dec 2018 17:05:28 +0100 |
parents | 1723cbba55c7 |
children | fd587cf51a89 |
line wrap: on
line diff
--- a/OrthancServer/Search/DicomTagConstraint.cpp Mon Dec 17 10:26:01 2018 +0100 +++ b/OrthancServer/Search/DicomTagConstraint.cpp Mon Dec 17 17:05:28 2018 +0100 @@ -97,13 +97,12 @@ DicomTagConstraint::DicomTagConstraint(const DicomTag& tag, ConstraintType type, const std::string& value, - bool caseSensitive) : - hasTagInfo_(false), - tagType_(DicomTagType_Generic), // Dummy initialization - level_(ResourceType_Patient), // Dummy initialization + bool caseSensitive, + bool mandatory) : tag_(tag), constraintType_(type), - caseSensitive_(caseSensitive) + caseSensitive_(caseSensitive), + mandatory_(mandatory) { if (type == ConstraintType_Equal || type == ConstraintType_SmallerOrEqual || @@ -128,13 +127,12 @@ DicomTagConstraint::DicomTagConstraint(const DicomTag& tag, ConstraintType type, - bool caseSensitive) : - hasTagInfo_(false), - tagType_(DicomTagType_Generic), // Dummy initialization - level_(ResourceType_Patient), // Dummy initialization + bool caseSensitive, + bool mandatory) : tag_(tag), constraintType_(type), - caseSensitive_(caseSensitive) + caseSensitive_(caseSensitive), + mandatory_(mandatory) { if (type != ConstraintType_List) { @@ -143,41 +141,6 @@ } - void DicomTagConstraint::SetTagInfo(DicomTagType tagType, - ResourceType level) - { - hasTagInfo_ = true; - tagType_ = tagType; - level_ = level; - } - - - DicomTagType DicomTagConstraint::GetTagType() const - { - if (!hasTagInfo_) - { - throw OrthancException(ErrorCode_BadSequenceOfCalls); - } - else - { - return tagType_; - } - } - - - const ResourceType DicomTagConstraint::GetLevel() const - { - if (!hasTagInfo_) - { - throw OrthancException(ErrorCode_BadSequenceOfCalls); - } - else - { - return level_; - } - } - - void DicomTagConstraint::AddValue(const std::string& value) { if (constraintType_ != ConstraintType_List) @@ -268,8 +231,18 @@ const DicomValue* tmp = value.TestAndGetValue(tag_); if (tmp == NULL || - tmp->IsNull() || - tmp->IsBinary()) + tmp->IsNull()) + { + if (mandatory_) + { + return false; + } + else + { + return true; + } + } + else if (tmp->IsBinary()) { return false; }