Skip to content

Commit bed6937

Browse files
committed
[meta] Sel rules identical if only pattern, name and sel_name change
fixes #19687
1 parent 93f9db7 commit bed6937

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

core/dictgen/res/SelectionRules.h

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,36 @@ namespace ROOT{
3636
#include <iostream>
3737
namespace SelectionRulesUtils {
3838

39-
template<class ASSOCIATIVECONTAINER>
40-
inline bool areEqualAttributes(const ASSOCIATIVECONTAINER& c1, const ASSOCIATIVECONTAINER& c2, bool moduloNameOrPattern){
41-
if (c1.size() != c2.size()) return false;
39+
template <class ASSOCIATIVECONTAINER>
40+
inline bool areEqualAttributes(const ASSOCIATIVECONTAINER &c1, const ASSOCIATIVECONTAINER &c2, bool moduloNameOrPattern)
41+
{
42+
auto skipAttr = [](const std::string &s) {
43+
return "pattern" == s || "name" == s || "file_name" == s;
44+
};
45+
if (c1.size() != c2.size()) {
46+
// We check if the attributes are pattern, name or filename
47+
auto skipSizeCheck = true;
48+
for (auto &&coll : {c1, c2})
49+
{
50+
for (auto &&keyValPair : coll) {
51+
skipSizeCheck = skipSizeCheck && skipAttr(keyValPair.first);
52+
}
53+
}
54+
if (!skipSizeCheck) {
55+
return false;
56+
}
57+
}
4258
if (moduloNameOrPattern) {
43-
for (auto&& keyValPairC1 : c1){
59+
for (auto &&keyValPairC1 : c1) {
4460
auto keyC1 = keyValPairC1.first;
45-
if ("pattern" == keyC1 || "name" == keyC1) continue;
61+
if (skipAttr(keyC1))
62+
continue;
4663
auto valC1 = keyValPairC1.second;
4764
auto C2It = c2.find(keyC1);
48-
if (C2It == c2.end() || valC1 != C2It->second) return false;
65+
if (C2It == c2.end() || valC1 != C2It->second)
66+
return false;
4967
}
50-
}
51-
else {
68+
} else {
5269
return !(c1 != c2);
5370
}
5471
return true;

0 commit comments

Comments
 (0)