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 276 of file L1GTAlgoBlockProducer.cc.

Constructor & Destructor Documentation

◆ Grammar()

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

Definition at line 278 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.

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