A library for working with phylogenetic and population genetic data.
v0.27.0
StrictFStream Class Reference

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

Inherits fstream.

Detailed Description

Stream that defines a strict wrapper around std::fstream.

The wrapper performs the following steps:

  • Check that the open modes make sense
  • Check that the call to open() is successful
  • Check that the opened file is peek-able
  • Turn on the badbit in the exception mask

This is useful to ensure proper file handling.

The class is based on the strict_fstream::fstream class of the excellent zstr library by Matei David; see also our Acknowledgements.

See also
StrictIFStream
StrictOFStream

Definition at line 171 of file strict_fstream.hpp.

Public Member Functions

 StrictFStream ()=default
 
 StrictFStream (std::string const &filename, std::ios_base::openmode mode=std::ios_base::in)
 
void open (std::string const &filename, std::ios_base::openmode mode=std::ios_base::in)
 

Constructor & Destructor Documentation

◆ StrictFStream() [1/2]

StrictFStream ( )
default

◆ StrictFStream() [2/2]

StrictFStream ( std::string const &  filename,
std::ios_base::openmode  mode = std::ios_base::in 
)
inline

Definition at line 178 of file strict_fstream.hpp.

Member Function Documentation

◆ open()

void open ( std::string const &  filename,
std::ios_base::openmode  mode = std::ios_base::in 
)

Definition at line 229 of file strict_fstream.cpp.


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