CLHEP  2.4.7.2
C++ Class Library for High Energy Physics
CutBase.icc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: CutBase.icc,v 1.3 2008/11/19 16:11:44 boudreau Exp $
3 //-------------------------------------------------------------------//
4 // //
5 // Implementations for the Cut class //
6 // //
7 //-------------------------------------------------------------------//
8 template <class Type>
9 Cut<Type>::Cut() {}
10 
11 template <class Type>
12 Cut<Type>::Cut(const Cut<Type> & ) {}
13 
14 template <class Type>
15 Cut<Type>::~Cut() {}
16 
17 template <class Type>
18 typename Cut<Type>::OR Cut<Type>::operator || (const Cut<Type> & A) const {
19  return OR(*this,A);
20 }
21 
22 template <class Type>
23 typename Cut<Type>::AND Cut<Type>::operator && (const Cut<Type> & A) const {
24  return AND(*this,A);
25 }
26 
27 template <class Type>
28 typename Cut<Type>::NOT Cut<Type>::operator ! () const {
29  return NOT(*this);
30 }
31 //-------------------------------------------------------------------//
32 // //
33 // Implementations for the AND class //
34 // //
35 //-------------------------------------------------------------------//
36 
37 template <class Type>
38 Cut<Type>::AND::AND(const AND & right):Cut<Type>(),
39  _pA(right._pA->clone()),
40  _pB(right._pB->clone())
41 {
42 
43 }
44 
45 template <class Type>
46 Cut<Type>::AND::AND(const Cut<Type> & A, const Cut<Type> & B):Cut<Type>(),
47  _pA(A.clone()),
48  _pB(B.clone())
49 {
50 }
51 
52 template <class Type>
53 Cut<Type>::AND::~AND()
54 {
55  delete _pA;
56  delete _pB;
57 }
58 
59 
60 template <class Type>
61 typename Cut<Type>::AND *Cut<Type>::AND::clone() const
62 {
63  return new AND(*this);
64 }
65 
66 template <class Type>
67 bool Cut<Type>::AND::operator () (const Type & t) const {
68  return _pA->operator()(t) && _pB->operator()(t);
69 }
70 
71 //-------------------------------------------------------------------//
72 // //
73 // Implementations for the OR class //
74 // //
75 //-------------------------------------------------------------------//
76 
77 template <class Type>
78 Cut<Type>::OR::OR(const OR & right):Cut<Type>(),
79  _pA(right._pA->clone()),
80  _pB(right._pB->clone())
81 {
82 
83 }
84 
85 template <class Type>
86 Cut<Type>::OR::OR(const Cut<Type> & A, const Cut<Type> & B):Cut<Type>(),
87  _pA(A.clone()),
88  _pB(B.clone())
89 {
90 }
91 
92 template <class Type>
93 Cut<Type>::OR::~OR()
94 {
95  delete _pA;
96  delete _pB;
97 }
98 
99 
100 template <class Type>
101 typename Cut<Type>::OR *Cut<Type>::OR::clone() const
102 {
103  return new OR(*this);
104 }
105 
106 template <class Type>
107 bool Cut<Type>::OR::operator () (const Type & t) const {
108  return _pA->operator()(t) || _pB->operator()(t);
109 }
110 
111 
112 //-------------------------------------------------------------------//
113 // //
114 // Implementations for the NOT class //
115 // //
116 //-------------------------------------------------------------------//
117 
118 template <class Type>
119 Cut<Type>::NOT::NOT(const NOT & right):Cut<Type>(),
120  _pA(right._pA->clone())
121 {
122 
123 }
124 
125 template <class Type>
126 Cut<Type>::NOT::NOT(const Cut<Type> & A):Cut<Type>(),
127  _pA(A.clone())
128 {
129 }
130 
131 template <class Type>
132 Cut<Type>::NOT::~NOT()
133 {
134  delete _pA;
135 }
136 
137 
138 template <class Type>
139 typename Cut<Type>::NOT *Cut<Type>::NOT::clone() const
140 {
141  return new NOT(*this);
142 }
143 
144 template <class Type>
145 bool Cut<Type>::NOT::operator () (const Type & t) const {
146  return !_pA->operator()(t);
147 }
148 
149 
150 //-------------------------------------------------------------------//
151 // //
152 // Implementations for the Predicate class, representing a unary //
153 // No-op and useful as a user-level data type, because it is //
154 // concrete, and clones on copy, therefore is useful in e.g. STL //
155 // routines. //
156 // //
157 //-------------------------------------------------------------------//
158 
159 template <class Type>
160 Cut<Type>::Predicate::Predicate(const Predicate & right):
161  _pA(right._pA->clone())
162 {
163 
164 }
165 
166 template <class Type>
167 Cut<Type>::Predicate::Predicate(const Cut<Type> & A):
168  _pA(A.clone())
169 {
170 }
171 
172 template <class Type>
173 Cut<Type>::Predicate::~Predicate()
174 {
175  delete _pA;
176 }
177 
178 
179 template <class Type>
180 typename Cut<Type>::Predicate *Cut<Type>::Predicate::clone() const
181 {
182  return new Predicate(*this);
183 }
184 
185 template <class Type>
186 bool Cut<Type>::Predicate::operator () (const Type & t) const {
187  return _pA->operator()(t);
188 }
189