ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
TrigConf::LogicOPS Class Referenceabstract

#include <Logic.h>

Inheritance diagram for TrigConf::LogicOPS:
Collaboration diagram for TrigConf::LogicOPS:

Public Types

enum  NodeType { LEAF, AND, OR }
 

Public Member Functions

 LogicOPS (NodeType nodeType)
 
 LogicOPS (NodeType nodeType, std::unique_ptr< Logic > &&left)
 
virtual ~LogicOPS () override=default
 
void addSubLogic (std::unique_ptr< Logic > &&right)
 
const std::vector< std::unique_ptr< Logic > > & subLogics () const
 
std::vector< std::unique_ptr< Logic > > takeSubLogics ()
 
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
 

Private Member Functions

virtual void print (std::ostream &, size_t indSize, size_t indLevel) const override
 

Private Attributes

std::vector< std::unique_ptr< Logic > > m_subs
 
NodeType m_nodeType { LEAF }
 
bool m_negate { false }
 
std::string m_expression { "" }
 

Detailed Description

Definition at line 87 of file Logic.h.

Member Enumeration Documentation

◆ NodeType

enum TrigConf::Logic::NodeType
inherited
Enumerator
LEAF 
AND 
OR 

Definition at line 33 of file Logic.h.

33 { LEAF, AND, OR };

Constructor & Destructor Documentation

◆ LogicOPS() [1/2]

TrigConf::LogicOPS::LogicOPS ( NodeType  nodeType)

Definition at line 105 of file Logic.cxx.

105  :
106  Logic(nodeType)
107 {}

◆ LogicOPS() [2/2]

TrigConf::LogicOPS::LogicOPS ( NodeType  nodeType,
std::unique_ptr< Logic > &&  left 
)

Definition at line 109 of file Logic.cxx.

109  :
110  Logic(nodeType)
111 {
112  m_subs.push_back(std::move(left));
113 }

◆ ~LogicOPS()

virtual TrigConf::LogicOPS::~LogicOPS ( )
overridevirtualdefault

Member Function Documentation

◆ addSubLogic()

void TrigConf::LogicOPS::addSubLogic ( std::unique_ptr< Logic > &&  right)

Definition at line 116 of file Logic.cxx.

117 {
118  m_subs.push_back(std::move(right));
119 }

◆ elements()

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

◆ elementsCount()

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

◆ evaluate() [1/2]

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

◆ evaluate() [2/2]

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

◆ expression()

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

Definition at line 34 of file Logic.cxx.

34  {
35  return m_expression;
36 }

◆ negate()

bool TrigConf::Logic::negate ( ) const
inherited

Definition at line 24 of file Logic.cxx.

24  {
25  return m_negate;
26 }

◆ nodeType()

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

Definition at line 37 of file Logic.h.

37 { return m_nodeType; }

◆ print() [1/2]

void TrigConf::LogicOPS::print ( std::ostream &  o,
size_t  indSize,
size_t  indLevel 
) const
overrideprivatevirtual

Implements TrigConf::Logic.

Definition at line 134 of file Logic.cxx.

134  {
135  o << std::string(indSize*indLevel, ' ');
136  if( negate() ) { o << "NOT "; }
137  o << (nodeType()==Logic::AND ? "AND (" : "OR (") << std::endl;
138  for( auto & subLogic : m_subs ) {
139  subLogic->print(o,indSize, indLevel+1);
140  }
141  o << std::string(indSize*indLevel, ' ') << ")" << std::endl;
142 }

◆ print() [2/2]

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

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)
inherited

Definition at line 29 of file Logic.cxx.

29  {
30  m_expression = expr;
31 }

◆ setNegate()

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

Definition at line 19 of file Logic.cxx.

19  {
20  m_negate = negate;
21 }

◆ subLogics()

const std::vector< std::unique_ptr< TrigConf::Logic > > & TrigConf::LogicOPS::subLogics ( ) const

Definition at line 122 of file Logic.cxx.

122  {
123  return m_subs;
124 }

◆ takeSubLogics()

std::vector< std::unique_ptr< TrigConf::Logic > > TrigConf::LogicOPS::takeSubLogics ( )

Definition at line 127 of file Logic.cxx.

127  {
128  auto tmp = std::move(m_subs);
129  m_subs.clear();
130  return tmp;
131 }

Member Data Documentation

◆ m_expression

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

Definition at line 61 of file Logic.h.

◆ m_negate

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

Definition at line 60 of file Logic.h.

◆ m_nodeType

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

Definition at line 59 of file Logic.h.

◆ m_subs

std::vector<std::unique_ptr<Logic> > TrigConf::LogicOPS::m_subs
private

Definition at line 97 of file Logic.h.


The documentation for this class was generated from the following files:
TrigConf::LogicOPS::m_subs
std::vector< std::unique_ptr< Logic > > m_subs
Definition: Logic.h:97
TrigConf::Logic::m_expression
std::string m_expression
Definition: Logic.h:61
TrigConf::Logic::LEAF
@ LEAF
Definition: Logic.h:33
TrigConf::Logic::Logic
Logic()=delete
TrigConf::Logic::negate
bool negate() const
Definition: Logic.cxx:24
TrigConf::Logic::AND
@ AND
Definition: Logic.h:33
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
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