//-------------------------------------------------------------------// // // // Implementations for the Cut class // // // //-------------------------------------------------------------------// template Cut::Cut() {} template Cut::Cut(const Cut & right) {} template Cut::~Cut() {} template Cut::OR Cut::operator || (const Cut & A) const { return OR(*this,A); } template Cut::AND Cut::operator && (const Cut & A) const { return AND(*this,A); } template Cut::NOT Cut::operator ! () const { return NOT(*this); } //-------------------------------------------------------------------// // // // Implementations for the AND class // // // //-------------------------------------------------------------------// template Cut::AND::AND(const AND & right): _pA(right._pA->clone()), _pB(right._pB->clone()) { } template Cut::AND::AND(const Cut & A, const Cut & B): _pA(A.clone()), _pB(B.clone()) { } template Cut::AND::~AND() { delete _pA; delete _pB; } template Cut::AND *Cut::AND::clone() const { return new AND(*this); } template bool Cut::AND::operator () (const Type & t) const { return _pA->operator()(t) && _pB->operator()(t); } //-------------------------------------------------------------------// // // // Implementations for the OR class // // // //-------------------------------------------------------------------// template Cut::OR::OR(const OR & right): _pA(right._pA->clone()), _pB(right._pB->clone()) { } template Cut::OR::OR(const Cut & A, const Cut & B): _pA(A.clone()), _pB(B.clone()) { } template Cut::OR::~OR() { delete _pA; delete _pB; } template Cut::OR *Cut::OR::clone() const { return new OR(*this); } template bool Cut::OR::operator () (const Type & t) const { return _pA->operator()(t) || _pB->operator()(t); } //-------------------------------------------------------------------// // // // Implementations for the NOT class // // // //-------------------------------------------------------------------// template Cut::NOT::NOT(const NOT & right): _pA(right._pA->clone()) { } template Cut::NOT::NOT(const Cut & A): _pA(A.clone()) { } template Cut::NOT::~NOT() { delete _pA; } template Cut::NOT *Cut::NOT::clone() const { return new NOT(*this); } template bool Cut::NOT::operator () (const Type & t) const { return !_pA->operator()(t); } //-------------------------------------------------------------------// // // // Implementations for the Predicate class, representing a unary // // No-op and useful as a user-level data type, because it is // // concrete, and clones on copy, therefore is useful in e.g. STL // // routines. // // // //-------------------------------------------------------------------// template Cut::Predicate::Predicate(const Predicate & right): _pA(right._pA->clone()) { } template Cut::Predicate::Predicate(const Cut & A): _pA(A.clone()) { } template Cut::Predicate::~Predicate() { delete _pA; } template Cut::Predicate *Cut::Predicate::clone() const { return new Predicate(*this); } template bool Cut::Predicate::operator () (const Type & t) const { return _pA->operator()(t); }