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

#include <genesis/taxonomy/taxon_data.hpp>

Inherited by EntropyTaxonData.

Detailed Description

Base class for storing data on Taxa of a Taxonomy.

This class provides the start point for the class hierarchy of taxon data classes. In order to correctly achieve polymorphic behaviour, and with its use case in a Taxonomy in mind, this class and its derived classes are only usable via unique pointers to their instances.

It thus provides a create() function instead of a default constructor. Stack copies of this class are useless; we always want a pointer to the class. For the same reason, instead of a copy constructor, it provides a clone() function.

It is recommended that derived classes follow the same access rules for its constructors.

Definition at line 56 of file taxon_data.hpp.

Public Member Functions

 BaseTaxonData (BaseTaxonData &&)=delete
 Deleted move constructor. More...
 
virtual ~BaseTaxonData ()=default
 Virtual destructor. Needed for polymorphism. More...
 
virtual std::unique_ptr< BaseTaxonDataclone () const
 Polymorphically copy an instance of this class. Use instead of copy constructor. More...
 
BaseTaxonDataoperator= (BaseTaxonData &&)=delete
 Deleted move assignment. More...
 

Static Public Member Functions

static std::unique_ptr< BaseTaxonDatacreate ()
 Create a new instance of this class. Use instead of default constructor. More...
 

Protected Member Functions

 BaseTaxonData ()=default
 Protected default constructor. Called from the create() function. More...
 
 BaseTaxonData (BaseTaxonData const &)=default
 Protected copy constructor. Called from the clone() function. More...
 
BaseTaxonDataoperator= (BaseTaxonData const &)=default
 Protected copy assignment. Not used right now. More...
 

Constructor & Destructor Documentation

◆ ~BaseTaxonData()

virtual ~BaseTaxonData ( )
virtualdefault

Virtual destructor. Needed for polymorphism.

◆ BaseTaxonData() [1/3]

BaseTaxonData ( BaseTaxonData &&  )
delete

Deleted move constructor.

Not viable with polymorphism. Also, we don't need it. The data is held by pointer (in order to allow polymorphism in the first place), so we can simply move the pointer instead.

◆ BaseTaxonData() [2/3]

BaseTaxonData ( )
protecteddefault

Protected default constructor. Called from the create() function.

◆ BaseTaxonData() [3/3]

BaseTaxonData ( BaseTaxonData const &  )
protecteddefault

Protected copy constructor. Called from the clone() function.

Member Function Documentation

◆ clone()

virtual std::unique_ptr< BaseTaxonData > clone ( ) const
inlinevirtual

Polymorphically copy an instance of this class. Use instead of copy constructor.

Reimplemented in EntropyTaxonData.

Definition at line 115 of file taxon_data.hpp.

◆ create()

static std::unique_ptr< BaseTaxonData > create ( )
inlinestatic

Create a new instance of this class. Use instead of default constructor.

Definition at line 107 of file taxon_data.hpp.

◆ operator=() [1/2]

BaseTaxonData& operator= ( BaseTaxonData &&  )
delete

Deleted move assignment.

Not viable with polymorphism. Also, we don't need it. The data is held by pointer (in order to allow polymorphism in the first place), so we can simply move the pointer instead.

◆ operator=() [2/2]

BaseTaxonData& operator= ( BaseTaxonData const &  )
protecteddefault

Protected copy assignment. Not used right now.


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