CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrinarySelector.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_TrinarySelector_h
2 #define CommonTools_Utils_TrinarySelector_h
3 /* \class reco::parser::TrinarySelector
4  *
5  * Trinary selector
6  *
7  * \author original version: Chris Jones, Cornell,
8  * adapted to Reflex by Luca Lista, INFN
9  *
10  * \version $Revision: 1.1 $
11  *
12  */
16 #include <boost/shared_ptr.hpp>
17 
18 namespace reco {
19  namespace parser {
20  struct TrinarySelector : public SelectorBase {
21  TrinarySelector( boost::shared_ptr<ExpressionBase> lhs,
22  boost::shared_ptr<ComparisonBase> cmp1,
23  boost::shared_ptr<ExpressionBase> mid,
24  boost::shared_ptr<ComparisonBase> cmp2,
25  boost::shared_ptr<ExpressionBase> rhs ) :
26  lhs_( lhs ), cmp1_( cmp1 ), mid_( mid ), cmp2_( cmp2 ),rhs_( rhs ) {}
27  virtual bool operator()( const Reflex::Object& o ) const {
28  return
29  cmp1_->compare( lhs_->value( o ), mid_->value( o ) ) &&
30  cmp2_->compare( mid_->value( o ), rhs_->value( o ) );
31  }
32  boost::shared_ptr<ExpressionBase> lhs_;
33  boost::shared_ptr<ComparisonBase> cmp1_;
34  boost::shared_ptr<ExpressionBase> mid_;
35  boost::shared_ptr<ComparisonBase> cmp2_;
36  boost::shared_ptr<ExpressionBase> rhs_;
37  };
38  }
39 }
40 
41 #endif
virtual bool operator()(const Reflex::Object &o) const
return true if the Refle object is selected
boost::shared_ptr< ComparisonBase > cmp1_
boost::shared_ptr< ComparisonBase > cmp2_
boost::shared_ptr< ExpressionBase > lhs_
boost::shared_ptr< ExpressionBase > rhs_
TrinarySelector(boost::shared_ptr< ExpressionBase > lhs, boost::shared_ptr< ComparisonBase > cmp1, boost::shared_ptr< ExpressionBase > mid, boost::shared_ptr< ComparisonBase > cmp2, boost::shared_ptr< ExpressionBase > rhs)
boost::shared_ptr< ExpressionBase > mid_