Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CommonTools_Utils_ComparisonSetter_h
0002 #define CommonTools_Utils_ComparisonSetter_h
0003 /* \class reco::parser::ComparisonSetter
0004  *
0005  * Comparison setter
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/ComparisonStack.h"
0014 #include "CommonTools/Utils/interface/parser/Comparison.h"
0015 #ifdef BOOST_SPIRIT_DEBUG
0016 #include <iostream>
0017 #include <string>
0018 #endif
0019 #include <memory>
0020 
0021 namespace reco {
0022   namespace parser {
0023 #ifdef BOOST_SPIRIT_DEBUG
0024     template <typename Op>
0025     struct cmp_out {
0026       static const std::string value;
0027     };
0028 #endif
0029 
0030     template <class CompT>
0031     struct ComparisonSetter {
0032       ComparisonSetter(ComparisonStack& stack) : stack_(stack) {}
0033       void operator()(const char) const {
0034 #ifdef BOOST_SPIRIT_DEBUG
0035         BOOST_SPIRIT_DEBUG_OUT << "pushing comparison: " << cmp_out<CompT>::value << std::endl;
0036 #endif
0037         stack_.push_back(std::shared_ptr<ComparisonBase>(new Comparison<CompT>()));
0038       }
0039 
0040     private:
0041       ComparisonStack& stack_;
0042     };
0043   }  // namespace parser
0044 }  // namespace reco
0045 
0046 #endif