Marlin  01.17.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
marlin::LogicalExpressions Class Reference

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 {}
 

Detailed Description

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.

Constructor & Destructor Documentation

marlin::LogicalExpressions::LogicalExpressions ( )

C'tor.

Definition at line 20 of file LogicalExpressions.cc.

References setValue().

virtual marlin::LogicalExpressions::~LogicalExpressions ( )
inlinevirtual

Virtual d'tor.

Definition at line 152 of file LogicalExpressions.h.

Member Function Documentation

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 ( )
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().

bool marlin::LogicalExpressions::getValue ( const std::string key)
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().

Member Data Documentation

ConditionsMap marlin::LogicalExpressions::_condMap {}
protected

Definition at line 177 of file LogicalExpressions.h.

Referenced by addCondition(), and conditionIsTrue().

ResultMap marlin::LogicalExpressions::_resultMap {}
protected

Definition at line 178 of file LogicalExpressions.h.

Referenced by clear(), getValue(), and setValue().


The documentation for this class was generated from the following files: