A library for working with phylogenetic and population genetic data.
v0.27.0
TreeEdge Class Reference

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

Detailed Description

Definition at line 60 of file edge.hpp.

Public Member Functions

 TreeEdge ()
 
 TreeEdge (size_t index, TreeLink *primary_link, TreeLink *secondary_link)
 
 TreeEdge (TreeEdge &&)=delete
 
 TreeEdge (TreeEdge const &)=delete
 
 ~TreeEdge ()=default
 
template<class EdgeDataType >
EdgeDataType & data ()
 
template<class EdgeDataType >
EdgeDataType const & data () const
 
template<class EdgeDataType >
EdgeDataType * data_cast ()
 
template<class EdgeDataType >
EdgeDataType const * data_cast () const
 
template<class EdgeDataType >
bool data_is (bool allow_null=false) const
 Return true iff the TreeEdge has a data object assigned to it that is of a particular given data type. More...
 
template<class EdgeDataType >
bool data_is_derived_from (bool allow_null=false) const
 Return true iff the TreeEdge has a data object assigned to it that is derived from a particular given data type. More...
 
BaseEdgeDatadata_ptr ()
 Return a pointer to the data. More...
 
BaseEdgeData const * data_ptr () const
 Return a const pointer to the data. More...
 
bool has_data () const
 Return true if the TreeEdge has a data object assigned to it. More...
 
size_t index () const
 Return the index of this Edge. More...
 
TreeEdgeoperator= (TreeEdge &&)=delete
 
TreeEdgeoperator= (TreeEdge const &)=delete
 
TreeLinkprimary_link ()
 Return the TreeLink of this TreeEdge that points towards the root. More...
 
TreeLink const & primary_link () const
 Return the TreeLink of this TreeEdge that points towards the root. More...
 
TreeNodeprimary_node ()
 Return the TreeNode of this TreeEdge that points towards the root. More...
 
TreeNode const & primary_node () const
 Return the TreeNode of this TreeEdge that points towards the root. More...
 
TreeEdgereset_data (std::unique_ptr< BaseEdgeData > data)
 Reset the data pointer of this TreeEdge. More...
 
TreeEdgereset_index (size_t val)
 Reset the internal index of this TreeEdge. More...
 
TreeEdgereset_primary_link (TreeLink *val)
 Reset the internal pointer to the primary TreeLink of this TreeEdge. More...
 
TreeEdgereset_secondary_link (TreeLink *val)
 Reset the internal pointer to the secondary TreeLink of this TreeEdge. More...
 
TreeLinksecondary_link ()
 Return the TreeLink of this TreeEdge that points away from the root. More...
 
TreeLink const & secondary_link () const
 Return the TreeLink of this TreeEdge that points away from the root. More...
 
TreeNodesecondary_node ()
 Return the TreeNode of this TreeEdge that points away from the root. More...
 
TreeNode const & secondary_node () const
 Return the TreeNode of this TreeEdge that points away from the root. More...
 

Friends

class Tree
 

Constructor & Destructor Documentation

◆ TreeEdge() [1/4]

TreeEdge ( )
inline

Definition at line 74 of file edge.hpp.

◆ TreeEdge() [2/4]

TreeEdge ( size_t  index,
TreeLink primary_link,
TreeLink secondary_link 
)
inline

Definition at line 81 of file edge.hpp.

◆ ~TreeEdge()

~TreeEdge ( )
default

◆ TreeEdge() [3/4]

TreeEdge ( TreeEdge const &  )
delete

◆ TreeEdge() [4/4]

TreeEdge ( TreeEdge &&  )
delete

Member Function Documentation

◆ data() [1/2]

EdgeDataType& data ( )
inline

Definition at line 217 of file edge.hpp.

◆ data() [2/2]

EdgeDataType const& data ( ) const
inline

Definition at line 223 of file edge.hpp.

◆ data_cast() [1/2]

EdgeDataType* data_cast ( )
inline

Definition at line 229 of file edge.hpp.

◆ data_cast() [2/2]

EdgeDataType const* data_cast ( ) const
inline

Definition at line 235 of file edge.hpp.

◆ data_is()

bool data_is ( bool  allow_null = false) const
inline

Return true iff the TreeEdge has a data object assigned to it that is of a particular given data type.

Definition at line 192 of file edge.hpp.

◆ data_is_derived_from()

bool data_is_derived_from ( bool  allow_null = false) const
inline

Return true iff the TreeEdge has a data object assigned to it that is derived from a particular given data type.

Definition at line 207 of file edge.hpp.

◆ data_ptr() [1/2]

BaseEdgeData* 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 246 of file edge.hpp.

◆ data_ptr() [2/2]

BaseEdgeData 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 257 of file edge.hpp.

◆ has_data()

bool has_data ( ) const
inline

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

Definition at line 182 of file edge.hpp.

◆ index()

size_t index ( ) const
inline

Return the index of this Edge.

Definition at line 106 of file edge.hpp.

◆ operator=() [1/2]

TreeEdge& operator= ( TreeEdge &&  )
delete

◆ operator=() [2/2]

TreeEdge& operator= ( TreeEdge const &  )
delete

◆ primary_link() [1/2]

TreeLink& primary_link ( )
inline

Return the TreeLink of this TreeEdge that points towards the root.

Definition at line 114 of file edge.hpp.

◆ primary_link() [2/2]

TreeLink const& primary_link ( ) const
inline

Return the TreeLink of this TreeEdge that points towards the root.

Definition at line 122 of file edge.hpp.

◆ primary_node() [1/2]

TreeNode& primary_node ( )
inline

Return the TreeNode of this TreeEdge that points towards the root.

Definition at line 146 of file edge.hpp.

◆ primary_node() [2/2]

TreeNode const& primary_node ( ) const
inline

Return the TreeNode of this TreeEdge that points towards the root.

Definition at line 154 of file edge.hpp.

◆ reset_data()

TreeEdge& reset_data ( std::unique_ptr< BaseEdgeData data)
inline

Reset the data pointer of this TreeEdge.

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

Definition at line 318 of file edge.hpp.

◆ reset_index()

TreeEdge& reset_index ( size_t  val)
inline

Reset the internal index of this TreeEdge.

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 276 of file edge.hpp.

◆ reset_primary_link()

TreeEdge& reset_primary_link ( TreeLink val)
inline

Reset the internal pointer to the primary TreeLink of this TreeEdge.

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 290 of file edge.hpp.

◆ reset_secondary_link()

TreeEdge& reset_secondary_link ( TreeLink val)
inline

Reset the internal pointer to the secondary TreeLink of this TreeEdge.

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 304 of file edge.hpp.

◆ secondary_link() [1/2]

TreeLink& secondary_link ( )
inline

Return the TreeLink of this TreeEdge that points away from the root.

Definition at line 130 of file edge.hpp.

◆ secondary_link() [2/2]

TreeLink const& secondary_link ( ) const
inline

Return the TreeLink of this TreeEdge that points away from the root.

Definition at line 138 of file edge.hpp.

◆ secondary_node() [1/2]

TreeNode& secondary_node ( )
inline

Return the TreeNode of this TreeEdge that points away from the root.

Definition at line 162 of file edge.hpp.

◆ secondary_node() [2/2]

TreeNode const& secondary_node ( ) const
inline

Return the TreeNode of this TreeEdge that points away from the root.

Definition at line 170 of file edge.hpp.

Friends And Related Function Documentation

◆ Tree

friend class Tree
friend

Definition at line 68 of file edge.hpp.


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