Belle II Software development
BinaryBooleanNode< AVariableManager > Class Template Reference

Nodeclass with two AbstractBooleanNode as children and a Boolean Operator (AND, OR) Check() method evaluates the child nodes and returns the result of the boolean operation. More...

#include <CutNodes.h>

Inheritance diagram for BinaryBooleanNode< 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 children nodes.
 
void print () const override
 Print node.
 
std::string decompile () const override
 Decompile Node back to a string.
 
 ~BinaryBooleanNode ()
 Destructor.
 

Private Types

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

Private Member Functions

 BinaryBooleanNode (Nodetuple left_node, Nodetuple right_node, BooleanOperator boperator)
 

Private Attributes

std::unique_ptr< const AbstractBooleanNode< AVariableManager > > m_left_bnode
 boolean subexpression of a cut
 
std::unique_ptr< const AbstractBooleanNode< AVariableManager > > m_right_bnode
 boolean subexpression of a cut
 
const BooleanOperator m_boperator
 Boolean operation to be applied to the check() results of the child nodes.
 

Friends

class NodeFactory
 

Detailed Description

template<class AVariableManager>
class Belle2::BinaryBooleanNode< AVariableManager >

Nodeclass with two AbstractBooleanNode as children and a Boolean Operator (AND, OR) Check() method evaluates the child nodes and returns the result of the boolean operation.

Definition at line 274 of file CutNodes.h.

Member Typedef Documentation

◆ Object

typedef AVariableManager::Object Object
private

Template argument dependent Particle type definition.

Definition at line 278 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

◆ ~BinaryBooleanNode()

~BinaryBooleanNode ( )
inline

Destructor.

Definition at line 327 of file CutNodes.h.

327{}

◆ BinaryBooleanNode()

BinaryBooleanNode ( Nodetuple  left_node,
Nodetuple  right_node,
BooleanOperator  boperator 
)
inlineexplicitprivate
Parameters
left_node(const boost::python::tuple&): tuple from which the left boolean child node is constructed
right_node(const boost::python::tuple&): tuple from which the right boolean child node is constructed
boperator(BooleanOperator): determines the boolean operation in check(const Object* p)

Definition at line 336 of file CutNodes.h.

337 : m_left_bnode{NodeFactory::compile_boolean_node<AVariableManager>(left_node)}, m_right_bnode{NodeFactory::compile_boolean_node<AVariableManager>(right_node)},
338 m_boperator{boperator}
339 {
340 }
std::unique_ptr< const AbstractBooleanNode< AVariableManager > > m_left_bnode
boolean subexpression of a cut
Definition: CutNodes.h:341
std::unique_ptr< const AbstractBooleanNode< AVariableManager > > m_right_bnode
boolean subexpression of a cut
Definition: CutNodes.h:342
const BooleanOperator m_boperator
Boolean operation to be applied to the check() results of the child nodes.
Definition: CutNodes.h:343

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 children nodes.

Boolean results are evaluated with the BooleanOperator(AND/OR) the node object.

Parameters
ppointer to the object, that should be checked.

Implements AbstractBooleanNode< AVariableManager >.

Definition at line 285 of file CutNodes.h.

286 {
287
288 switch (m_boperator) {
289 case BooleanOperator::AND:
290 return m_left_bnode->check(p) && m_right_bnode->check(p);
291 break;
292 case BooleanOperator::OR:
293 return m_left_bnode->check(p) || m_right_bnode->check(p);
294 break;
295 default:
296 throw std::runtime_error("BinaryBooleanNode has an invalid BooleanOperator");
297 }
298 return false;
299 }

◆ decompile()

std::string decompile ( ) const
inlineoverridevirtual

Decompile Node back to a string.

decompile(compile) should give the same result.

Implements AbstractBooleanNode< AVariableManager >.

Definition at line 315 of file CutNodes.h.

316 {
317 std::stringstream stringstream;
318 stringstream << m_left_bnode->decompile(); // decompile left AbstractBooleanNode
320 stringstream << m_right_bnode->decompile(); // decompile right AbstractBooleanNode
321
322 return stringstream.str();
323 }
void injectBooleanOperatorToStream(std::ostream &stream, const BooleanOperator &boperator)
Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members S...

◆ print()

void print ( ) const
inlineoverridevirtual

Print node.

Implements AbstractBooleanNode< AVariableManager >.

Definition at line 304 of file CutNodes.h.

305 {
306 m_left_bnode->print();
308 m_right_bnode->print();
309 }

Friends And Related Function Documentation

◆ NodeFactory

friend class NodeFactory
friend

Definition at line 330 of file CutNodes.h.

Member Data Documentation

◆ m_boperator

const BooleanOperator m_boperator
private

Boolean operation to be applied to the check() results of the child nodes.

Definition at line 343 of file CutNodes.h.

◆ m_left_bnode

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

boolean subexpression of a cut

Definition at line 341 of file CutNodes.h.

◆ m_right_bnode

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

boolean subexpression of a cut

Definition at line 342 of file CutNodes.h.


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