#include <L1GtLogicParser.h>
Classes | |
struct | OperandToken |
struct | OperationRule |
struct | TokenRPN |
Public Types | |
enum | OperationType { OP_NULL =1, OP_INVALID =2, OP_AND =4, OP_OR =8, OP_NOT =16, OP_OPERAND =32, OP_OPENBRACKET =64, OP_CLOSEBRACKET =128 } |
typedef std::vector< TokenRPN > | RpnVector |
Public Member Functions | |
void | buildOperandTokenVector () |
void | buildOperandTokenVectorNumExp () |
bool | buildRpnVector (const std::string &) |
build the rpn vector More... | |
bool | checkLogicalExpression (std::string &) |
check a logical expression for correctness - add/remove spaces if needed More... | |
void | clearRpnVector () |
clear possible old rpn vector More... | |
void | convertIntToNameLogicalExpression (const std::map< int, std::string > &intToNameMap) |
void | convertNameToIntLogicalExpression (const std::map< std::string, int > &nameToIntMap) |
virtual const bool | expressionResult () const |
virtual const bool | expressionResultNumExp () const |
std::vector< L1GtLogicParser::OperandToken > | expressionSeedsOperandList () |
L1GtLogicParser () | |
constructor(s) More... | |
L1GtLogicParser (const RpnVector &, const std::vector< OperandToken > &) | |
L1GtLogicParser (const std::string &logicalExpressionVal) | |
L1GtLogicParser (std::string &logicalExpressionVal) | |
L1GtLogicParser (const std::string logicalExpressionVal, const std::string numericalExpressionVal) | |
from a logical and a numerical expression More... | |
L1GtLogicParser (const std::string &logicalExpressionVal, const std::string &numericalExpressionVal, const bool dummy) | |
std::string | logicalExpression () const |
return the logical expression More... | |
std::string | numericalExpression () const |
return the numerical expression More... | |
int | operandIndex (const std::string &operandNameVal) const |
return the position index of the operand in the logical expression More... | |
std::string | operandName (const int iOperand) const |
return the name of the (iOperand)th operand in the logical expression More... | |
bool | operandResult (const std::string &operandNameVal) const |
bool | operandResult (const int tokenNumberVal) const |
bool | operandResultNumExp (const std::string &operandNameVal) const |
bool | operandResultNumExp (const int iOperand) const |
std::vector< OperandToken > & | operandTokenVector () |
return the vector of operand tokens More... | |
const std::vector< OperandToken > & | operandTokenVector () const |
RpnVector | rpnVector () const |
return the RPN vector More... | |
virtual | ~L1GtLogicParser () |
destructor More... | |
Protected Member Functions | |
void | addBracketSpaces (const std::string &, std::string &) |
add spaces before and after parantheses More... | |
virtual OperationType | getOperation (const std::string &tokenString, OperationType lastOperation, TokenRPN &rpnToken) const |
const OperationRule * | getRuleFromType (OperationType t) |
get the rule entry to an operation type More... | |
bool | setLogicalExpression (const std::string &) |
set the logical expression - check for correctness the input string More... | |
bool | setNumericalExpression (const std::string &) |
Protected Attributes | |
std::string | m_logicalExpression |
logical expression to be parsed More... | |
std::string | m_numericalExpression |
std::vector< OperandToken > | m_operandTokenVector |
vector of operand tokens More... | |
RpnVector | m_rpnVector |
RPN vector - equivalent to the logical expression. More... | |
Static Protected Attributes | |
static const struct OperationRule | m_operationRules [] |
Description: parses a logical expression, with predefined operators.
Implementation: <TODO: enter implementation details>
Description: see header file.
Implementation: <TODO: enter implementation details>
Definition at line 31 of file L1GtLogicParser.h.
typedef std::vector<TokenRPN> L1GtLogicParser::RpnVector |
Definition at line 60 of file L1GtLogicParser.h.
Enumerator | |
---|---|
OP_NULL | |
OP_INVALID | |
OP_AND | |
OP_OR | |
OP_NOT | |
OP_OPERAND | |
OP_OPENBRACKET | |
OP_CLOSEBRACKET |
Definition at line 43 of file L1GtLogicParser.h.
L1GtLogicParser::L1GtLogicParser | ( | ) |
L1GtLogicParser::L1GtLogicParser | ( | const RpnVector & | rpnVec, |
const std::vector< OperandToken > & | opTokenVector | ||
) |
from the RPN vector and the operand token vector no checks for consistency, empty logical and numerical expressions requires special care when used
Definition at line 46 of file L1GtLogicParser.cc.
References m_operandTokenVector, and m_rpnVector.
L1GtLogicParser::L1GtLogicParser | ( | const std::string & | logicalExpressionVal | ) |
from a constant logical expression numerical expression will be empty
Definition at line 57 of file L1GtLogicParser.cc.
References Exception, and setLogicalExpression().
L1GtLogicParser::L1GtLogicParser | ( | std::string & | logicalExpressionVal | ) |
Definition at line 75 of file L1GtLogicParser.cc.
References addBracketSpaces(), buildOperandTokenVector(), buildRpnVector(), Exception, m_logicalExpression, and AlCaHLTBitMon_QueryRunRegistry::string.
L1GtLogicParser::L1GtLogicParser | ( | const std::string | logicalExpressionVal, |
const std::string | numericalExpressionVal | ||
) |
from a logical and a numerical expression
Definition at line 109 of file L1GtLogicParser.cc.
References Exception, setLogicalExpression(), and setNumericalExpression().
L1GtLogicParser::L1GtLogicParser | ( | const std::string & | logicalExpressionVal, |
const std::string & | numericalExpressionVal, | ||
const bool | dummy | ||
) |
from a logical and a numerical expression no checks for correctness - use it only after the correctness was tested
Definition at line 134 of file L1GtLogicParser.cc.
References buildRpnVector(), clearRpnVector(), Exception, m_logicalExpression, and m_numericalExpression.
|
virtual |
|
protected |
add spaces before and after parantheses
Definition at line 1559 of file L1GtLogicParser.cc.
References brackets, position, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by checkLogicalExpression(), L1GtLogicParser(), setLogicalExpression(), and setNumericalExpression().
void L1GtLogicParser::buildOperandTokenVector | ( | ) |
build from the RPN vector the operand token vector dummy tokenNumber and tokenResult
Definition at line 434 of file L1GtLogicParser.cc.
References m_operandTokenVector, m_rpnVector, OP_AND, OP_NOT, OP_OPERAND, OP_OR, L1GtLogicParser::OperandToken::tokenName, L1GtLogicParser::OperandToken::tokenNumber, and L1GtLogicParser::OperandToken::tokenResult.
Referenced by L1GtLogicParser(), and rpnVector().
void L1GtLogicParser::buildOperandTokenVectorNumExp | ( | ) |
build from the RPN vector the operand token vector using a numerical expression
Definition at line 883 of file L1GtLogicParser.cc.
References m_operandTokenVector, m_rpnVector, OP_AND, OP_NOT, OP_OPERAND, OP_OR, operandResultNumExp(), L1GtLogicParser::OperandToken::tokenName, L1GtLogicParser::OperandToken::tokenNumber, and L1GtLogicParser::OperandToken::tokenResult.
Referenced by operandTokenVector().
bool L1GtLogicParser::buildRpnVector | ( | const std::string & | logicalExpressionVal | ) |
build the rpn vector
buildRpnVector Build the postfix notation.
expression | The expression to be parsed. |
Definition at line 196 of file L1GtLogicParser.cc.
References clearRpnVector(), getOperation(), m_rpnVector, OP_AND, OP_CLOSEBRACKET, OP_INVALID, OP_NOT, OP_NULL, OP_OPENBRACKET, OP_OPERAND, OP_OR, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by checkLogicalExpression(), L1GtLogicParser(), numericalExpression(), and setLogicalExpression().
bool L1GtLogicParser::checkLogicalExpression | ( | std::string & | logicalExpressionVal | ) |
check a logical expression for correctness - add/remove spaces if needed
Definition at line 160 of file L1GtLogicParser.cc.
References addBracketSpaces(), buildRpnVector(), clearRpnVector(), LogDebug, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by logicalExpression().
void L1GtLogicParser::clearRpnVector | ( | ) |
clear possible old rpn vector
Definition at line 424 of file L1GtLogicParser.cc.
References m_rpnVector.
Referenced by buildRpnVector(), checkLogicalExpression(), L1GtLogicParser(), numericalExpression(), and setLogicalExpression().
void L1GtLogicParser::convertIntToNameLogicalExpression | ( | const std::map< int, std::string > & | intToNameMap | ) |
convert a logical expression composed with integer numbers to a logical expression composed with names using a map (int, string)
Definition at line 1133 of file L1GtLogicParser.cc.
References TauDecayModes::dec, getOperation(), getRuleFromType(), m_logicalExpression, OP_INVALID, OP_NULL, OP_OPERAND, L1GtLogicParser::TokenRPN::operand, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by L1GtTriggerMenuConfigOnlineProd::convertLogicalExpression(), and operandTokenVector().
void L1GtLogicParser::convertNameToIntLogicalExpression | ( | const std::map< std::string, int > & | nameToIntMap | ) |
convert the logical expression composed with names to a logical expression composed with int numbers using a (string, int) map
Definition at line 1033 of file L1GtLogicParser.cc.
References getOperation(), getRuleFromType(), Json::intValue, LogDebug, m_logicalExpression, OP_INVALID, OP_NULL, OP_OPERAND, L1GtLogicParser::TokenRPN::operand, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by operandTokenVector().
|
virtual |
return the result for the logical expression require a proper operand token vector
Definition at line 685 of file L1GtLogicParser.cc.
References m_rpnVector, OP_AND, OP_NOT, OP_OPERAND, OP_OR, and operandResult().
Referenced by TriggerHelper::acceptGtLogicalExpression(), GenericTriggerEventFlag::acceptGtLogicalExpression(), TriggerHelper::acceptHltLogicalExpression(), GenericTriggerEventFlag::acceptHltLogicalExpression(), TriggerHelper::acceptL1LogicalExpression(), GenericTriggerEventFlag::acceptL1LogicalExpression(), HLTLevel1GTSeed::hltFilter(), operandTokenVector(), and HLTLevel1GTSeed::seedsL1TriggerObjectMaps().
|
virtual |
return the result for the logical expression require a proper numerical expression
Definition at line 946 of file L1GtLogicParser.cc.
References m_rpnVector, OP_AND, OP_NOT, OP_OPERAND, OP_OR, and operandResultNumExp().
Referenced by operandTokenVector().
std::vector< L1GtLogicParser::OperandToken > L1GtLogicParser::expressionSeedsOperandList | ( | ) |
return the list of operand tokens for the logical expression which are to be used as seeds
Definition at line 1228 of file L1GtLogicParser.cc.
References m_operandTokenVector, m_rpnVector, OP_AND, OP_NOT, OP_OPERAND, OP_OR, L1GtLogicParser::OperandToken::tokenName, L1GtLogicParser::OperandToken::tokenNumber, and L1GtLogicParser::OperandToken::tokenResult.
Referenced by L1GtTriggerMenuTester::associateL1SeedsHltPath(), HLTLevel1GTSeed::HLTLevel1GTSeed(), operandTokenVector(), and HLTLevel1GTSeed::seedsL1TriggerObjectMaps().
|
protectedvirtual |
getOperation Get the operation from a string and check if it is allowed
tokenString | The string to examine. |
lastOperation | The last operation. |
rpnToken | The destination where the token for postfix notation is written to. |
Definition at line 1490 of file L1GtLogicParser.cc.
References mps_fire::i, m_operationRules, OP_INVALID, OP_OPERAND, L1GtLogicParser::TokenRPN::operand, and L1GtLogicParser::TokenRPN::operation.
Referenced by buildRpnVector(), convertIntToNameLogicalExpression(), convertNameToIntLogicalExpression(), operandIndex(), operandName(), and operandResultNumExp().
|
protected |
get the rule entry to an operation type
getRuleFromType Looks for the entry in the operation rules and returns a reference if it was found
oType | The type of the operation. |
Definition at line 1538 of file L1GtLogicParser.cc.
References mps_fire::i, m_operationRules, and OP_NULL.
Referenced by convertIntToNameLogicalExpression(), and convertNameToIntLogicalExpression().
|
inline |
return the logical expression
Definition at line 98 of file L1GtLogicParser.h.
References checkLogicalExpression(), m_logicalExpression, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by L1GtTriggerMenuConfigOnlineProd::convertLogicalExpression().
|
inline |
return the numerical expression
Definition at line 104 of file L1GtLogicParser.h.
References buildRpnVector(), clearRpnVector(), m_numericalExpression, and AlCaHLTBitMon_QueryRunRegistry::string.
int L1GtLogicParser::operandIndex | ( | const std::string & | operandNameVal | ) | const |
return the position index of the operand in the logical expression
Definition at line 496 of file L1GtLogicParser.cc.
References getOperation(), m_logicalExpression, OP_INVALID, OP_NULL, OP_OPERAND, L1GtLogicParser::TokenRPN::operand, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by operandResultNumExp(), and operandTokenVector().
std::string L1GtLogicParser::operandName | ( | const int | iOperand | ) | const |
return the name of the (iOperand)th operand in the logical expression
Definition at line 568 of file L1GtLogicParser.cc.
References getOperation(), m_logicalExpression, OP_INVALID, OP_NULL, OP_OPERAND, L1GtLogicParser::TokenRPN::operand, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by operandTokenVector().
bool L1GtLogicParser::operandResult | ( | const std::string & | operandNameVal | ) | const |
return the result for an operand with name operandNameVal in the logical expression using the operand token vector
Definition at line 642 of file L1GtLogicParser.cc.
References mps_fire::i, and m_operandTokenVector.
Referenced by expressionResult(), operandResultNumExp(), and operandTokenVector().
bool L1GtLogicParser::operandResult | ( | const int | tokenNumberVal | ) | const |
return the result for an operand with tokenNumberVal using the operand token vector
Definition at line 663 of file L1GtLogicParser.cc.
References mps_fire::i, and m_operandTokenVector.
bool L1GtLogicParser::operandResultNumExp | ( | const std::string & | operandNameVal | ) | const |
return the result for an operand with name operandNameVal in the logical expression using a numerical expression
Definition at line 769 of file L1GtLogicParser.cc.
References operandIndex(), operandResult(), and mps_fire::result.
Referenced by buildOperandTokenVectorNumExp(), expressionResultNumExp(), and operandTokenVector().
bool L1GtLogicParser::operandResultNumExp | ( | const int | iOperand | ) | const |
return the result for an operand with index iOperand in the logical expression using a numerical expression
Definition at line 785 of file L1GtLogicParser.cc.
References getOperation(), m_numericalExpression, OP_INVALID, OP_NULL, OP_OPERAND, L1GtLogicParser::TokenRPN::operand, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.
|
inline |
return the vector of operand tokens
Definition at line 122 of file L1GtLogicParser.h.
References m_operandTokenVector.
Referenced by TriggerHelper::acceptGtLogicalExpression(), GenericTriggerEventFlag::acceptGtLogicalExpression(), TriggerHelper::acceptHltLogicalExpression(), GenericTriggerEventFlag::acceptHltLogicalExpression(), TriggerHelper::acceptL1LogicalExpression(), GenericTriggerEventFlag::acceptL1LogicalExpression(), HLTLevel1GTSeed::convertStringToBitNumber(), HLTLevel1GTSeed::debugPrint(), HLTLevel1GTSeed::HLTLevel1GTSeed(), L1GtUtils::LogicalExpressionL1Results::initialize(), and HLTLevel1GTSeed::updateAlgoLogicParser().
|
inline |
Definition at line 123 of file L1GtLogicParser.h.
References buildOperandTokenVectorNumExp(), convertIntToNameLogicalExpression(), convertNameToIntLogicalExpression(), expressionResult(), expressionResultNumExp(), expressionSeedsOperandList(), m_operandTokenVector, operandIndex(), operandName(), operandResult(), operandResultNumExp(), and AlCaHLTBitMon_QueryRunRegistry::string.
|
inline |
return the RPN vector
Definition at line 115 of file L1GtLogicParser.h.
References buildOperandTokenVector(), and m_rpnVector.
Referenced by L1GtAlgorithm::L1GtAlgorithm().
|
protected |
set the logical expression - check for correctness the input string
Definition at line 1587 of file L1GtLogicParser.cc.
References addBracketSpaces(), buildRpnVector(), clearRpnVector(), m_logicalExpression, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by L1GtLogicParser().
|
protected |
set the numerical expression (the logical expression with each operand replaced with the value) from a string check also for correctness the input string
Definition at line 1618 of file L1GtLogicParser.cc.
References addBracketSpaces(), m_numericalExpression, m_operationRules, OP_AND, OP_CLOSEBRACKET, OP_NOT, OP_NULL, OP_OPENBRACKET, OP_OPERAND, OP_OR, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by L1GtLogicParser().
|
protected |
logical expression to be parsed
Definition at line 212 of file L1GtLogicParser.h.
Referenced by convertIntToNameLogicalExpression(), convertNameToIntLogicalExpression(), L1GtLogicParser(), logicalExpression(), operandIndex(), operandName(), and setLogicalExpression().
|
protected |
numerical expression (logical expression with operands replaced with the actual values)
Definition at line 216 of file L1GtLogicParser.h.
Referenced by L1GtLogicParser(), numericalExpression(), operandResultNumExp(), and setNumericalExpression().
|
protected |
vector of operand tokens
Definition at line 222 of file L1GtLogicParser.h.
Referenced by buildOperandTokenVector(), buildOperandTokenVectorNumExp(), expressionSeedsOperandList(), L1GtLogicParser(), operandResult(), and operandTokenVector().
|
staticprotected |
Definition at line 194 of file L1GtLogicParser.h.
Referenced by getOperation(), getRuleFromType(), and setNumericalExpression().
|
protected |
RPN vector - equivalent to the logical expression.
Definition at line 219 of file L1GtLogicParser.h.
Referenced by buildOperandTokenVector(), buildOperandTokenVectorNumExp(), buildRpnVector(), clearRpnVector(), expressionResult(), expressionResultNumExp(), expressionSeedsOperandList(), L1GtLogicParser(), and rpnVector().