ARB
Public Member Functions | Protected Member Functions | List of all members
TreeRoot Class Referenceabstract

#include <TreeNode.h>

Inheritance diagram for TreeRoot:
Inheritance graph
[legend]
Collaboration diagram for TreeRoot:
Collaboration graph
[legend]

Public Member Functions

 TreeRoot (bool deleteWithNodes_)
 
virtual ~TreeRoot ()
 
virtual void change_root (TreeNode *old, TreeNode *newroot)
 
void delete_by_node ()
 
bool has_bootstrap () const
 
void set_bootstrap_seen (bool seen)
 
virtual TreeNodemakeNode () const =0
 
virtual void destroyNode (TreeNode *node) const =0
 
 DEFINE_READ_ACCESSORS (TreeNode *, get_root_node, rootNode)
 
ARB_edge find_innermost_edge ()
 

Protected Member Functions

void predelete ()
 

Detailed Description

Definition at line 53 of file TreeNode.h.

Constructor & Destructor Documentation

TreeRoot::TreeRoot ( bool  deleteWithNodes_)
inlineexplicit

Create a TreeRoot for a TreeNode. Purpose:

  • act as TreeNode factory
  • place to store the current rootNode
  • place to store other tree related information by deriving from TreeRoot
Parameters
nodeMaker_heap-copy of a RootedTreeNodeFactory, will be deleted when this is destructed
deleteWithNodes_true -> delete TreeRoot when the rootNode gets destroyed (TreeRoot needs to be a heap-copy in that case)

Ressource handling of the tree structure is quite difficult (and error-prone). There are two common use-cases:

  1. TreeRoot is owned by some other object/scope
    • pass false for deleteWithNodes_
    • you may or may not destroy (parts of) the TreeNode manually
  2. TreeRoot is owned by the TreeNode
    • pass true for deleteWithNodes_
    • when the rootNode gets destroyed, the TreeRoot will be destroyed as well

Definition at line 67 of file TreeNode.h.

TreeRoot::~TreeRoot ( )
virtual

Definition at line 22 of file TreeNode.cxx.

References rt_assert.

Member Function Documentation

void TreeRoot::predelete ( )
inlineprotected

Definition at line 59 of file TreeNode.h.

References destroyNode(), and rt_assert.

Referenced by AP_tree_root::~AP_tree_root(), and FINAL_TYPE< SEQTYPE >::~ClusterTreeRoot().

void TreeRoot::change_root ( TreeNode old,
TreeNode newroot 
)
virtual
void TreeRoot::delete_by_node ( )
inline

Definition at line 94 of file TreeNode.h.

References rt_assert.

Referenced by GBT_read_tree_and_size(), TREE_load(), and TreeNode::~TreeNode().

bool TreeRoot::has_bootstrap ( ) const
inline

Definition at line 101 of file TreeNode.h.

Referenced by BootstrapConfig::update_empty_branch_behavior().

void TreeRoot::set_bootstrap_seen ( bool  seen)
inline

Definition at line 104 of file TreeNode.h.

Referenced by gbt_read_tree_rek(), and read_tree_and_size_internal().

virtual TreeNode* TreeRoot::makeNode ( ) const
pure virtual
virtual void TreeRoot::destroyNode ( TreeNode node) const
pure virtual
TreeRoot::DEFINE_READ_ACCESSORS ( TreeNode ,
get_root_node  ,
rootNode   
)
ARB_edge TreeRoot::find_innermost_edge ( )

Definition at line 395 of file TreeNode.cxx.

References EdgeFinder::innermost_edge().

Referenced by AWT_graphic_tree::handle_command().


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