Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:34

0001 // -*- C++ -*-
0002 // $Id: CutBase.icc,v 1.3 2008/11/19 16:11:44 boudreau Exp $
0003 //-------------------------------------------------------------------//
0004 //                                                                   //
0005 // Implementations for the Cut class                                 //
0006 //                                                                   //
0007 //-------------------------------------------------------------------//
0008 template <class Type>
0009 Cut<Type>::Cut() {}
0010 
0011 template <class Type>
0012 Cut<Type>::Cut(const Cut<Type> & ) {}
0013 
0014 template <class Type>
0015 Cut<Type>::~Cut() {}
0016  
0017 template <class Type>
0018 typename Cut<Type>::OR Cut<Type>::operator || (const Cut<Type> & A) const {
0019    return OR(*this,A);
0020 }
0021 
0022 template <class Type>
0023 typename Cut<Type>::AND Cut<Type>::operator && (const Cut<Type> & A) const {
0024   return AND(*this,A);
0025 }
0026 
0027 template <class Type>
0028 typename Cut<Type>::NOT Cut<Type>::operator ! () const {
0029   return NOT(*this);
0030 }
0031 //-------------------------------------------------------------------//
0032 //                                                                   //
0033 // Implementations for the AND class                                 //
0034 //                                                                   //
0035 //-------------------------------------------------------------------//
0036 
0037 template <class Type>
0038 Cut<Type>::AND::AND(const AND & right):Cut<Type>(),
0039                        _pA(right._pA->clone()),
0040                        _pB(right._pB->clone())
0041 {
0042 
0043 }
0044 
0045 template <class Type>
0046 Cut<Type>::AND::AND(const Cut<Type> & A, const Cut<Type> & B):Cut<Type>(),
0047                                   _pA(A.clone()),
0048                                   _pB(B.clone())
0049 {
0050 }
0051 
0052 template <class Type>
0053 Cut<Type>::AND::~AND()
0054 {
0055   delete _pA;
0056   delete _pB;
0057 }
0058 
0059 
0060 template <class Type>
0061 typename Cut<Type>::AND *Cut<Type>::AND::clone() const
0062 {
0063   return new AND(*this);
0064 }
0065 
0066 template <class Type> 
0067 bool Cut<Type>::AND::operator () (const Type & t) const {
0068   return _pA->operator()(t) && _pB->operator()(t);
0069 }
0070 
0071 //-------------------------------------------------------------------//
0072 //                                                                   //
0073 // Implementations for the OR class                                  //
0074 //                                                                   //
0075 //-------------------------------------------------------------------//
0076 
0077 template <class Type>
0078 Cut<Type>::OR::OR(const OR & right):Cut<Type>(),
0079                     _pA(right._pA->clone()),
0080                     _pB(right._pB->clone())
0081 {
0082 
0083 }
0084 
0085 template <class Type>
0086 Cut<Type>::OR::OR(const Cut<Type> & A, const Cut<Type> & B):Cut<Type>(),
0087                                 _pA(A.clone()),
0088                                 _pB(B.clone())
0089 {
0090 }
0091 
0092 template <class Type>
0093 Cut<Type>::OR::~OR()
0094 {
0095   delete _pA;
0096   delete _pB;
0097 }
0098 
0099 
0100 template <class Type>
0101 typename Cut<Type>::OR *Cut<Type>::OR::clone() const
0102 {
0103   return new OR(*this);
0104 }
0105 
0106 template <class Type> 
0107 bool Cut<Type>::OR::operator () (const Type & t) const {
0108   return _pA->operator()(t) || _pB->operator()(t);
0109 }
0110 
0111 
0112 //-------------------------------------------------------------------//
0113 //                                                                   //
0114 // Implementations for the NOT class                                 //
0115 //                                                                   //
0116 //-------------------------------------------------------------------//
0117 
0118 template <class Type>
0119 Cut<Type>::NOT::NOT(const NOT & right):Cut<Type>(),
0120                        _pA(right._pA->clone())
0121 {
0122 
0123 }
0124 
0125 template <class Type>
0126 Cut<Type>::NOT::NOT(const Cut<Type> & A):Cut<Type>(),
0127                      _pA(A.clone())
0128 {
0129 }
0130 
0131 template <class Type>
0132 Cut<Type>::NOT::~NOT()
0133 {
0134   delete _pA;
0135 }
0136 
0137 
0138 template <class Type>
0139 typename Cut<Type>::NOT *Cut<Type>::NOT::clone() const
0140 {
0141   return new NOT(*this);
0142 }
0143 
0144 template <class Type> 
0145 bool Cut<Type>::NOT::operator () (const Type & t) const {
0146   return !_pA->operator()(t);
0147 }
0148 
0149 
0150 //-------------------------------------------------------------------//
0151 //                                                                   //
0152 // Implementations for the Predicate class, representing a unary     //
0153 // No-op and useful as a user-level data type, because it is         //
0154 // concrete, and clones on copy, therefore is useful in e.g. STL     // 
0155 // routines.                                                         //
0156 //                                                                   //
0157 //-------------------------------------------------------------------//
0158 
0159 template <class Type>
0160 Cut<Type>::Predicate::Predicate(const Predicate & right):
0161   _pA(right._pA->clone())
0162 {
0163 
0164 }
0165 
0166 template <class Type>
0167 Cut<Type>::Predicate::Predicate(const Cut<Type> & A):
0168   _pA(A.clone())
0169 {
0170 }
0171 
0172 template <class Type>
0173 Cut<Type>::Predicate::~Predicate()
0174 {
0175   delete _pA;
0176 }
0177 
0178 
0179 template <class Type>
0180 typename Cut<Type>::Predicate *Cut<Type>::Predicate::clone() const
0181 {
0182   return new Predicate(*this);
0183 }
0184 
0185 template <class Type> 
0186 bool Cut<Type>::Predicate::operator () (const Type & t) const {
0187   return _pA->operator()(t);
0188 }
0189