A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TreeNode Class Reference

#include <genesis/tree/tree/node.hpp>

Detailed Description

Definition at line 56 of file node.hpp.

Public Member Functions

 TreeNode ()
 
 TreeNode (size_t index, TreeLink *primary_link)
 
 TreeNode (TreeNode const &)=delete
 
 TreeNode (TreeNode &&)=delete
 
 ~TreeNode ()=default
 
template<class NodeDataType >
NodeDataType & data ()
 
template<class NodeDataType >
NodeDataType const & data () const
 
template<class NodeDataType >
NodeDataType * data_cast ()
 
template<class NodeDataType >
NodeDataType const * data_cast () const
 
BaseNodeDatadata_ptr ()
 Return a pointer to the data. More...
 
BaseNodeData const * data_ptr () const
 Return a const pointer to the data. More...
 
bool has_data () const
 Return true if the TreeNode has a data object assigned to it. More...
 
size_t index () const
 Return the index of this Node. More...
 
TreeLinklink ()
 Return the TreeLink that points towards the root. More...
 
TreeLink const & link () const
 Return the TreeLink that points towards the root. More...
 
TreeNodeoperator= (TreeNode const &)=delete
 
TreeNodeoperator= (TreeNode &&)=delete
 
TreeLinkprimary_link ()
 Return the TreeLink that points towards the root. More...
 
TreeLink const & primary_link () const
 Return the TreeLink that points towards the root. More...
 
TreeNodereset_data (std::unique_ptr< BaseNodeData > data)
 Reset the data pointer of this TreeNode. More...
 
TreeNodereset_index (size_t val)
 Reset the internal index of this TreeNode. More...
 
TreeNodereset_primary_link (TreeLink *val)
 Reset the internal pointer to the TreeLink of this TreeNode. More...
 

Friends

class Tree
 

Constructor & Destructor Documentation

TreeNode ( )
inline

Definition at line 70 of file node.hpp.

TreeNode ( size_t  index,
TreeLink primary_link 
)
inline

Definition at line 76 of file node.hpp.

~TreeNode ( )
default
TreeNode ( TreeNode const &  )
delete
TreeNode ( TreeNode &&  )
delete

Member Function Documentation

NodeDataType& data ( )
inline

Definition at line 152 of file node.hpp.

NodeDataType const& data ( ) const
inline

Definition at line 158 of file node.hpp.

NodeDataType* data_cast ( )
inline

Definition at line 164 of file node.hpp.

NodeDataType const* data_cast ( ) const
inline

Definition at line 170 of file node.hpp.

BaseNodeData* data_ptr ( )
inline

Return a pointer to the data.

In most cases, using data<>() is more convenient. However, in some cases, this function might be necessary.

Definition at line 181 of file node.hpp.

BaseNodeData const* data_ptr ( ) const
inline

Return a const pointer to the data.

In most cases, using data<>() is more convenient. However, in some cases, this function might be necessary.

Definition at line 192 of file node.hpp.

bool has_data ( ) const
inline

Return true if the TreeNode has a data object assigned to it.

Definition at line 146 of file node.hpp.

size_t index ( ) const
inline

Return the index of this Node.

Definition at line 100 of file node.hpp.

TreeLink& link ( )
inline

Return the TreeLink that points towards the root.

This is just an alias for primary_link(), that is shorter to use when needed frequently in an algorithm.

Definition at line 127 of file node.hpp.

TreeLink const& link ( ) const
inline

Return the TreeLink that points towards the root.

This is just an alias for primary_link(), that is shorter to use when needed frequently in an algorithm.

Definition at line 138 of file node.hpp.

TreeNode& operator= ( TreeNode const &  )
delete
TreeNode& operator= ( TreeNode &&  )
delete
TreeLink& primary_link ( )
inline

Return the TreeLink that points towards the root.

Definition at line 108 of file node.hpp.

TreeLink const& primary_link ( ) const
inline

Return the TreeLink that points towards the root.

Definition at line 116 of file node.hpp.

TreeNode& reset_data ( std::unique_ptr< BaseNodeData data)
inline

Reset the data pointer of this TreeNode.

Using this function, a TreeNode can be assigend new data. It is also possible to change the data type completely (as long as it derives from BaseNodeData). Be however aware that many functions that work with trees expcet a certain data type. Thus, changing it might break those functions and lead to exceptions and other errors.

Definition at line 239 of file node.hpp.

TreeNode& reset_index ( size_t  val)
inline

Reset the internal index of this TreeNode.

This is a helper function that needs to be used with care and only in cases where appropriate. The index is an invariant that needs to be kept, as it needs to match the index in the Tree container.

This function exists to allow building and modifying a Tree without the need for many friend declarations. However, the function should rarely be needed outside of this context.

Definition at line 211 of file node.hpp.

TreeNode& reset_primary_link ( TreeLink val)
inline

Reset the internal pointer to the TreeLink of this TreeNode.

This is a helper function that needs to be used with care and only in cases where appropriate.

This function exists to allow building and modifying a Tree without the need for many friend declarations. However, the function should rarely be needed outside of this context.

Definition at line 225 of file node.hpp.

Friends And Related Function Documentation

friend class Tree
friend

Definition at line 64 of file node.hpp.


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