CMS 3D CMS Logo

TriggerExpressionOperators.h
Go to the documentation of this file.
1 #ifndef HLTrigger_HLTfilters_TriggerExpressionOperators_h
2 #define HLTrigger_HLTfilters_TriggerExpressionOperators_h
3 
4 #include <boost/scoped_ptr.hpp>
6 
7 namespace triggerExpression {
8 
9  // abstract unary operator
10  class UnaryOperator : public Evaluator {
11  public:
13 
14  // initialize the depending modules
15  void init(const Data& data) override { m_arg->init(data); }
16 
17  protected:
18  boost::scoped_ptr<Evaluator> m_arg;
19  };
20 
21  // abstract binary operator
22  class BinaryOperator : public Evaluator {
23  public:
24  BinaryOperator(Evaluator* arg1, Evaluator* arg2) : m_arg1(arg1), m_arg2(arg2) {}
25 
26  // initialize the depending modules
27  void init(const Data& data) override {
28  m_arg1->init(data);
29  m_arg2->init(data);
30  }
31 
32  protected:
33  boost::scoped_ptr<Evaluator> m_arg1;
34  boost::scoped_ptr<Evaluator> m_arg2;
35  };
36 
37  // concrete operators
38 
39  class OperatorNot : public UnaryOperator {
40  public:
42 
43  bool operator()(const Data& data) const override { return not(*m_arg)(data); }
44 
45  void dump(std::ostream& out) const override {
46  out << "NOT ";
47  m_arg->dump(out);
48  }
49  };
50 
51  class OperatorAnd : public BinaryOperator {
52  public:
53  OperatorAnd(Evaluator* arg1, Evaluator* arg2) : BinaryOperator(arg1, arg2) {}
54 
55  bool operator()(const Data& data) const override {
56  // force the execution af both arguments, otherwise precalers won't work properly
57  bool r1 = (*m_arg1)(data);
58  bool r2 = (*m_arg2)(data);
59  return r1 and r2;
60  }
61 
62  void dump(std::ostream& out) const override {
63  m_arg1->dump(out);
64  out << " AND ";
65  m_arg2->dump(out);
66  }
67  };
68 
69  class OperatorOr : public BinaryOperator {
70  public:
71  OperatorOr(Evaluator* arg1, Evaluator* arg2) : BinaryOperator(arg1, arg2) {}
72 
73  bool operator()(const Data& data) const override {
74  // force the execution af both arguments, otherwise precalers won't work properly
75  bool r1 = (*m_arg1)(data);
76  bool r2 = (*m_arg2)(data);
77  return r1 or r2;
78  }
79 
80  void dump(std::ostream& out) const override {
81  m_arg1->dump(out);
82  out << " OR ";
83  m_arg2->dump(out);
84  }
85  };
86 
87  class OperatorXor : public BinaryOperator {
88  public:
89  OperatorXor(Evaluator* arg1, Evaluator* arg2) : BinaryOperator(arg1, arg2) {}
90 
91  bool operator()(const Data& data) const override {
92  // force the execution af both arguments, otherwise precalers won't work properly
93  bool r1 = (*m_arg1)(data);
94  bool r2 = (*m_arg2)(data);
95  return r1 xor r2;
96  }
97 
98  void dump(std::ostream& out) const override {
99  m_arg1->dump(out);
100  out << " XOR ";
101  m_arg2->dump(out);
102  }
103  };
104 
105 } // namespace triggerExpression
106 
107 #endif // HLTrigger_HLTfilters_TriggerExpressionOperators_h
boost::scoped_ptr< Evaluator > m_arg
void dump(std::ostream &out) const override
void init(const Data &data) override
BinaryOperator(Evaluator *arg1, Evaluator *arg2)
bool operator()(const Data &data) const override
OperatorOr(Evaluator *arg1, Evaluator *arg2)
A arg
Definition: Factorize.h:36
void init(const Data &data) override
bool operator()(const Data &data) const override
void dump(std::ostream &out) const override
bool operator()(const Data &data) const override
bool operator()(const Data &data) const override
void dump(std::ostream &out) const override
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
boost::scoped_ptr< Evaluator > m_arg2
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
boost::scoped_ptr< Evaluator > m_arg1
OperatorXor(Evaluator *arg1, Evaluator *arg2)
void dump(std::ostream &out) const override
OperatorAnd(Evaluator *arg1, Evaluator *arg2)