# HG changeset patch # User Sebastien Jodogne # Date 1720512597 -7200 # Node ID 68fc5af30c03325a9e9b6af2c584a3112157806b # Parent e47ac5e133b1d67db275e5458c2482e2c94c17e1 added container class DatabaseConstraints diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -564,7 +564,7 @@ virtual void ApplyLookupResources(std::list& resourcesId, std::list* instancesId, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, LabelsConstraint labelsConstraint, @@ -586,20 +586,20 @@ std::vector constraints; std::vector< std::vector > constraintsValues; - constraints.resize(lookup.size()); - constraintsValues.resize(lookup.size()); + constraints.resize(lookup.GetSize()); + constraintsValues.resize(lookup.GetSize()); - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { - lookup[i].EncodeForPlugins(constraints[i], constraintsValues[i]); + lookup.GetConstraint(i).EncodeForPlugins(constraints[i], constraintsValues[i]); } ResetAnswers(); answerMatchingResources_ = &resourcesId; answerMatchingInstances_ = instancesId; - CheckSuccess(that_.extensions_.lookupResources(that_.GetContext(), that_.payload_, lookup.size(), - (lookup.empty() ? NULL : &constraints[0]), + CheckSuccess(that_.extensions_.lookupResources(that_.GetContext(), that_.payload_, lookup.GetSize(), + (lookup.IsEmpty() ? NULL : &constraints[0]), Plugins::Convert(queryLevel), limit, (instancesId == NULL ? 0 : 1))); } diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -798,7 +798,7 @@ virtual void ApplyLookupResources(std::list& resourcesId, std::list* instancesId, // Can be NULL if not needed - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, LabelsConstraint labelsConstraint, @@ -812,16 +812,16 @@ std::vector constraints; std::vector< std::vector > constraintsValues; - constraints.resize(lookup.size()); - constraintsValues.resize(lookup.size()); + constraints.resize(lookup.GetSize()); + constraintsValues.resize(lookup.GetSize()); - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { - lookup[i].EncodeForPlugins(constraints[i], constraintsValues[i]); + lookup.GetConstraint(i).EncodeForPlugins(constraints[i], constraintsValues[i]); } - CheckSuccess(that_.backend_.lookupResources(transaction_, lookup.size(), - (lookup.empty() ? NULL : &constraints[0]), + CheckSuccess(that_.backend_.lookupResources(transaction_, lookup.GetSize(), + (lookup.IsEmpty() ? NULL : &constraints[0]), Plugins::Convert(queryLevel), limit, (instancesId == NULL ? 0 : 1))); CheckNoEvent(); diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -975,7 +975,7 @@ virtual void ApplyLookupResources(std::list& resourcesId, std::list* instancesId, // Can be NULL if not needed - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, LabelsConstraint labelsConstraint, @@ -992,44 +992,46 @@ request.mutable_lookup_resources()->set_limit(limit); request.mutable_lookup_resources()->set_retrieve_instances_ids(instancesId != NULL); - request.mutable_lookup_resources()->mutable_lookup()->Reserve(lookup.size()); + request.mutable_lookup_resources()->mutable_lookup()->Reserve(lookup.GetSize()); - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { - DatabasePluginMessages::DatabaseConstraint* constraint = request.mutable_lookup_resources()->add_lookup(); - constraint->set_level(Convert(lookup[i].GetLevel())); - constraint->set_tag_group(lookup[i].GetTag().GetGroup()); - constraint->set_tag_element(lookup[i].GetTag().GetElement()); - constraint->set_is_identifier_tag(lookup[i].IsIdentifier()); - constraint->set_is_case_sensitive(lookup[i].IsCaseSensitive()); - constraint->set_is_mandatory(lookup[i].IsMandatory()); + const DatabaseConstraint& source = lookup.GetConstraint(i); - constraint->mutable_values()->Reserve(lookup[i].GetValuesCount()); - for (size_t j = 0; j < lookup[i].GetValuesCount(); j++) + DatabasePluginMessages::DatabaseConstraint* target = request.mutable_lookup_resources()->add_lookup(); + target->set_level(Convert(source.GetLevel())); + target->set_tag_group(source.GetTag().GetGroup()); + target->set_tag_element(source.GetTag().GetElement()); + target->set_is_identifier_tag(source.IsIdentifier()); + target->set_is_case_sensitive(source.IsCaseSensitive()); + target->set_is_mandatory(source.IsMandatory()); + + target->mutable_values()->Reserve(source.GetValuesCount()); + for (size_t j = 0; j < source.GetValuesCount(); j++) { - constraint->add_values(lookup[i].GetValue(j)); + target->add_values(source.GetValue(j)); } - switch (lookup[i].GetConstraintType()) + switch (source.GetConstraintType()) { case ConstraintType_Equal: - constraint->set_type(DatabasePluginMessages::CONSTRAINT_EQUAL); + target->set_type(DatabasePluginMessages::CONSTRAINT_EQUAL); break; case ConstraintType_SmallerOrEqual: - constraint->set_type(DatabasePluginMessages::CONSTRAINT_SMALLER_OR_EQUAL); + target->set_type(DatabasePluginMessages::CONSTRAINT_SMALLER_OR_EQUAL); break; case ConstraintType_GreaterOrEqual: - constraint->set_type(DatabasePluginMessages::CONSTRAINT_GREATER_OR_EQUAL); + target->set_type(DatabasePluginMessages::CONSTRAINT_GREATER_OR_EQUAL); break; case ConstraintType_Wildcard: - constraint->set_type(DatabasePluginMessages::CONSTRAINT_WILDCARD); + target->set_type(DatabasePluginMessages::CONSTRAINT_WILDCARD); break; case ConstraintType_List: - constraint->set_type(DatabasePluginMessages::CONSTRAINT_LIST); + target->set_type(DatabasePluginMessages::CONSTRAINT_LIST); break; default: diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp --- a/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -153,7 +153,7 @@ static void ApplyLevel(SetOfResources& candidates, IDatabaseWrapper::ITransaction& transaction, ILookupResources& compatibility, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType level) { typedef std::set SetOfConstraints; @@ -166,17 +166,19 @@ Identifiers identifiers; SetOfConstraints mainTags; - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { - if (lookup[i].GetLevel() == level) + const DatabaseConstraint& constraint = lookup.GetConstraint(i); + + if (constraint.GetLevel() == level) { - if (lookup[i].IsIdentifier()) + if (constraint.IsIdentifier()) { - identifiers[lookup[i].GetTag()].insert(&lookup[i]); + identifiers[constraint.GetTag()].insert(&constraint); } else { - mainTags.insert(&lookup[i]); + mainTags.insert(&constraint); } } } @@ -306,7 +308,7 @@ void DatabaseLookup::ApplyLookupResources(std::list& resourcesId, std::list* instancesId, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, size_t limit) { @@ -320,9 +322,9 @@ ResourceType upperLevel = queryLevel; ResourceType lowerLevel = queryLevel; - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { - ResourceType level = lookup[i].GetLevel(); + ResourceType level = lookup.GetConstraint(i).GetLevel(); if (level < upperLevel) { diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/Compatibility/DatabaseLookup.h --- a/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.h Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.h Tue Jul 09 10:09:57 2024 +0200 @@ -46,7 +46,7 @@ void ApplyLookupResources(std::list& resourcesId, std::list* instancesId, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, size_t limit); }; diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/Compatibility/ILookupResources.cpp --- a/OrthancServer/Sources/Database/Compatibility/ILookupResources.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/ILookupResources.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -35,7 +35,7 @@ ILookupResources& compatibility, std::list& resourcesId, std::list* instancesId, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, size_t limit) { diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/Compatibility/ILookupResources.h --- a/OrthancServer/Sources/Database/Compatibility/ILookupResources.h Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/ILookupResources.h Tue Jul 09 10:09:57 2024 +0200 @@ -60,7 +60,7 @@ ILookupResources& compatibility, std::list& resourcesId, std::list* instancesId, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, size_t limit); }; diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/IDatabaseWrapper.h --- a/OrthancServer/Sources/Database/IDatabaseWrapper.h Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/IDatabaseWrapper.h Tue Jul 09 10:09:57 2024 +0200 @@ -37,7 +37,7 @@ namespace Orthanc { - class DatabaseConstraint; + class DatabaseConstraints; class ResourcesContent; class IDatabaseWrapper : public boost::noncopyable @@ -282,7 +282,7 @@ virtual void ApplyLookupResources(std::list& resourcesId, std::list* instancesId, // Can be NULL if not needed - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, LabelsConstraint labelsConstraint, diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -340,7 +340,7 @@ virtual void ApplyLookupResources(std::list& resourcesId, std::list* instancesId, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, LabelsConstraint labelsConstraint, diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -405,12 +405,11 @@ LoadTags(ResourceType_Instance); } - void NormalizeLookup(std::vector& target, + void NormalizeLookup(DatabaseConstraints& target, const DatabaseLookup& source, ResourceType queryLevel) const { - target.clear(); - target.reserve(source.GetConstraintsCount()); + target.Clear(); for (size_t i = 0; i < source.GetConstraintsCount(); i++) { @@ -429,7 +428,7 @@ level = ResourceType_Study; } - target.push_back(source.GetConstraint(i).ConvertToDatabaseConstraint(level, type)); + target.AddConstraint(source.GetConstraint(i).ConvertToDatabaseConstraint(level, type)); } } } @@ -1687,20 +1686,20 @@ DicomTagConstraint c(tag, ConstraintType_Equal, value, true, true); - std::vector query; - query.push_back(c.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); + DatabaseConstraints query; + query.AddConstraint(c.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); class Operations : public IReadOnlyOperations { private: - std::vector& result_; - const std::vector& query_; - ResourceType level_; + std::vector& result_; + const DatabaseConstraints& query_; + ResourceType level_; public: Operations(std::vector& result, - const std::vector& query, + const DatabaseConstraints& query, ResourceType level) : result_(result), query_(query), @@ -1986,7 +1985,7 @@ LabelsConstraint labelsConstraint, uint32_t limit) { - class Operations : public ReadOnlyOperationsT6&, ResourceType, + class Operations : public ReadOnlyOperationsT6&, LabelsConstraint, size_t> { private: @@ -2032,7 +2031,7 @@ ServerToolbox::CheckValidLabel(*it); } - std::vector normalized; + DatabaseConstraints normalized; assert(mainDicomTagsRegistry_.get() != NULL); mainDicomTagsRegistry_->NormalizeLookup(normalized, lookup, queryLevel); diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Database/StatelessDatabaseOperations.h --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Jul 09 10:09:57 2024 +0200 @@ -209,7 +209,7 @@ void ApplyLookupResources(std::list& resourcesId, std::list* instancesId, // Can be NULL if not needed - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, // New in Orthanc 1.12.0 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0 diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Search/DatabaseConstraint.cpp --- a/OrthancServer/Sources/Search/DatabaseConstraint.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Search/DatabaseConstraint.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -245,4 +245,43 @@ constraint.values = (tmpValues.empty() ? NULL : &tmpValues[0]); } #endif + + + void DatabaseConstraints::Clear() + { + for (size_t i = 0; i < constraints_.size(); i++) + { + assert(constraints_[i] != NULL); + delete constraints_[i]; + } + + constraints_.clear(); + } + + + void DatabaseConstraints::AddConstraint(DatabaseConstraint* constraint) + { + if (constraint == NULL) + { + throw OrthancException(ErrorCode_NullPointer); + } + else + { + constraints_.push_back(constraint); + } + } + + + const DatabaseConstraint& DatabaseConstraints::GetConstraint(size_t index) const + { + if (index >= constraints_.size()) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + else + { + assert(constraints_[index] != NULL); + return *constraints_[index]; + } + } } diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Search/DatabaseConstraint.h --- a/OrthancServer/Sources/Search/DatabaseConstraint.h Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Search/DatabaseConstraint.h Tue Jul 09 10:09:57 2024 +0200 @@ -46,6 +46,8 @@ # endif #endif +#include + namespace Orthanc { enum ConstraintType @@ -78,7 +80,7 @@ // This class is also used by the "orthanc-databases" project - class DatabaseConstraint + class DatabaseConstraint : public boost::noncopyable { private: ResourceType level_; @@ -148,4 +150,33 @@ std::vector& tmpValues) const; #endif }; + + + class DatabaseConstraints : public boost::noncopyable + { + private: + std::deque constraints_; + + public: + ~DatabaseConstraints() + { + Clear(); + } + + void Clear(); + + void AddConstraint(DatabaseConstraint* constraint); // Takes ownership + + bool IsEmpty() const + { + return constraints_.empty(); + } + + size_t GetSize() const + { + return constraints_.size(); + } + + const DatabaseConstraint& GetConstraint(size_t index) const; + }; } diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Search/DicomTagConstraint.cpp --- a/OrthancServer/Sources/Search/DicomTagConstraint.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Search/DicomTagConstraint.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -342,8 +342,8 @@ } - DatabaseConstraint DicomTagConstraint::ConvertToDatabaseConstraint(ResourceType level, - DicomTagType tagType) const + DatabaseConstraint* DicomTagConstraint::ConvertToDatabaseConstraint(ResourceType level, + DicomTagType tagType) const { bool isIdentifier, caseSensitive; @@ -379,7 +379,7 @@ } } - return DatabaseConstraint(level, tag_, isIdentifier, constraintType_, - values, caseSensitive, mandatory_); + return new DatabaseConstraint(level, tag_, isIdentifier, constraintType_, + values, caseSensitive, mandatory_); } } diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Search/DicomTagConstraint.h --- a/OrthancServer/Sources/Search/DicomTagConstraint.h Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Search/DicomTagConstraint.h Tue Jul 09 10:09:57 2024 +0200 @@ -109,7 +109,7 @@ std::string Format() const; - DatabaseConstraint ConvertToDatabaseConstraint(ResourceType level, - DicomTagType tagType) const; + DatabaseConstraint* ConvertToDatabaseConstraint(ResourceType level, + DicomTagType tagType) const; }; } diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Search/ISqlLookupFormatter.cpp --- a/OrthancServer/Sources/Search/ISqlLookupFormatter.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Search/ISqlLookupFormatter.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -475,7 +475,10 @@ } - void ISqlLookupFormatter::GetLookupLevels(ResourceType& lowerLevel, ResourceType& upperLevel, const ResourceType& queryLevel, const std::vector& lookup) + void ISqlLookupFormatter::GetLookupLevels(ResourceType& lowerLevel, + ResourceType& upperLevel, + const ResourceType& queryLevel, + const DatabaseConstraints& lookup) { assert(ResourceType_Patient < ResourceType_Study && ResourceType_Study < ResourceType_Series && @@ -484,9 +487,9 @@ lowerLevel = queryLevel; upperLevel = queryLevel; - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { - ResourceType level = lookup[i].GetLevel(); + ResourceType level = lookup.GetConstraint(i).GetLevel(); if (level < upperLevel) { @@ -503,7 +506,7 @@ void ISqlLookupFormatter::Apply(std::string& sql, ISqlLookupFormatter& formatter, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, LabelsConstraint labelsConstraint, @@ -521,14 +524,16 @@ size_t count = 0; - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { + const DatabaseConstraint& constraint = lookup.GetConstraint(i); + std::string comparison; - if (FormatComparison(comparison, formatter, lookup[i], count, escapeBrackets)) + if (FormatComparison(comparison, formatter, constraint, count, escapeBrackets)) { std::string join; - FormatJoin(join, lookup[i], count); + FormatJoin(join, constraint, count); joins += join; if (!comparison.empty()) @@ -614,7 +619,7 @@ void ISqlLookupFormatter::ApplySingleLevel(std::string& sql, ISqlLookupFormatter& formatter, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, LabelsConstraint labelsConstraint, @@ -631,15 +636,17 @@ std::vector mainDicomTagsComparisons, dicomIdentifiersComparisons; - for (size_t i = 0; i < lookup.size(); i++) + for (size_t i = 0; i < lookup.GetSize(); i++) { + const DatabaseConstraint& constraint = lookup.GetConstraint(i); + std::string comparison; - if (FormatComparison2(comparison, formatter, lookup[i], escapeBrackets)) + if (FormatComparison2(comparison, formatter, constraint, escapeBrackets)) { if (!comparison.empty()) { - if (lookup[i].IsIdentifier()) + if (constraint.IsIdentifier()) { dicomIdentifiersComparisons.push_back(comparison); } diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/Sources/Search/ISqlLookupFormatter.h --- a/OrthancServer/Sources/Search/ISqlLookupFormatter.h Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/Sources/Search/ISqlLookupFormatter.h Tue Jul 09 10:09:57 2024 +0200 @@ -34,7 +34,7 @@ namespace Orthanc { - class DatabaseConstraint; + class DatabaseConstraints; enum LabelsConstraint { @@ -64,11 +64,14 @@ **/ virtual bool IsEscapeBrackets() const = 0; - static void GetLookupLevels(ResourceType& lowerLevel, ResourceType& upperLevel, const ResourceType& queryLevel, const std::vector& lookup); + static void GetLookupLevels(ResourceType& lowerLevel, + ResourceType& upperLevel, + const ResourceType& queryLevel, + const DatabaseConstraints& lookup); static void Apply(std::string& sql, ISqlLookupFormatter& formatter, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, // New in Orthanc 1.12.0 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0 @@ -76,7 +79,7 @@ static void ApplySingleLevel(std::string& sql, ISqlLookupFormatter& formatter, - const std::vector& lookup, + const DatabaseConstraints& lookup, ResourceType queryLevel, const std::set& labels, // New in Orthanc 1.12.0 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0 diff -r e47ac5e133b1 -r 68fc5af30c03 OrthancServer/UnitTestsSources/ServerIndexTests.cpp --- a/OrthancServer/UnitTestsSources/ServerIndexTests.cpp Tue Jul 09 08:56:50 2024 +0200 +++ b/OrthancServer/UnitTestsSources/ServerIndexTests.cpp Tue Jul 09 10:09:57 2024 +0200 @@ -166,8 +166,8 @@ DicomTagConstraint c(tag, type, value, true, true); - std::vector lookup; - lookup.push_back(c.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); + DatabaseConstraints lookup; + lookup.AddConstraint(c.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); std::set noLabel; transaction_->ApplyLookupResources(result, NULL, lookup, level, noLabel, LabelsConstraint_All, 0 /* no limit */); @@ -185,10 +185,10 @@ DicomTagConstraint c1(tag, type1, value1, true, true); DicomTagConstraint c2(tag, type2, value2, true, true); - - std::vector lookup; - lookup.push_back(c1.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); - lookup.push_back(c2.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); + + DatabaseConstraints lookup; + lookup.AddConstraint(c1.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); + lookup.AddConstraint(c2.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); std::set noLabel; transaction_->ApplyLookupResources(result, NULL, lookup, level, noLabel, LabelsConstraint_All, 0 /* no limit */);