A library for working with phylogenetic and population genetic data.
v0.32.0
StringInputSource Class Referencefinal

#include <genesis/utils/io/string_input_source.hpp>

Inherits BaseInputSource.

Detailed Description

Input source for reading byte data from a string.

The input string is provided via the constructor. It is not owned by this class, thus the owner must keep it alive as long as reading from it is required, and is responsbile for destroying it. This class merely keeps a pointer to it.

That implies that the string shall not be modified while this input source is used, thus, only const-members of the string can be called.

Definition at line 58 of file string_input_source.hpp.

Public Member Functions

 StringInputSource (char const *str, size_t size)
 Construct the input source from a char array. More...
 
 StringInputSource (std::string const &str)
 Construct the input source from a std::string. More...
 
 StringInputSource (StringInputSource &&)=default
 
 StringInputSource (StringInputSource const &)=default
 
 ~StringInputSource () override
 
StringInputSourceoperator= (StringInputSource &&)=default
 
StringInputSourceoperator= (StringInputSource const &)=default
 
- Public Member Functions inherited from BaseInputSource
 BaseInputSource ()=default
 
 BaseInputSource (BaseInputSource &&)=default
 
 BaseInputSource (BaseInputSource const &)=default
 
virtual ~BaseInputSource ()
 
bool is_trivial () const
 Return whether reading from this source is trivial, such as reading from a file, or involves more complex operations, such as reading from a compressed input that needs to be decompressed first. More...
 
BaseInputSourceoperator= (BaseInputSource &&)=default
 
BaseInputSourceoperator= (BaseInputSource const &)=default
 
size_t read (char *buffer, size_t size)
 Read size many bytes into the char buffer. More...
 
std::string source_name () const
 Get a name of the input source. This is intended for user output. More...
 
std::string source_string () const
 Get a string representing the input source. This is intended for the reader classes, which for example might want to examine the input file name. More...
 

Constructor & Destructor Documentation

◆ StringInputSource() [1/4]

StringInputSource ( char const *  str,
size_t  size 
)
inline

Construct the input source from a char array.

Definition at line 69 of file string_input_source.hpp.

◆ StringInputSource() [2/4]

StringInputSource ( std::string const &  str)
inlineexplicit

Construct the input source from a std::string.

Definition at line 79 of file string_input_source.hpp.

◆ StringInputSource() [3/4]

StringInputSource ( StringInputSource const &  )
default

◆ StringInputSource() [4/4]

◆ ~StringInputSource()

~StringInputSource ( )
inlineoverride

Definition at line 92 of file string_input_source.hpp.

Member Function Documentation

◆ operator=() [1/2]

StringInputSource& operator= ( StringInputSource &&  )
default

◆ operator=() [2/2]

StringInputSource& operator= ( StringInputSource const &  )
default

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