#include <genesis/tree/tree/edge_data.hpp>
Inherited by CommonEdgeData.
Base class for storing data on Edges of a Tree.
This class provides the start point for the class hierarchy of edge data classes. In order to correctly achieve polymorphic behaviour, and with its use case in a Tree in mind, this class and its derived classes are supposed to be used via unique pointers to their instances. Although this yields automatic memory management, it unfortunately disallows covariant return types.
The class thus provides a static create() function instead of a default constructor. This needs to be reimplemented in derived classes in order to allow creation of objects of the exact derived type. For similar reasons, instead of a copy constructor, it provides a clone() function.
Furthermore, the class provides a virtual recreate() function that default-constructs an object of the same derived type as it was called on. This is allows to create new data instances for a Tree without the need to know the exact derived type. For example, this can be used when adding new Edges to a Tree, in order to fill them with default-constructed data of the same type of some other Edges of the Tree.
It is recommended that derived classes follow the same access rules for its constructors. See CommonEdgeData for an example.
This class does not contain any data itself. See BaseNodeData for its "partner" class.
Definition at line 66 of file edge_data.hpp.
Public Member Functions | |
BaseEdgeData (BaseEdgeData &&)=delete | |
Deleted move constructor. More... | |
virtual | ~BaseEdgeData ()=default |
Virtual destructor. Needed for polymorphism. More... | |
virtual std::unique_ptr< BaseEdgeData > | clone () const |
Polymorphically copy an instance of this class. Use instead of copy constructor. More... | |
BaseEdgeData & | operator= (BaseEdgeData &&)=delete |
Deleted move assignment. More... | |
virtual std::unique_ptr< BaseEdgeData > | recreate () const |
Polymorphically create a default-constructed instance of this class with the same derived type as it was called on. More... | |
Static Public Member Functions | |
static std::unique_ptr< BaseEdgeData > | create () |
Create a new instance of this class. Use instead of default constructor. More... | |
Protected Member Functions | |
BaseEdgeData ()=default | |
Protected default constructor. Called from the create() function. More... | |
BaseEdgeData (BaseEdgeData const &)=default | |
Protected copy constructor. Called from the clone() function. More... | |
BaseEdgeData & | operator= (BaseEdgeData const &)=default |
Protected copy assignment. Not used right now. More... | |
|
virtualdefault |
Virtual destructor. Needed for polymorphism.
|
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.
|
protecteddefault |
Protected default constructor. Called from the create() function.
|
protecteddefault |
Protected copy constructor. Called from the clone() function.
|
inlinevirtual |
Polymorphically copy an instance of this class. Use instead of copy constructor.
Reimplemented in LayoutEdgeData, SimpleNewickEdgeData, AttributeTreeEdgeData, PlacementEdgeData, MassTreeEdgeData, and CommonEdgeData.
Definition at line 134 of file edge_data.hpp.
|
inlinestatic |
Create a new instance of this class. Use instead of default constructor.
Definition at line 117 of file edge_data.hpp.
|
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.
|
protecteddefault |
Protected copy assignment. Not used right now.
|
inlinevirtual |
Polymorphically create a default-constructed instance of this class with the same derived type as it was called on.
Reimplemented in LayoutEdgeData, SimpleNewickEdgeData, AttributeTreeEdgeData, PlacementEdgeData, MassTreeEdgeData, and CommonEdgeData.
Definition at line 126 of file edge_data.hpp.