test
CMS 3D CMS Logo

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