|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_TREE_EDGE_H_
2 #define GENESIS_TREE_TREE_EDGE_H_
148 return link_p_->
node();
156 return link_p_->
node();
164 return link_s_->
node();
172 return link_s_->
node();
184 return data_.get() !=
nullptr;
191 template<
class EdgeDataType >
194 if( data_.get() ==
nullptr ) {
197 assert( data_.get() );
198 auto const& ref = *data_.get();
199 return (
typeid( ref ) ==
typeid( EdgeDataType ));
206 template<
class EdgeDataType >
209 if( data_.get() ==
nullptr ) {
212 assert( data_.get() );
213 return (
dynamic_cast< EdgeDataType const*
>( data_.get() ) !=
nullptr );
216 template<
class EdgeDataType >
219 return dynamic_cast< EdgeDataType&
>( *data_ );
222 template<
class EdgeDataType >
223 EdgeDataType
const&
data()
const
225 return dynamic_cast< EdgeDataType const&
>( *data_ );
228 template<
class EdgeDataType >
231 return dynamic_cast< EdgeDataType*
>( data_.get() );
234 template<
class EdgeDataType >
237 return dynamic_cast< EdgeDataType const*
>( data_.get() );
320 data_ = std::move(
data );
335 std::unique_ptr< BaseEdgeData > data_;
341 #endif // include guard
TreeLink & primary_link()
Return the TreeLink of this TreeEdge that points towards the root.
EdgeDataType * data_cast()
bool has_data() const
Return true if the TreeEdge has a data object assigned to it.
TreeNode const & secondary_node() const
Return the TreeNode of this TreeEdge that points away from the root.
TreeNode const & primary_node() const
Return the TreeNode of this TreeEdge that points towards the root.
TreeNode & node()
Return the TreeNode of this TreeLink.
size_t index() const
Return the index of this Edge.
Base class for storing data on Edges of a Tree.
TreeEdge & reset_data(std::unique_ptr< BaseEdgeData > data)
Reset the data pointer of this TreeEdge.
Provides some valuable additions to STD.
TreeLink const & primary_link() const
Return the TreeLink of this TreeEdge that points towards the root.
TreeEdge & operator=(TreeEdge const &)=delete
TreeNode & secondary_node()
Return the TreeNode of this TreeEdge that points away from the root.
Class for representing phylogenetic trees.
BaseEdgeData const * data_ptr() const
Return a const pointer to the data.
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...
TreeEdge & reset_primary_link(TreeLink *val)
Reset the internal pointer to the primary TreeLink of this TreeEdge.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
TreeEdge & reset_index(size_t val)
Reset the internal index of this TreeEdge.
TreeLink const & secondary_link() const
Return the TreeLink of this TreeEdge that points away from the root.
TreeNode & primary_node()
Return the TreeNode of this TreeEdge that points towards the root.
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...
BaseEdgeData * data_ptr()
Return a pointer to the data.
EdgeDataType const & data() const
EdgeDataType const * data_cast() const
TreeEdge & reset_secondary_link(TreeLink *val)
Reset the internal pointer to the secondary TreeLink of this TreeEdge.
TreeEdge(size_t index, TreeLink *primary_link, TreeLink *secondary_link)
TreeLink & secondary_link()
Return the TreeLink of this TreeEdge that points away from the root.