ComparisonSetter

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#ifndef CommonTools_Utils_ComparisonSetter_h
#define CommonTools_Utils_ComparisonSetter_h
/* \class reco::parser::ComparisonSetter
 *
 * Comparison setter
 *
 * \author original version: Chris Jones, Cornell, 
 *         adapted by Luca Lista, INFN
 *
 * \version $Revision: 1.2 $
 *
 */
#include "CommonTools/Utils/interface/parser/ComparisonStack.h"
#include "CommonTools/Utils/interface/parser/Comparison.h"
#ifdef BOOST_SPIRIT_DEBUG
#include <iostream>
#include <string>
#endif
#include <memory>

namespace reco {
  namespace parser {
#ifdef BOOST_SPIRIT_DEBUG
    template <typename Op>
    struct cmp_out {
      static const std::string value;
    };
#endif

    template <class CompT>
    struct ComparisonSetter {
      ComparisonSetter(ComparisonStack& stack) : stack_(stack) {}
      void operator()(const char) const {
#ifdef BOOST_SPIRIT_DEBUG
        BOOST_SPIRIT_DEBUG_OUT << "pushing comparison: " << cmp_out<CompT>::value << std::endl;
#endif
        stack_.push_back(std::shared_ptr<ComparisonBase>(new Comparison<CompT>()));
      }

    private:
      ComparisonStack& stack_;
    };
  }  // namespace parser
}  // namespace reco

#endif