A toolkit for working with phylogenetic data.
v0.24.0
Dataframe::Column< T > Class Template Reference

#include <genesis/utils/containers/dataframe.hpp>

Inherits Dataframe::ColumnBase.

Detailed Description

template<typename T>
class genesis::utils::Dataframe::Column< T >

Definition at line 68 of file containers/dataframe.hpp.

Public Member Functions

virtual ~Column () override=default
 
reference at (size_type index)
 
const_reference at (size_type index) const
 
reference at (std::string const &row_name)
 
const_reference at (std::string const &row_name) const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin ()
 
const_iterator cend ()
 
iterator end ()
 
const_iterator end () const
 
 operator std::vector< value_type > const & () const
 Implicit conversion to std::vector. More...
 
self_typeoperator= (std::vector< value_type > const &vec)
 Overwrite a column by the elements of a std::vector. More...
 
self_typeoperator= (std::vector< value_type > &&vec)
 Overwrite a column by the elements of a std::vector. More...
 
reference operator[] (size_type index)
 
const_reference operator[] (size_type index) const
 
reference operator[] (std::string const &row_name)
 
const_reference operator[] (std::string const &row_name) const
 
std::vector< value_type > const & to_vector () const
 Explicit conversion to std::vector. More...
 
- Public Member Functions inherited from Dataframe::ColumnBase
virtual ~ColumnBase ()=default
 
template<typename T >
Column< T > & as ()
 
template<typename T >
Column< T > const & as () const
 
Dataframedataframe ()
 
Dataframe const & dataframe () const
 
bool empty () const
 
template<typename T >
T & get (size_type index)
 
template<typename T >
T const & get (size_type index) const
 
template<typename T >
T & get (std::string const &row_name)
 
template<typename T >
T const & get (std::string const &row_name) const
 
size_type index () const
 
template<typename T >
bool is () const
 
std::string const & name () const
 
size_type size () const
 

Public Types

using const_iterator = typename container_type::const_iterator
 
using const_pointer = value_type const *
 
using const_reference = value_type const &
 
using container_type = std::vector< value_type >
 
using iterator = typename container_type::iterator
 
using pointer = value_type *
 
using reference = value_type &
 
using self_type = Column< T >
 
using size_type = size_t
 
using value_type = T
 
- Public Types inherited from Dataframe::ColumnBase
using size_type = size_t
 

Friends

class Dataframe
 

Additional Inherited Members

- Protected Member Functions inherited from Dataframe::ColumnBase
 ColumnBase ()=delete
 
 ColumnBase (Dataframe &df, size_type index)
 
 ColumnBase (ColumnBase const &)=delete
 
 ColumnBase (ColumnBase &&)=delete
 
ColumnBaseoperator= (ColumnBase const &)=delete
 
ColumnBaseoperator= (ColumnBase &&)=delete
 

Constructor & Destructor Documentation

◆ ~Column()

virtual ~Column ( )
overridevirtualdefault

Member Function Documentation

◆ at() [1/4]

reference at ( size_type  index)
inline

Definition at line 342 of file containers/dataframe.hpp.

◆ at() [2/4]

const_reference at ( size_type  index) const
inline

Definition at line 347 of file containers/dataframe.hpp.

◆ at() [3/4]

reference at ( std::string const &  row_name)
inline

Definition at line 352 of file containers/dataframe.hpp.

◆ at() [4/4]

const_reference at ( std::string const &  row_name) const
inline

Definition at line 357 of file containers/dataframe.hpp.

◆ begin() [1/2]

iterator begin ( )
inline

Definition at line 288 of file containers/dataframe.hpp.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Definition at line 293 of file containers/dataframe.hpp.

◆ cbegin()

const_iterator cbegin ( )
inline

Definition at line 308 of file containers/dataframe.hpp.

◆ cend()

const_iterator cend ( )
inline

Definition at line 313 of file containers/dataframe.hpp.

◆ end() [1/2]

iterator end ( )
inline

Definition at line 298 of file containers/dataframe.hpp.

◆ end() [2/2]

const_iterator end ( ) const
inline

Definition at line 303 of file containers/dataframe.hpp.

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

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

Implicit conversion to std::vector.

Explicit conversion to std::vector. We can only offer const ref (or copy), but no non-const ref, as the latter would allow users to change the vector size, breaking our invariants of equal-sized columns in the dataframe. In order to modify all elements as if they were a vector, use the iterators obtained from begin() and end() instead.

Definition at line 424 of file containers/dataframe.hpp.

◆ operator=() [1/2]

self_type& operator= ( std::vector< value_type > const &  vec)
inline

Overwrite a column by the elements of a std::vector.

The size of the vector needs to match the number of rows of the Dataframe. The vector is copied.

Definition at line 372 of file containers/dataframe.hpp.

◆ operator=() [2/2]

self_type& operator= ( std::vector< value_type > &&  vec)
inline

Overwrite a column by the elements of a std::vector.

The size of the vector needs to match the number of rows of the Dataframe. The vector is moved.

Definition at line 390 of file containers/dataframe.hpp.

◆ operator[]() [1/4]

reference operator[] ( size_type  index)
inline

Definition at line 322 of file containers/dataframe.hpp.

◆ operator[]() [2/4]

const_reference operator[] ( size_type  index) const
inline

Definition at line 327 of file containers/dataframe.hpp.

◆ operator[]() [3/4]

reference operator[] ( std::string const &  row_name)
inline

Definition at line 332 of file containers/dataframe.hpp.

◆ operator[]() [4/4]

const_reference operator[] ( std::string const &  row_name) const
inline

Definition at line 337 of file containers/dataframe.hpp.

◆ to_vector()

std::vector<value_type> const& to_vector ( ) const
inline

Explicit conversion to std::vector.

We can only offer const ref (or copy), but no non-const ref, as the latter would allow users to change the vector size, breaking our invariants of equal-sized columns in the dataframe. In order to modify all elements as if they were a vector, use the iterators obtained from begin() and end() instead.

Definition at line 414 of file containers/dataframe.hpp.

Friends And Related Function Documentation

◆ Dataframe

friend class Dataframe
friend

Definition at line 252 of file containers/dataframe.hpp.

Member Typedef Documentation

◆ const_iterator

using const_iterator = typename container_type::const_iterator

Definition at line 248 of file containers/dataframe.hpp.

◆ const_pointer

using const_pointer = value_type const*

Definition at line 245 of file containers/dataframe.hpp.

◆ const_reference

using const_reference = value_type const&

Definition at line 243 of file containers/dataframe.hpp.

◆ container_type

using container_type = std::vector< value_type >

Definition at line 240 of file containers/dataframe.hpp.

◆ iterator

using iterator = typename container_type::iterator

Definition at line 247 of file containers/dataframe.hpp.

◆ pointer

using pointer = value_type*

Definition at line 244 of file containers/dataframe.hpp.

◆ reference

Definition at line 242 of file containers/dataframe.hpp.

◆ self_type

using self_type = Column<T>

Definition at line 238 of file containers/dataframe.hpp.

◆ size_type

using size_type = size_t

Definition at line 250 of file containers/dataframe.hpp.

◆ value_type

using value_type = T

Definition at line 239 of file containers/dataframe.hpp.


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