A library for working with phylogenetic and population genetic data.
v0.32.0
StrictOFStream Class Reference

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

Inherits ofstream.

Detailed Description

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

The wrapper performs the following steps:

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

This is useful to ensure proper file handling.

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

See also
StrictIFStream
StrictFStream

Definition at line 133 of file strict_fstream.hpp.

Public Member Functions

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

Constructor & Destructor Documentation

◆ StrictOFStream() [1/2]

StrictOFStream ( )
default

◆ StrictOFStream() [2/2]

StrictOFStream ( std::string const &  filename,
std::ios_base::openmode  mode = std::ios_base::out 
)
inline

Definition at line 140 of file strict_fstream.hpp.

Member Function Documentation

◆ open()

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

Definition at line 222 of file strict_fstream.cpp.


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