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

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

Inherits ifstream.

Detailed Description

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

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::ifstream class of the excellent zstr library by Matei David; see also our Acknowledgements.

See also
StrictOFStream
StrictFStream

Definition at line 96 of file strict_fstream.hpp.

Public Member Functions

 StrictIFStream ()=default
 
 StrictIFStream (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

◆ StrictIFStream() [1/2]

StrictIFStream ( )
default

◆ StrictIFStream() [2/2]

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

Definition at line 103 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 211 of file strict_fstream.cpp.


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