CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  m_arg(arg)
14  { }
15 
16  // initialize the depending modules
17  void init(const Data & data) {
18  m_arg->init(data);
19  }
20 
21 protected:
22  boost::scoped_ptr<Evaluator> m_arg;
23 };
24 
25 // abstract binary operator
26 class BinaryOperator : public Evaluator {
27 public:
29  m_arg1(arg1),
30  m_arg2(arg2)
31  { }
32 
33  // initialize the depending modules
34  void init(const Data & data) {
35  m_arg1->init(data);
36  m_arg2->init(data);
37  }
38 
39 protected:
40  boost::scoped_ptr<Evaluator> m_arg1;
41  boost::scoped_ptr<Evaluator> m_arg2;
42 };
43 
44 
45 // concrete operators
46 
47 class OperatorNot : public UnaryOperator {
48 public:
50  UnaryOperator(arg)
51  { }
52 
53  bool operator()(const Data & data) const {
54  return not (*m_arg)(data);
55  }
56 
57  void dump(std::ostream & out) const {
58  out << "NOT ";
59  m_arg->dump(out);
60  }
61 };
62 
63 class OperatorAnd : public BinaryOperator {
64 public:
65  OperatorAnd(Evaluator * arg1, Evaluator * arg2) :
66  BinaryOperator(arg1, arg2)
67  { }
68 
69  bool operator()(const Data & data) const {
70  // force the execution af both arguments, otherwise precalers won't work properly
71  bool r1 = (*m_arg1)(data);
72  bool r2 = (*m_arg2)(data);
73  return r1 and r2;
74  }
75 
76  void dump(std::ostream & out) const {
77  m_arg1->dump(out);
78  out << " AND ";
79  m_arg2->dump(out);
80  }
81 };
82 
83 class OperatorOr : public BinaryOperator {
84 public:
85  OperatorOr(Evaluator * arg1, Evaluator * arg2) :
86  BinaryOperator(arg1, arg2)
87  { }
88 
89  bool operator()(const Data & data) const {
90  // force the execution af both arguments, otherwise precalers won't work properly
91  bool r1 = (*m_arg1)(data);
92  bool r2 = (*m_arg2)(data);
93  return r1 or r2;
94  }
95 
96  void dump(std::ostream & out) const {
97  m_arg1->dump(out);
98  out << " OR ";
99  m_arg2->dump(out);
100  }
101 };
102 
103 class OperatorXor : public BinaryOperator {
104 public:
105  OperatorXor(Evaluator * arg1, Evaluator * arg2) :
106  BinaryOperator(arg1, arg2)
107  { }
108 
109  bool operator()(const Data & data) const {
110  // force the execution af both arguments, otherwise precalers won't work properly
111  bool r1 = (*m_arg1)(data);
112  bool r2 = (*m_arg2)(data);
113  return r1 xor r2;
114  }
115 
116  void dump(std::ostream & out) const {
117  m_arg1->dump(out);
118  out << " XOR ";
119  m_arg2->dump(out);
120  }
121 };
122 
123 } // namespace triggerExpression
124 
125 #endif // HLTrigger_HLTfilters_TriggerExpressionOperators_h
boost::scoped_ptr< Evaluator > m_arg
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
BinaryOperator(Evaluator *arg1, Evaluator *arg2)
OperatorOr(Evaluator *arg1, Evaluator *arg2)
A arg
Definition: Factorize.h:36
bool operator()(const Data &data) const
void dump(std::ostream &out) const
void dump(std::ostream &out) const
bool operator()(const Data &data) const
boost::scoped_ptr< Evaluator > m_arg2
void dump(std::ostream &out) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
boost::scoped_ptr< Evaluator > m_arg1
bool operator()(const Data &data) const
bool operator()(const Data &data) const
void dump(std::ostream &out) const
OperatorXor(Evaluator *arg1, Evaluator *arg2)
OperatorAnd(Evaluator *arg1, Evaluator *arg2)