Skip to content

Commit 9509fdf

Browse files
Avoid checks for empty sets in the select action: (#34)
- Update check conditions in MetadataMatcher - Change the construction of the matcher in the Select action Co-authored-by: Mirco Valentini <[email protected]>
1 parent ec7149c commit 9509fdf

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/multio/action/select/Select.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace multio::action {
2323

2424
//--------------------------------------------------------------------------------------------------
2525

26-
Select::Select(const ComponentConfiguration& compConf) : ChainedAction{compConf}, selectors_{compConf.parsedConfig()} {}
26+
Select::Select(const ComponentConfiguration& compConf) : ChainedAction{compConf}, selectors_{MatchReduce::construct( compConf.parsedConfig())} {}
2727

2828
void Select::executeImpl(Message msg) {
2929
if (matches(msg)) {

src/multio/message/MetadataMatcher.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ bool MatchKeys::matches(const Metadata& md) const {
7474
break;
7575
}
7676
if (kv.second.find(searchKey->second) == kv.second.end()) {
77-
if (enforceSameKeyTypes_) {
78-
if (kv.second.size() == 0) {
79-
std::ostringstream oss;
80-
oss << "[enforce-same-key-type] Matcher for key \"" << kv.first << "\" is an empty set";
81-
throw MetadataException(oss.str());
82-
}
77+
if (enforceSameKeyTypes_ && kv.second.size() > 0 ) {
78+
// Note: NEMO needs the possibiity to use empty sets!!!
79+
//if (kv.second.size() == 0) {
80+
// std::ostringstream oss;
81+
// oss << "[enforce-same-key-type] Matcher for key \"" << kv.first << "\" is an empty set";
82+
// throw MetadataException(oss.str());
83+
//}
8384

8485
if (kv.second.begin()->index() != searchKey->second.index()) {
8586
std::ostringstream oss;

0 commit comments

Comments
 (0)