Belle II Software development
UnaryBooleanNode< AVariableManager > Class Template Reference

Nodeclass with a single AbstractBooleanNode as child. More...

#include <CutNodes.h>

Inheritance diagram for UnaryBooleanNode< AVariableManager >:
AbstractBooleanNode< AVariableManager >

Public Types

typedef AVariableManager::Var Var
 Template argument dependent Variable type definition.
 

Public Member Functions

bool check (const Object *p) const override
 Check if Object passes this subexpression of the cut by calling check on the child node.
 
void print () const override
 Print node brackets and negation keywords are added if m_bracketized, m_negation are set to true.
 
std::string decompile () const override
 Decompile Node back to a string.
 
 ~UnaryBooleanNode ()
 Destructor.
 

Private Types

typedef AVariableManager::Object Object
 Template argument dependent Particle type definition.
 

Private Member Functions

 UnaryBooleanNode (Nodetuple node, bool negation, bool bracketized)
 

Private Attributes

std::unique_ptr< const AbstractBooleanNode< AVariableManager > > m_bnode
 boolean subexpression of a cut
 
const bool m_negation
 if the evaluation of m_bnode->check(p) should be negated in check()
 
const bool m_bracketized
 if the boolean expression from which this node is compiled was in brackets, relevant in decompile to yield the original string
 

Friends

class NodeFactory
 

Detailed Description

template<class AVariableManager>
class Belle2::UnaryBooleanNode< AVariableManager >

Nodeclass with a single AbstractBooleanNode as child.

Class for constructing Node objects of boost::python::tuple NodeFactory is a friend to all Node classes, in order to use their private Constructor.

check() returns the negated result of the child node if m_negation is true.

Definition at line 198 of file CutNodes.h.

Member Typedef Documentation

◆ Object

typedef AVariableManager::Object Object
private

Template argument dependent Particle type definition.

Definition at line 202 of file CutNodes.h.

◆ Var

typedef AVariableManager::Var Var
inherited

Template argument dependent Variable type definition.

Definition at line 39 of file AbstractNodes.h.

Constructor & Destructor Documentation

◆ ~UnaryBooleanNode()

~UnaryBooleanNode ( )
inline

Destructor.

Definition at line 246 of file CutNodes.h.

246{}

◆ UnaryBooleanNode()

UnaryBooleanNode ( Nodetuple  node,
bool  negation,
bool  bracketized 
)
inlineexplicitprivate
Parameters
node(const boost::python::tuple&) tuple containing a boolean node
negation(bool): flag if check output of m_bnode should be returned negated
bracketized(bool): flag if cut substring was in brackets, used for preserving brackets when decompling to a string.

Definition at line 255 of file CutNodes.h.

256 : m_bnode{NodeFactory::compile_boolean_node<AVariableManager>(node)}, m_negation{negation}, m_bracketized{bracketized}
257 {
258 }
const bool m_bracketized
if the boolean expression from which this node is compiled was in brackets, relevant in decompile to ...
Definition: CutNodes.h:263
const bool m_negation
if the evaluation of m_bnode->check(p) should be negated in check()
Definition: CutNodes.h:261
std::unique_ptr< const AbstractBooleanNode< AVariableManager > > m_bnode
boolean subexpression of a cut
Definition: CutNodes.h:260

Member Function Documentation

◆ check()

bool check ( const Object p) const
inlineoverridevirtual

Check if Object passes this subexpression of the cut by calling check on the child node.

Parameters
ppointer to the object, that should be checked.

Implements AbstractBooleanNode< AVariableManager >.

Definition at line 208 of file CutNodes.h.

209 {
210 // Return negated result of child node evaluation if m_negation is true.
211 if (m_negation) return !m_bnode->check(p);
212
213 return m_bnode->check(p);
214 }

◆ decompile()

std::string decompile ( ) const
inlineoverridevirtual

Decompile Node back to a string.

Decompile(compile) should give the same result. brackets and negation keywords are added if m_bracketized, m_negation are set to true.

Implements AbstractBooleanNode< AVariableManager >.

Definition at line 232 of file CutNodes.h.

233 {
234 std::stringstream stringstream;
235 if (m_negation) stringstream << "not "; // Add negation keyword
236
237 if (m_bracketized) stringstream << "["; // Add opening bracket
238 stringstream << m_bnode->decompile();
239 if (m_bracketized) stringstream << "]"; // Add closing bracket
240
241 return stringstream.str();
242 }

◆ print()

void print ( ) const
inlineoverridevirtual

Print node brackets and negation keywords are added if m_bracketized, m_negation are set to true.

Implements AbstractBooleanNode< AVariableManager >.

Definition at line 220 of file CutNodes.h.

221 {
222 if (m_negation) std::cout << "not ";
223 if (m_bracketized) std::cout << "[";
224 m_bnode->print();
225 if (m_bracketized) std::cout << "]";
226 }

Friends And Related Function Documentation

◆ NodeFactory

friend class NodeFactory
friend

Definition at line 249 of file CutNodes.h.

Member Data Documentation

◆ m_bnode

std::unique_ptr<const AbstractBooleanNode<AVariableManager> > m_bnode
private

boolean subexpression of a cut

Definition at line 260 of file CutNodes.h.

◆ m_bracketized

const bool m_bracketized
private

if the boolean expression from which this node is compiled was in brackets, relevant in decompile to yield the original string

Definition at line 263 of file CutNodes.h.

◆ m_negation

const bool m_negation
private

if the evaluation of m_bnode->check(p) should be negated in check()

Definition at line 261 of file CutNodes.h.


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