A toolkit for working with phylogenetic data.
v0.24.0
Deserializer Class Reference

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

Detailed Description

Definition at line 57 of file deserializer.hpp.

Public Member Functions

 Deserializer (std::string const &file_name)
 
 Deserializer (std::istream &instream)
 
bool finished () const
 
template<typename T >
get_float ()
 Read a floating point number from the stream and return it. More...
 
template<typename T >
void get_float (T &res)
 Read an floating point number from the stream and store it in the result. More...
 
template<typename T >
get_int ()
 Read an integer number from the stream and return it. More...
 
template<typename T >
void get_int (T &res)
 Read an integer number from the stream and store it in the result. More...
 
bool get_null (size_t n)
 Reads n bytes from the stream and returns whether all of them are \0 bytes. More...
 
template<typename T >
get_plain ()
 Read as many bytes from the stream as the type T holds, and return them in form of a value of type T. More...
 
template<typename T >
void get_plain (T &res)
 Read as many bytes from the stream as the type T holds, and put them in the result value of type T. More...
 
void get_raw (char *buffer, size_t n)
 Read n bytes from the stream and store them in the buffer. More...
 
std::string get_raw_string (size_t n)
 Read n bytes from the stream and return them as a string. More...
 
std::string get_string ()
 Read a string from the stream, provided that its length it written preceding it, as done by put_string(). More...
 
 operator bool () const
 

Constructor & Destructor Documentation

◆ Deserializer() [1/2]

Deserializer ( std::string const &  file_name)
inlineexplicit

Definition at line 65 of file deserializer.hpp.

◆ Deserializer() [2/2]

Deserializer ( std::istream &  instream)
inlineexplicit

Definition at line 73 of file deserializer.hpp.

Member Function Documentation

◆ finished()

bool finished ( ) const
inline

Definition at line 115 of file deserializer.hpp.

◆ get_float() [1/2]

T get_float ( )
inline

Read a floating point number from the stream and return it.

Definition at line 239 of file deserializer.hpp.

◆ get_float() [2/2]

void get_float ( T &  res)
inline

Read an floating point number from the stream and store it in the result.

Definition at line 248 of file deserializer.hpp.

◆ get_int() [1/2]

T get_int ( )
inline

Read an integer number from the stream and return it.

Definition at line 221 of file deserializer.hpp.

◆ get_int() [2/2]

void get_int ( T &  res)
inline

Read an integer number from the stream and store it in the result.

Definition at line 230 of file deserializer.hpp.

◆ get_null()

bool get_null ( size_t  n)
inline

Reads n bytes from the stream and returns whether all of them are \0 bytes.

Definition at line 157 of file deserializer.hpp.

◆ get_plain() [1/2]

T get_plain ( )
inline

Read as many bytes from the stream as the type T holds, and return them in form of a value of type T.

Definition at line 200 of file deserializer.hpp.

◆ get_plain() [2/2]

void get_plain ( T &  res)
inline

Read as many bytes from the stream as the type T holds, and put them in the result value of type T.

Definition at line 212 of file deserializer.hpp.

◆ get_raw()

void get_raw ( char *  buffer,
size_t  n 
)
inline

Read n bytes from the stream and store them in the buffer.

The buffer needs to be big enough to hold n bytes.

Definition at line 143 of file deserializer.hpp.

◆ get_raw_string()

std::string get_raw_string ( size_t  n)
inline

Read n bytes from the stream and return them as a string.

Definition at line 174 of file deserializer.hpp.

◆ get_string()

std::string get_string ( )
inline

Read a string from the stream, provided that its length it written preceding it, as done by put_string().

Definition at line 188 of file deserializer.hpp.

◆ operator bool()

operator bool ( ) const
inline

Definition at line 85 of file deserializer.hpp.


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