Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:17

0001 #ifndef CommonTools_Utils_BinarySelector_h
0002 #define CommonTools_Utils_BinarySelector_h
0003 /* \class reco::parser::BinarySelector
0004  *
0005  * Binary selector
0006  *
0007  * \author original version: Chris Jones, Cornell, 
0008  *         adapted by Luca Lista, INFN
0009  *
0010  * \version $Revision: 1.2 $
0011  *
0012  */
0013 #include "CommonTools/Utils/interface/parser/SelectorBase.h"
0014 #include "CommonTools/Utils/interface/parser/ExpressionBase.h"
0015 #include "CommonTools/Utils/interface/parser/ComparisonBase.h"
0016 
0017 namespace reco {
0018   namespace parser {
0019     struct BinarySelector : public SelectorBase {
0020       BinarySelector(std::shared_ptr<ExpressionBase> lhs,
0021                      std::shared_ptr<ComparisonBase> cmp,
0022                      std::shared_ptr<ExpressionBase> rhs)
0023           : lhs_(lhs), cmp_(cmp), rhs_(rhs) {}
0024       bool operator()(const edm::ObjectWithDict& o) const override {
0025         return cmp_->compare(lhs_->value(o), rhs_->value(o));
0026       }
0027       std::shared_ptr<ExpressionBase> lhs_;
0028       std::shared_ptr<ComparisonBase> cmp_;
0029       std::shared_ptr<ExpressionBase> rhs_;
0030     };
0031   }  // namespace parser
0032 }  // namespace reco
0033 
0034 #endif