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

#include <genesis/placement/sample_set.hpp>

Detailed Description

Store a set of Samples with associated names.

The elements in this set are stored as a NamedSample. They are stored in the sequence in which they are added to the set, and can be accessed via an index.

Definition at line 52 of file sample_set.hpp.

Public Member Functions

 SampleSet ()=default
 
 SampleSet (SampleSet const &)=default
 
 SampleSet (SampleSet &&)=default
 
 ~SampleSet ()=default
 
void add (Sample const &smp)
 Add a Sample to the SampleSet. More...
 
void add (Sample const &smp, std::string const &name)
 Add a Sample with a name to the SampleSet. More...
 
void add (Sample &&smp)
 Add a Sample to the SampleSet. More...
 
void add (Sample &&smp, std::string const &name)
 Add a Sample with a name to the SampleSet. More...
 
NamedSampleat (size_t index)
 Get the NamedSample at a certain index position. More...
 
const NamedSampleat (size_t index) const
 Get the NamedSample at a certain index position. More...
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 Delete all Samples in this SampleSet. More...
 
bool empty () const
 Return whether the SampleSet is empty. More...
 
iterator end ()
 
const_iterator end () const
 
SampleSetoperator= (SampleSet const &)=default
 
SampleSetoperator= (SampleSet &&)=default
 
NamedSampleoperator[] (size_t index)
 Get the NamedSample at a certain index position. More...
 
const NamedSampleoperator[] (size_t index) const
 Get the NamedSample at a certain index position. More...
 
void remove_at (size_t index)
 Remove the Sample at a certain index position. More...
 
size_t size () const
 Return the size of the SampleSet, i.e., the number of Samples. More...
 
void swap (SampleSet &other)
 

Public Types

typedef std::vector
< NamedSample >
::const_iterator 
const_iterator
 
typedef std::vector
< NamedSample >::iterator 
iterator
 

Classes

struct  NamedSample
 Store a Sample together with a name for it. More...
 

Constructor & Destructor Documentation

SampleSet ( )
default
~SampleSet ( )
default
SampleSet ( SampleSet const &  )
default
SampleSet ( SampleSet &&  )
default

Member Function Documentation

void add ( Sample const &  smp)

Add a Sample to the SampleSet.

The Sample is copied. The name is set to empty string.

Definition at line 56 of file sample_set.cpp.

void add ( Sample const &  smp,
std::string const &  name 
)

Add a Sample with a name to the SampleSet.

The Sample is copied.

Definition at line 61 of file sample_set.cpp.

void add ( Sample &&  smp)

Add a Sample to the SampleSet.

The Sample is moved. The name is set to empty string.

Definition at line 66 of file sample_set.cpp.

void add ( Sample &&  smp,
std::string const &  name 
)

Add a Sample with a name to the SampleSet.

The Sample is moved.

Definition at line 71 of file sample_set.cpp.

SampleSet::NamedSample & at ( size_t  index)

Get the NamedSample at a certain index position.

Definition at line 110 of file sample_set.cpp.

SampleSet::NamedSample const & at ( size_t  index) const

Get the NamedSample at a certain index position.

Definition at line 114 of file sample_set.cpp.

Definition at line 90 of file sample_set.cpp.

SampleSet::const_iterator begin ( ) const

Definition at line 100 of file sample_set.cpp.

void clear ( )

Delete all Samples in this SampleSet.

Definition at line 81 of file sample_set.cpp.

bool empty ( ) const

Return whether the SampleSet is empty.

Definition at line 130 of file sample_set.cpp.

Definition at line 95 of file sample_set.cpp.

Definition at line 105 of file sample_set.cpp.

SampleSet& operator= ( SampleSet const &  )
default
SampleSet& operator= ( SampleSet &&  )
default
SampleSet::NamedSample & operator[] ( size_t  index)

Get the NamedSample at a certain index position.

Definition at line 119 of file sample_set.cpp.

SampleSet::NamedSample const & operator[] ( size_t  index) const

Get the NamedSample at a certain index position.

Definition at line 124 of file sample_set.cpp.

void remove_at ( size_t  index)

Remove the Sample at a certain index position.

As this function moves Samples in the container around, all iterators and pointers to the elements of this SampleSet are considered to be invalidated.

Definition at line 76 of file sample_set.cpp.

size_t size ( ) const

Return the size of the SampleSet, i.e., the number of Samples.

Definition at line 135 of file sample_set.cpp.

void swap ( SampleSet other)

Definition at line 46 of file sample_set.cpp.

Member Typedef Documentation

typedef std::vector<NamedSample>::const_iterator const_iterator

Definition at line 70 of file sample_set.hpp.

typedef std::vector<NamedSample>::iterator iterator

Definition at line 69 of file sample_set.hpp.


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