ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::Logic Class Referenceabstract

Class to hold the logic structure representing a logical expression and evaluate it for a given state. More...

#include <Logic.h>

Inheritance diagram for TrigConf::Logic:
Collaboration diagram for TrigConf::Logic:

Public Types

enum  NodeType { LEAF , AND , OR }

Public Member Functions

 Logic ()=delete
virtual ~Logic ()=default
NodeType nodeType () const
void setNegate (bool negate=true)
bool negate () const
void setExpression (const std::string &)
const std::string & expression () const
virtual bool evaluate (const std::map< std::string, bool > &elementsState) const =0
virtual bool evaluate (const std::map< std::string, unsigned int > &elementsCount) const =0
virtual std::map< std::string, bool > elements () const =0
virtual std::map< std::string, unsigned int > elementsCount () const =0
void print (std::ostream &=std::cout) const
virtual void print (std::ostream &, size_t indSize, size_t indLevel) const =0

Protected Member Functions

 Logic (NodeType nodeType)

Private Attributes

NodeType m_nodeType { LEAF }
bool m_negate { false }
std::string m_expression { "" }

Detailed Description

Class to hold the logic structure representing a logical expression and evaluate it for a given state.

For more information see the

See also
LogicParser

Definition at line 31 of file Logic.h.

Member Enumeration Documentation

◆ NodeType

Enumerator
LEAF 
AND 
OR 

Definition at line 33 of file Logic.h.

Constructor & Destructor Documentation

◆ Logic() [1/2]

TrigConf::Logic::Logic ( )
delete

◆ ~Logic()

virtual TrigConf::Logic::~Logic ( )
virtualdefault

◆ Logic() [2/2]

TrigConf::Logic::Logic ( NodeType nodeType)
protected

Definition at line 12 of file Logic.cxx.

12 :
14{}
NodeType nodeType() const
Definition Logic.h:37
NodeType m_nodeType
Definition Logic.h:59

Member Function Documentation

◆ elements()

virtual std::map< std::string, bool > TrigConf::Logic::elements ( ) const
pure virtual

◆ elementsCount()

virtual std::map< std::string, unsigned int > TrigConf::Logic::elementsCount ( ) const
pure virtual

◆ evaluate() [1/2]

virtual bool TrigConf::Logic::evaluate ( const std::map< std::string, bool > & elementsState) const
pure virtual

◆ evaluate() [2/2]

virtual bool TrigConf::Logic::evaluate ( const std::map< std::string, unsigned int > & elementsCount) const
pure virtual

◆ expression()

const std::string & TrigConf::Logic::expression ( ) const

Definition at line 32 of file Logic.cxx.

32 {
33 return m_expression;
34}
std::string m_expression
Definition Logic.h:61

◆ negate()

bool TrigConf::Logic::negate ( ) const

Definition at line 22 of file Logic.cxx.

22 {
23 return m_negate;
24}
bool m_negate
Definition Logic.h:60

◆ nodeType()

NodeType TrigConf::Logic::nodeType ( ) const
inline

Definition at line 37 of file Logic.h.

37{ return m_nodeType; }

◆ print() [1/2]

virtual void TrigConf::Logic::print ( std::ostream & ,
size_t indSize,
size_t indLevel ) const
pure virtual

◆ print() [2/2]

void TrigConf::Logic::print ( std::ostream & o = std::cout) const

Definition at line 37 of file Logic.cxx.

37 {
38 if(m_expression.size()>0) {
39 o << m_expression << std::endl;
40 o << std::string(m_expression.size(), '-') << std::endl;
41 }
42 print(o, 4, 0);
43}
void print(std::ostream &=std::cout) const
Definition Logic.cxx:37

◆ setExpression()

void TrigConf::Logic::setExpression ( const std::string & expr)

Definition at line 27 of file Logic.cxx.

27 {
28 m_expression = expr;
29}

◆ setNegate()

void TrigConf::Logic::setNegate ( bool negate = true)

Definition at line 17 of file Logic.cxx.

17 {
19}
bool negate() const
Definition Logic.cxx:22

Member Data Documentation

◆ m_expression

std::string TrigConf::Logic::m_expression { "" }
private

Definition at line 61 of file Logic.h.

61{ "" };

◆ m_negate

bool TrigConf::Logic::m_negate { false }
private

Definition at line 60 of file Logic.h.

60{ false };

◆ m_nodeType

NodeType TrigConf::Logic::m_nodeType { LEAF }
private

Definition at line 59 of file Logic.h.

59{ LEAF };

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