herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
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

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
 

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

private member access

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

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

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.

Member Typedef Documentation

◆ value_type

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

define the object type

Definition at line 29 of file binary_tree.h.

Constructor & Destructor Documentation

◆ binary_tree() [1/3]

template<class Value >
exsample::binary_tree< Value >::binary_tree ( )
inline

default constructor

Definition at line 39 of file binary_tree.h.

Referenced by exsample::binary_tree< Value >::split().

◆ binary_tree() [2/3]

template<class Value >
exsample::binary_tree< Value >::binary_tree ( const value_type thevalue,
binary_tree< Value > *  theparent = 0 
)
inline

construct giving key/cell and parent

Definition at line 46 of file binary_tree.h.

◆ binary_tree() [3/3]

template<class Value >
exsample::binary_tree< Value >::binary_tree ( const binary_tree< Value > &  x)
inline

Member Function Documentation

◆ accumulate() [1/2]

template<class Value >
template<class Accessor , class BinaryOp >
BinaryOp::result_type exsample::binary_tree< Value >::accumulate ( const Accessor &  acc,
BinaryOp  binary_op 
) const
inline

◆ accumulate() [2/2]

template<class Value >
template<class Selector , class Accessor , class BinaryOp >
BinaryOp::result_type exsample::binary_tree< Value >::accumulate ( const Selector &  selector,
const Accessor &  acc,
BinaryOp  binary_op 
) const
inline

◆ begin() [1/2]

template<class Value >
iterator exsample::binary_tree< Value >::begin ( )
inline

return begin iterator

Definition at line 225 of file binary_tree.h.

References exsample::binary_tree< Value >::left_most().

◆ begin() [2/2]

template<class Value >
const_iterator exsample::binary_tree< Value >::begin ( ) const
inline

return begin const_iterator

Definition at line 371 of file binary_tree.h.

References exsample::binary_tree< Value >::left_most().

◆ cascade()

template<class Value >
template<class Visitor >
void exsample::binary_tree< Value >::cascade ( Visitor  visitor) const
inline

◆ clear()

◆ do_subtree_hash()

template<class Value >
template<class Selector , unsigned long bits>
void exsample::binary_tree< Value >::do_subtree_hash ( const Selector &  selector,
bit_container< bits > &  current,
unsigned long &  position,
bool  selected = true 
) const
inlineprivate

◆ empty()

template<class Value >
bool exsample::binary_tree< Value >::empty ( ) const
inline

◆ end() [1/2]

template<class Value >
iterator exsample::binary_tree< Value >::end ( )
inline

return end iterator

Definition at line 228 of file binary_tree.h.

References exsample::binary_tree< Value >::right_most().

◆ end() [2/2]

template<class Value >
const_iterator exsample::binary_tree< Value >::end ( ) const
inline

return end const_iterator

Definition at line 374 of file binary_tree.h.

References exsample::binary_tree< Value >::right_most().

◆ generate()

◆ get()

template<class Value >
template<class IStream >
void exsample::binary_tree< Value >::get ( IStream &  is)
inline

◆ global_begin() [1/2]

◆ global_begin() [2/2]

template<class Value >
const_iterator exsample::binary_tree< Value >::global_begin ( ) const
inline

◆ global_end() [1/2]

◆ global_end() [2/2]

◆ leaf()

◆ left_child() [1/2]

◆ left_child() [2/2]

template<class Value >
const binary_tree & exsample::binary_tree< Value >::left_child ( ) const
inlineprivate

return the left child of this node

Definition at line 851 of file binary_tree.h.

References exsample::binary_tree< Value >::children_.

◆ left_most() [1/2]

◆ left_most() [2/2]

template<class Value >
const binary_tree * exsample::binary_tree< Value >::left_most ( ) const
inlineprivate

◆ left_neighbour() [1/2]

template<class Value >
binary_tree * exsample::binary_tree< Value >::left_neighbour ( ) const
inlineprivate

get the left neighbour

Definition at line 399 of file binary_tree.h.

References exsample::binary_tree< Value >::neighbours_.

◆ left_neighbour() [2/2]

template<class Value >
void exsample::binary_tree< Value >::left_neighbour ( binary_tree< Value > *  n)
inlineprivate

◆ operator=()

template<class Value >
binary_tree & exsample::binary_tree< Value >::operator= ( const binary_tree< Value > &  x)
inline

◆ parent() [1/2]

◆ parent() [2/2]

template<class Value >
const binary_tree & exsample::binary_tree< Value >::parent ( ) const
inlineprivate

return the parent of this node

Definition at line 845 of file binary_tree.h.

References exsample::binary_tree< Value >::parent_.

◆ put()

◆ right_child() [1/2]

◆ right_child() [2/2]

template<class Value >
const binary_tree & exsample::binary_tree< Value >::right_child ( ) const
inlineprivate

return the right child of this node

Definition at line 857 of file binary_tree.h.

References exsample::binary_tree< Value >::children_.

◆ right_most() [1/2]

◆ right_most() [2/2]

template<class Value >
const binary_tree * exsample::binary_tree< Value >::right_most ( ) const
inlineprivate

◆ right_neighbour() [1/2]

template<class Value >
binary_tree * exsample::binary_tree< Value >::right_neighbour ( ) const
inlineprivate

get the right neighbour

Definition at line 402 of file binary_tree.h.

References exsample::binary_tree< Value >::neighbours_.

◆ right_neighbour() [2/2]

template<class Value >
void exsample::binary_tree< Value >::right_neighbour ( binary_tree< Value > *  n)
inlineprivate

◆ root()

◆ select()

◆ split()

◆ subtree_hash()

template<class Value >
template<class Selector , unsigned long bits>
void exsample::binary_tree< Value >::subtree_hash ( const Selector &  selector,
bit_container< bits > &  bhash 
)
inline

generate a hash value for the sub-tree selected by the given selector object

Definition at line 516 of file binary_tree.h.

◆ tree_accumulate() [1/2]

template<class Value >
template<class Accessor , class BinaryOp >
BinaryOp::result_type exsample::binary_tree< Value >::tree_accumulate ( const Accessor &  acc,
BinaryOp  binary_op 
)
inline

◆ tree_accumulate() [2/2]

template<class Value >
template<class Selector , class Accessor , class BinaryOp >
BinaryOp::result_type exsample::binary_tree< Value >::tree_accumulate ( const Selector &  selector,
const Accessor &  acc,
BinaryOp  binary_op 
)
inline

◆ value() [1/2]

◆ value() [2/2]

template<class Value >
const value_type & exsample::binary_tree< Value >::value ( ) const
inline

return the value held by this node

Definition at line 641 of file binary_tree.h.

References exsample::binary_tree< Value >::value_.

Member Data Documentation

◆ children_

◆ neighbours_

◆ parent_

◆ value_


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