From 28f98ad642300be67ab6b1f5de1a6aa61b924627 Mon Sep 17 00:00:00 2001 From: Mirco Valentini Date: Wed, 30 Oct 2024 12:38:38 +0000 Subject: [PATCH] avoid checks for empty sets in the select action: - Updated check conditions in MetadataMatcher - Changed the contruction of the matcher in the Selec action --- src/multio/action/select/Select.cc | 2 +- src/multio/message/MetadataMatcher.cc | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/multio/action/select/Select.cc b/src/multio/action/select/Select.cc index 25b3b851..3a397ebe 100644 --- a/src/multio/action/select/Select.cc +++ b/src/multio/action/select/Select.cc @@ -23,7 +23,7 @@ namespace multio::action { //-------------------------------------------------------------------------------------------------- -Select::Select(const ComponentConfiguration& compConf) : ChainedAction{compConf}, selectors_{compConf.parsedConfig()} {} +Select::Select(const ComponentConfiguration& compConf) : ChainedAction{compConf}, selectors_{MatchReduce::construct( compConf.parsedConfig())} {} void Select::executeImpl(Message msg) { if (matches(msg)) { diff --git a/src/multio/message/MetadataMatcher.cc b/src/multio/message/MetadataMatcher.cc index cee9e87c..f47ec518 100644 --- a/src/multio/message/MetadataMatcher.cc +++ b/src/multio/message/MetadataMatcher.cc @@ -74,12 +74,13 @@ bool MatchKeys::matches(const Metadata& md) const { break; } if (kv.second.find(searchKey->second) == kv.second.end()) { - if (enforceSameKeyTypes_) { - if (kv.second.size() == 0) { - std::ostringstream oss; - oss << "[enforce-same-key-type] Matcher for key \"" << kv.first << "\" is an empty set"; - throw MetadataException(oss.str()); - } + if (enforceSameKeyTypes_ && kv.second.size() > 0 ) { + // Note: NEMO needs the possibiity to use empty sets!!! + //if (kv.second.size() == 0) { + // std::ostringstream oss; + // oss << "[enforce-same-key-type] Matcher for key \"" << kv.first << "\" is an empty set"; + // throw MetadataException(oss.str()); + //} if (kv.second.begin()->index() != searchKey->second.index()) { std::ostringstream oss;