A library for working with phylogenetic and population genetic data.
v0.27.0
MatrixWriter< T > Class Template Reference

#include <genesis/utils/containers/matrix/writer.hpp>

Detailed Description

template<typename T>
class genesis::utils::MatrixWriter< T >

Definition at line 53 of file utils/containers/matrix/writer.hpp.

Public Member Functions

 MatrixWriter (MatrixWriter &&)=default
 
 MatrixWriter (MatrixWriter const &)=default
 
 MatrixWriter (std::string const &separator="\t", Format format=Format::kMatrix)
 
 ~MatrixWriter ()=default
 
Format format () const
 
MatrixWriterformat (Format value)
 
MatrixWriteroperator= (MatrixWriter &&)=default
 
MatrixWriteroperator= (MatrixWriter const &)=default
 
std::string const & separator_string () const
 
MatrixWriterseparator_string (std::string const &value)
 
void write (Matrix< T > const &matrix, std::shared_ptr< utils::BaseOutputTarget > target, std::vector< std::string > row_names={}, std::vector< std::string > col_names={}, std::string corner="") const
 Write a Matrix to an output target, using a specific MatrixWriter::Format and separator string. More...
 
MatrixWriterwrite_value_functor (std::function< std::string(T const &)> functor)
 

Public Types

enum  Format { kMatrix, kList, kTriangular }
 

Constructor & Destructor Documentation

◆ MatrixWriter() [1/3]

MatrixWriter ( std::string const &  separator = "\t",
Format  format = Format::kMatrix 
)
inlineexplicit

Definition at line 72 of file utils/containers/matrix/writer.hpp.

◆ ~MatrixWriter()

~MatrixWriter ( )
default

◆ MatrixWriter() [2/3]

MatrixWriter ( MatrixWriter< T > const &  )
default

◆ MatrixWriter() [3/3]

MatrixWriter ( MatrixWriter< T > &&  )
default

Member Function Documentation

◆ format() [1/2]

Format format ( ) const
inline

Definition at line 142 of file utils/containers/matrix/writer.hpp.

◆ format() [2/2]

MatrixWriter& format ( Format  value)
inline

Definition at line 147 of file utils/containers/matrix/writer.hpp.

◆ operator=() [1/2]

MatrixWriter& operator= ( MatrixWriter< T > &&  )
default

◆ operator=() [2/2]

MatrixWriter& operator= ( MatrixWriter< T > const &  )
default

◆ separator_string() [1/2]

std::string const& separator_string ( ) const
inline

Definition at line 131 of file utils/containers/matrix/writer.hpp.

◆ separator_string() [2/2]

MatrixWriter& separator_string ( std::string const &  value)
inline

Definition at line 136 of file utils/containers/matrix/writer.hpp.

◆ write()

void write ( Matrix< T > const &  matrix,
std::shared_ptr< utils::BaseOutputTarget target,
std::vector< std::string >  row_names = {},
std::vector< std::string >  col_names = {},
std::string  corner = "" 
) const
inline

Write a Matrix to an output target, using a specific MatrixWriter::Format and separator string.

The format and separator string can either be set in the constructor, or using the methods format( Format ) and separator_string( std::string const& ).

The write() function takes optional row and column names, and a corner element that is used if both row and column names are givenm, as the upper left entry of the written output. Alternatively, either the row_names or the col_names can contain an additional element in the beginning, which is then used as the "corner" top left element when writing. This allows maximum flexibility in the setup when using this writer class.

Definition at line 102 of file utils/containers/matrix/writer.hpp.

◆ write_value_functor()

MatrixWriter& write_value_functor ( std::function< std::string(T const &)>  functor)
inline

Definition at line 153 of file utils/containers/matrix/writer.hpp.

Member Enumeration Documentation

◆ Format

enum Format
strong
Enumerator
kMatrix 
kList 
kTriangular 

Definition at line 61 of file utils/containers/matrix/writer.hpp.


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