CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pathStatusExpression::Grammar< Iterator > Class Template Reference
Inheritance diagram for pathStatusExpression::Grammar< Iterator >:

Public Member Functions

 Grammar (ShuntingYardAlgorithm *algorithm)
 

Private Attributes

qi::rule< IteratorafterOperator
 
ShuntingYardAlgorithmalgorithm_
 
qi::rule< Iterator, ascii::space_type > binaryOperand
 
qi::rule< IteratorbinaryOperator
 
qi::rule< IteratorbinaryOperatorTest
 
qi::rule< Iterator, ascii::space_type > expression
 
qi::rule< IteratorpathName
 
qi::rule< IteratorunaryOperator
 

Detailed Description

template<typename Iterator>
class pathStatusExpression::Grammar< Iterator >

Definition at line 275 of file L1GTAlgoBlockProducer.cc.

Constructor & Destructor Documentation

◆ Grammar()

template<typename Iterator>
pathStatusExpression::Grammar< Iterator >::Grammar ( ShuntingYardAlgorithm algorithm)
inline

Definition at line 277 of file L1GTAlgoBlockProducer.cc.

References pathStatusExpression::ShuntingYardAlgorithm::addBeginParenthesis(), pathStatusExpression::ShuntingYardAlgorithm::addEndParenthesis(), pathStatusExpression::ShuntingYardAlgorithm::addOperatorAnd(), pathStatusExpression::ShuntingYardAlgorithm::addOperatorNot(), pathStatusExpression::ShuntingYardAlgorithm::addOperatorOr(), pathStatusExpression::ShuntingYardAlgorithm::addPathName(), pathStatusExpression::Grammar< Iterator >::afterOperator, pathStatusExpression::Grammar< Iterator >::algorithm_, pathStatusExpression::Grammar< Iterator >::binaryOperand, pathStatusExpression::Grammar< Iterator >::binaryOperator, pathStatusExpression::Grammar< Iterator >::binaryOperatorTest, pathStatusExpression::Grammar< Iterator >::expression, pathStatusExpression::Grammar< Iterator >::pathName, and pathStatusExpression::Grammar< Iterator >::unaryOperator.

277  : Grammar::base_type(expression), algorithm_(algorithm) {
278  // setup functors that call into shunting algorithm while parsing the logical expression
279  auto addPathName = std::bind(&ShuntingYardAlgorithm::addPathName, algorithm_, std::placeholders::_1);
280  auto addOperatorNot = std::bind(&ShuntingYardAlgorithm::addOperatorNot, algorithm_);
281  auto addOperatorAnd = std::bind(&ShuntingYardAlgorithm::addOperatorAnd, algorithm_);
282  auto addOperatorOr = std::bind(&ShuntingYardAlgorithm::addOperatorOr, algorithm_);
283  auto addBeginParenthesis = std::bind(&ShuntingYardAlgorithm::addBeginParenthesis, algorithm_);
284  auto addEndParenthesis = std::bind(&ShuntingYardAlgorithm::addEndParenthesis, algorithm_);
285 
286  // Define the syntax allowed in the logical expressions
287  pathName = !unaryOperator >> !binaryOperatorTest >> (+qi::char_("a-zA-Z0-9_"))[addPathName];
288  binaryOperand = (qi::lit('(')[addBeginParenthesis] >> expression >> qi::lit(')')[addEndParenthesis]) |
289  (unaryOperator[addOperatorNot] >> binaryOperand) | pathName;
290  afterOperator = ascii::space | &qi::lit('(') | &qi::eoi;
291  unaryOperator = qi::lit("not") >> afterOperator;
292  // The only difference in the next two is that one calls a functor and the other does not
293  binaryOperatorTest = (qi::lit("and") >> afterOperator) | (qi::lit("or") >> afterOperator);
295  (qi::lit("and") >> afterOperator)[addOperatorAnd] | (qi::lit("or") >> afterOperator)[addOperatorOr];
297  }
qi::rule< Iterator, ascii::space_type > expression
void addPathName(std::vector< char > const &s)
qi::rule< Iterator, ascii::space_type > binaryOperand
ShuntingYardAlgorithm * algorithm_

Member Data Documentation

◆ afterOperator

template<typename Iterator>
qi::rule<Iterator> pathStatusExpression::Grammar< Iterator >::afterOperator
private

◆ algorithm_

template<typename Iterator>
ShuntingYardAlgorithm* pathStatusExpression::Grammar< Iterator >::algorithm_
private

◆ binaryOperand

template<typename Iterator>
qi::rule<Iterator, ascii::space_type> pathStatusExpression::Grammar< Iterator >::binaryOperand
private

◆ binaryOperator

template<typename Iterator>
qi::rule<Iterator> pathStatusExpression::Grammar< Iterator >::binaryOperator
private

◆ binaryOperatorTest

template<typename Iterator>
qi::rule<Iterator> pathStatusExpression::Grammar< Iterator >::binaryOperatorTest
private

◆ expression

template<typename Iterator>
qi::rule<Iterator, ascii::space_type> pathStatusExpression::Grammar< Iterator >::expression
private

◆ pathName

template<typename Iterator>
qi::rule<Iterator> pathStatusExpression::Grammar< Iterator >::pathName
private

◆ unaryOperator

template<typename Iterator>
qi::rule<Iterator> pathStatusExpression::Grammar< Iterator >::unaryOperator
private