ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
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.

33 { LEAF, AND, OR };

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 14 of file Logic.cxx.

14  :
16 {}

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 34 of file Logic.cxx.

34  {
35  return m_expression;
36 }

◆ negate()

bool TrigConf::Logic::negate ( ) const

Definition at line 24 of file Logic.cxx.

24  {
25  return m_negate;
26 }

◆ 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 39 of file Logic.cxx.

39  {
40  if(m_expression.size()>0) {
41  o << m_expression << std::endl;
42  o << std::string(m_expression.size(), '-') << std::endl;
43  }
44  print(o, 4, 0);
45 }

◆ setExpression()

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

Definition at line 29 of file Logic.cxx.

29  {
30  m_expression = expr;
31 }

◆ setNegate()

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

Definition at line 19 of file Logic.cxx.

19  {
20  m_negate = negate;
21 }

Member Data Documentation

◆ m_expression

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

Definition at line 61 of file Logic.h.

◆ m_negate

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

Definition at line 60 of file Logic.h.

◆ m_nodeType

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

Definition at line 59 of file Logic.h.


The documentation for this class was generated from the following files:
TrigConf::Logic::m_expression
std::string m_expression
Definition: Logic.h:61
TrigConf::Logic::LEAF
@ LEAF
Definition: Logic.h:33
TrigConf::Logic::negate
bool negate() const
Definition: Logic.cxx:24
TrigConf::Logic::AND
@ AND
Definition: Logic.h:33
TrigConf::Logic::m_nodeType
NodeType m_nodeType
Definition: Logic.h:59
TrigConf::Logic::OR
@ OR
Definition: Logic.h:33
TrigConf::Logic::print
void print(std::ostream &=std::cout) const
Definition: Logic.cxx:39
TrigConf::Logic::m_negate
bool m_negate
Definition: Logic.h:60
TrigConf::Logic::nodeType
NodeType nodeType() const
Definition: Logic.h:37