Marlin
01.17.01
|
Helper class that holds named boolean values and named conditions that are expressions of these values and computes the corresponding truth values. More...
#include <LogicalExpressions.h>
Public Member Functions | |
LogicalExpressions () | |
C'tor. More... | |
virtual | ~LogicalExpressions () |
Virtual d'tor. More... | |
void | addCondition (const std::string &name, const std::string &expression) |
Add a new named logical expression formed out of [!,(,&&,||,),value], e.g. More... | |
void | clear () |
Clear all boolean values. More... | |
bool | conditionIsTrue (const std::string &name) |
True if the named condition (stored with addCondition) is true with the current values. More... | |
bool | expressionIsTrue (const std::string &expression) |
True if the given expression is true with the current values. More... | |
void | setValue (const std::string &key, bool val) |
Set the the boolean value for the given key. More... | |
Protected Member Functions | |
bool | getValue (const std::string &key) |
helper function for finding return values, that actually have been set by their corresponding processor - throws exception if not set More... | |
Protected Attributes | |
ConditionsMap | _condMap {} |
ResultMap | _resultMap {} |
Helper class that holds named boolean values and named conditions that are expressions of these values and computes the corresponding truth values.
Definition at line 143 of file LogicalExpressions.h.
marlin::LogicalExpressions::LogicalExpressions | ( | ) |
|
inlinevirtual |
Virtual d'tor.
Definition at line 152 of file LogicalExpressions.h.
void marlin::LogicalExpressions::addCondition | ( | const std::string & | name, |
const std::string & | expression | ||
) |
Add a new named logical expression formed out of [!,(,&&,||,),value], e.g.
( A && ( B || !C ) ) || ( !B && D )
Definition at line 28 of file LogicalExpressions.cc.
References _condMap.
Referenced by marlin::ProcessorMgr::addActiveProcessor().
void marlin::LogicalExpressions::clear | ( | ) |
Clear all boolean values.
Definition at line 34 of file LogicalExpressions.cc.
References _resultMap, std::map< K, T >::begin(), std::map< K, T >::end(), and setValue().
Referenced by marlin::ProcessorMgr::modifyEvent(), and marlin::ProcessorMgr::processEvent().
bool marlin::LogicalExpressions::conditionIsTrue | ( | const std::string & | name | ) |
True if the named condition (stored with addCondition) is true with the current values.
Definition at line 46 of file LogicalExpressions.cc.
References _condMap, and expressionIsTrue().
Referenced by marlin::ProcessorMgr::modifyEvent(), and marlin::ProcessorMgr::processEvent().
bool marlin::LogicalExpressions::expressionIsTrue | ( | const std::string & | expression | ) |
True if the given expression is true with the current values.
Definition at line 51 of file LogicalExpressions.cc.
References marlin::Expression::AND, std::string::begin(), std::vector< T >::begin(), std::string::end(), std::vector< T >::end(), std::for_each(), getValue(), and std::vector< T >::size().
Referenced by conditionIsTrue().
|
protected |
helper function for finding return values, that actually have been set by their corresponding processor - throws exception if not set
Definition at line 113 of file LogicalExpressions.cc.
References _resultMap, std::map< K, T >::begin(), std::map< K, T >::end(), std::endl(), std::map< K, T >::find(), and std::ostringstream::str().
Referenced by expressionIsTrue().
void marlin::LogicalExpressions::setValue | ( | const std::string & | key, |
bool | val | ||
) |
Set the the boolean value for the given key.
Definition at line 102 of file LogicalExpressions.cc.
References _resultMap.
Referenced by clear(), LogicalExpressions(), and marlin::ProcessorMgr::setProcessorReturnValue().
|
protected |
Definition at line 177 of file LogicalExpressions.h.
Referenced by addCondition(), and conditionIsTrue().
|
protected |
Definition at line 178 of file LogicalExpressions.h.
Referenced by clear(), getValue(), and setValue().