Classes | Typedefs | Functions
WireCell::tagrules Namespace Reference

Classes

class  Context
 

Typedefs

typedef std::string tag_t
 
typedef std::string match_t
 
typedef std::unordered_set< tag_ttagset_t
 
typedef std::pair< std::regex, tagset_trule_t
 
typedef std::vector< rule_truleset_t
 

Functions

tagset_t match (const tag_t &tag, const rule_t &rs)
 
bool match (const tag_t &tag, const ruleset_t &rs, tagset_t &ret, bool all_rules=true)
 
tagset_t transform (const tagset_t &ts, const ruleset_t &rs, bool all_rules=true)
 

Typedef Documentation

Definition at line 47 of file TagRules.h.

typedef std::pair<std::regex, tagset_t> WireCell::tagrules::rule_t

Definition at line 49 of file TagRules.h.

Definition at line 50 of file TagRules.h.

Definition at line 46 of file TagRules.h.

typedef std::unordered_set<tag_t> WireCell::tagrules::tagset_t

Definition at line 48 of file TagRules.h.

Function Documentation

tagrules::tagset_t WireCell::tagrules::match ( const tag_t tag,
const rule_t rs 
)

Definition at line 16 of file TagRules.cxx.

17 {
18  if (std::regex_match(tag, rule.first)) {
19  return rule.second;
20  }
21  return tagset_t{};
22 }
std::unordered_set< tag_t > tagset_t
Definition: TagRules.h:48
bool WireCell::tagrules::match ( const tag_t tag,
const ruleset_t rs,
tagrules::tagset_t ret,
bool  all_rules = true 
)

Definition at line 24 of file TagRules.cxx.

26 {
27  bool found = false;
28  for (const auto& rule : rs) {
29  auto ts = tagrules::match(tag, rule);
30  if (ts.empty()) {
31  continue;
32  }
33  ret.insert(ts.begin(), ts.end());
34  if (all) {
35  found = true;
36  continue;
37  }
38  return true;
39  }
40  return found;
41 }
tagset_t match(const tag_t &tag, const rule_t &rs)
Definition: TagRules.cxx:16
static QInternalList< QTextCodec > * all
Definition: qtextcodec.cpp:63
tagrules::tagset_t WireCell::tagrules::transform ( const tagset_t ts,
const ruleset_t rs,
bool  all_rules = true 
)

Definition at line 43 of file TagRules.cxx.

44 {
46  for (auto tag : ts) {
48  if (match(tag, rs, one, all)) {
49  ret.insert(one.begin(), one.end());
50  }
51  }
52  return ret;
53 }
std::unordered_set< tag_t > tagset_t
Definition: TagRules.h:48
tagset_t match(const tag_t &tag, const rule_t &rs)
Definition: TagRules.cxx:16
static QInternalList< QTextCodec > * all
Definition: qtextcodec.cpp:63