CMS 3D CMS Logo

TriggerExpressionEvaluator.h
Go to the documentation of this file.
1 #ifndef HLTrigger_HLTcore_TriggerExpressionEvaluator_h
2 #define HLTrigger_HLTcore_TriggerExpressionEvaluator_h
3 
4 #include <iostream>
5 #include <string>
6 #include <vector>
7 #include <utility>
8 
9 namespace triggerExpression {
10 
11  class Data;
12 
13  class Evaluator {
14  public:
15  Evaluator() = default;
16 
17  // virtual destructor
18  virtual ~Evaluator() = default;
19 
20  // check if the data satisfies the logical expression
21  virtual bool operator()(const Data& data) const = 0;
22 
23  // (re)initialise the logical expression
24  virtual void init(const Data& data) {}
25 
26  // list CMSSW path patterns associated to the logical expression
27  virtual std::vector<std::string> patterns() const { return {}; }
28 
29  // list of triggers associated to the Evaluator (filled only for certain derived classes)
30  virtual std::vector<std::pair<std::string, unsigned int>> triggers() const { return {}; }
31 
32  // dump the logical expression to the output stream
33  virtual void dump(std::ostream& out, bool const ignoreMasks = false) const = 0;
34 
35  // apply masks based on another Evaluator
36  virtual void mask(Evaluator const&) {}
37 
38  // methods to control m_masksEnabled boolean
39  virtual bool masksEnabled() const { return m_masksEnabled; }
40  virtual void enableMasks() { m_masksEnabled = true; }
41  virtual void disableMasks() { m_masksEnabled = false; }
42 
43  private:
44  bool m_masksEnabled = false;
45  };
46 
47  inline std::ostream& operator<<(std::ostream& out, const Evaluator& eval) {
48  eval.dump(out);
49  return out;
50  }
51 
52 } // namespace triggerExpression
53 
54 #endif // HLTrigger_HLTcore_TriggerExpressionEvaluator_h
virtual std::vector< std::string > patterns() const
std::ostream & operator<<(std::ostream &out, const Evaluator &eval)
virtual bool operator()(const Data &data) const =0
virtual ~Evaluator()=default
virtual void init(const Data &data)
virtual void mask(Evaluator const &)
virtual void dump(std::ostream &out, bool const ignoreMasks=false) const =0
virtual std::vector< std::pair< std::string, unsigned int > > triggers() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80