herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
exsample::binary_tree< Value > Class Template Reference

binary_tree represents a binary tree with the ability to `cascade' visitor objects down the tree More...

#include <binary_tree.h>

Inheritance diagram for exsample::binary_tree< Value >:

Classes

class  const_iterator
 const_iterator More...
 
struct  istream_generator
 generator reading binary tree from istream More...
 
class  iterator
 iterator More...
 
struct  ostream_visitor
 forward visitor writing out the tree to given ostream More...
 

Public Types

type definitions
typedef Value value_type
 define the object type
 

Public Member Functions

bool empty () const
 return true, if this node is empty
 
void clear ()
 clear this node
 
std::pair< iterator, iteratorsplit (std::pair< value_type, value_type > children)
 split this node
 
template<class Selector >
iterator select (const Selector &selector)
 select using a selector
 
template<class Selector , unsigned long bits>
void subtree_hash (const Selector &selector, bit_container< bits > &bhash)
 generate a hash value for the sub-tree selected by the given selector object
 
template<class Accessor , class BinaryOp >
BinaryOp::result_type accumulate (const Accessor &acc, BinaryOp binary_op) const
 accumulate values using a binary function and accessor object
 
template<class Selector , class Accessor , class BinaryOp >
BinaryOp::result_type accumulate (const Selector &selector, const Accessor &acc, BinaryOp binary_op) const
 accumulate values only from branches matching a Selector
 
template<class Accessor , class BinaryOp >
BinaryOp::result_type tree_accumulate (const Accessor &acc, BinaryOp binary_op)
 accumulate values using a binary function and accessor object, storing intermediate values in nodes
 
template<class Selector , class Accessor , class BinaryOp >
BinaryOp::result_type tree_accumulate (const Selector &selector, const Accessor &acc, BinaryOp binary_op)
 accumulate values only from branches matching a Selector
 
template<class Visitor >
void cascade (Visitor visitor) const
 forward propagate a visitor to all children nodes
 
template<class Generator >
void generate (Generator generator)
 succesively split using a generator
 
constructors
 binary_tree ()
 default constructor
 
 binary_tree (const value_type &thevalue, binary_tree *theparent=0)
 construct giving key/cell and parent
 
 binary_tree (const binary_tree &x)
 binary_tree has a strict ownership; on copying binary trees ownership is transferred
 
binary_treeoperator= (const binary_tree &x)
 binary_tree has a strict ownership; on copying binary trees ownership is transferred
 
Public member access
value_typevalue ()
 return the value held by this node
 
const value_typevalue () const
 return the value held by this node
 
bool root () const
 return true, if this is the root node
 
bool leaf () const
 return true, if this node has got children
 
put and get from streams
template<class OStream >
void put (OStream &os) const
 put to ostream
 
template<class IStream >
void get (IStream &is)
 get from istream
 

Private Member Functions

template<class Selector , unsigned long bits>
void do_subtree_hash (const Selector &selector, bit_container< bits > &current, unsigned long &position, bool selected=true) const
 calculate hash value
 
private member access
binary_treeparent ()
 return the parent of this node
 
const binary_treeparent () const
 return the parent of this node
 
binary_treeleft_child ()
 return the left child of this node
 
const binary_treeleft_child () const
 return the left child of this node
 
binary_treeright_child ()
 return the right child of this node
 
const binary_treeright_child () const
 return the right child of this node
 

Private Attributes

binary_treeparent_
 the parent of this node
 
std::unique_ptr< value_typevalue_
 the cell held by this node
 
std::pair< std::unique_ptr< binary_tree >, std::unique_ptr< binary_tree > > children_
 the children of this node
 

standard-conforming leaf iterators

std::pair< binary_tree *, binary_tree * > neighbours_
 the left and right neighbours of this node
 
iterator begin ()
 return begin iterator
 
iterator end ()
 return end iterator
 
iterator global_begin ()
 return global begin iterator
 
iterator global_end ()
 return global end iterator
 
const_iterator begin () const
 return begin const_iterator
 
const_iterator end () const
 return end const_iterator
 
const_iterator global_begin () const
 return global begin iterator
 
const_iterator global_end () const
 return global end iterator
 
void left_neighbour (binary_tree *n)
 set the left neighbour
 
void right_neighbour (binary_tree *n)
 set the right neighbour
 
binary_treeleft_neighbour () const
 get the left neighbour
 
binary_treeright_neighbour () const
 get the right neighbour
 
binary_treeleft_most ()
 return the left-most leaf
 
binary_treeright_most ()
 return the right-most leaf
 
const binary_treeleft_most () const
 return the left-most leaf
 
const binary_treeright_most () const
 return the right-most leaf
 

Detailed Description

template<class Value>
class exsample::binary_tree< Value >

binary_tree represents a binary tree with the ability to `cascade' visitor objects down the tree

Definition at line 21 of file binary_tree.h.


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