A library for working with phylogenetic and population genetic data.
v0.32.0
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 in the sequence in which they are added to the set, and can be accessed via an index.

Definition at line 54 of file sample_set.hpp.

Public Member Functions

 SampleSet ()=default
 
 SampleSet (SampleSet &&)=default
 
 SampleSet (SampleSet const &)=default
 
 ~SampleSet ()=default
 
void add (Sample &&smp, std::string const &name="")
 Add a Sample with a name to the SampleSet. More...
 
void add (Sample const &smp, std::string const &name="")
 Add a Sample with a name to the SampleSet. More...
 
Sampleat (size_t index)
 
Sample const & at (size_t index) const
 
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
 
std::string const & name_at (size_t index) const
 
std::vector< std::string > const & names () const
 
 operator std::vector< Sample > const & () const
 Implicit conversion, so that a SampleSet can be used in functions that expect a std::vector instead. More...
 
SampleSetoperator= (SampleSet &&)=default
 
SampleSetoperator= (SampleSet const &)=default
 
Sampleoperator[] (size_t index)
 
Sample const & operator[] (size_t index) const
 
void remove_at (size_t index)
 Remove the Sample at a certain index position. More...
 
std::vector< Sample > const & samples () const
 
size_t size () const
 Return the size of the SampleSet, i.e., the number of Samples. More...
 
void swap (SampleSet &other)
 

Public Types

using const_iterator = typename std::vector< Sample >::const_iterator
 
using iterator = typename std::vector< Sample >::iterator
 

Constructor & Destructor Documentation

◆ SampleSet() [1/3]

SampleSet ( )
default

◆ ~SampleSet()

~SampleSet ( )
default

◆ SampleSet() [2/3]

SampleSet ( SampleSet const &  )
default

◆ SampleSet() [3/3]

SampleSet ( SampleSet &&  )
default

Member Function Documentation

◆ add() [1/2]

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

Add a Sample with a name to the SampleSet.

The Sample is moved.

Definition at line 105 of file sample_set.hpp.

◆ add() [2/2]

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

Add a Sample with a name to the SampleSet.

The Sample is copied.

Definition at line 94 of file sample_set.hpp.

◆ at() [1/2]

Sample& at ( size_t  index)
inline

Definition at line 184 of file sample_set.hpp.

◆ at() [2/2]

Sample const& at ( size_t  index) const
inline

Definition at line 189 of file sample_set.hpp.

◆ begin() [1/2]

iterator begin ( )
inline

Definition at line 164 of file sample_set.hpp.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Definition at line 169 of file sample_set.hpp.

◆ clear()

void clear ( )
inline

Delete all Samples in this SampleSet.

Definition at line 134 of file sample_set.hpp.

◆ empty()

bool empty ( ) const
inline

Return whether the SampleSet is empty.

Definition at line 225 of file sample_set.hpp.

◆ end() [1/2]

iterator end ( )
inline

Definition at line 174 of file sample_set.hpp.

◆ end() [2/2]

const_iterator end ( ) const
inline

Definition at line 179 of file sample_set.hpp.

◆ name_at()

std::string const& name_at ( size_t  index) const
inline

Definition at line 144 of file sample_set.hpp.

◆ names()

std::vector<std::string> const& names ( ) const
inline

Definition at line 155 of file sample_set.hpp.

◆ operator std::vector< Sample > const &()

operator std::vector< Sample > const & ( ) const
inline

Implicit conversion, so that a SampleSet can be used in functions that expect a std::vector instead.

Definition at line 213 of file sample_set.hpp.

◆ operator=() [1/2]

SampleSet& operator= ( SampleSet &&  )
default

◆ operator=() [2/2]

SampleSet& operator= ( SampleSet const &  )
default

◆ operator[]() [1/2]

Sample& operator[] ( size_t  index)
inline

Definition at line 194 of file sample_set.hpp.

◆ operator[]() [2/2]

Sample const& operator[] ( size_t  index) const
inline

Definition at line 199 of file sample_set.hpp.

◆ remove_at()

void remove_at ( size_t  index)
inline

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 117 of file sample_set.hpp.

◆ samples()

std::vector<Sample> const& samples ( ) const
inline

Definition at line 204 of file sample_set.hpp.

◆ size()

size_t size ( ) const
inline

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

Definition at line 234 of file sample_set.hpp.

◆ swap()

void swap ( SampleSet other)
inline

Definition at line 78 of file sample_set.hpp.

Member Typedef Documentation

◆ const_iterator

using const_iterator = typename std::vector<Sample>::const_iterator

Definition at line 63 of file sample_set.hpp.

◆ iterator

using iterator = typename std::vector<Sample>::iterator

Definition at line 62 of file sample_set.hpp.


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