Rosetta 3.3
Namespaces | Classes | Functions | Variables
utility::io Namespace Reference

File stream I/O classes, primarily for compressed data. More...

Namespaces

namespace  ic
namespace  mpi_stream
namespace  oc

Classes

class  icstream
 icstream: Input channel stream wrapper class More...
class  irstream
 orstream: Input stream wrapper abstract base class More...
class  izstream
 izstream: Input file stream wrapper for uncompressed and compressed files More...
class  ocstream
 ocstream: Output channel stream wrapper class More...
class  orstream
 orstream: Output stream wrapper base class More...
class  ozstream
 ozstream: Output file stream wrapper for uncompressed and compressed files More...

Functions

izstreamgetline (izstream &stream, std::string &line)
 std::getline( std::istream, std::string ) wrapper
izstreamgetline (izstream &stream, std::string &line, char const delim)
 std::getline( std::istream, std::string, char ) wrapper
std::istream & skip (izstream &stream)
 Skip rest of line and line terminator (manipulator)
std::istream & skip (std::istream &stream)
 Skip rest of line and line terminator (manipulator)
template<class T >
void read_vector (std::istream &is, vector1< T > &vec)
template<class T >
void write_vector (std::ostream &out, vector1< T >const &vec)
template<class T >
void write_vector (std::string filename, vector1< T > const &vec)

Variables

std::streamsize const OZSTREAM_DEFAULT_BUFFER_SIZE = 921600
 default buffer size for ozstreams (900KB)

Detailed Description

File stream I/O classes, primarily for compressed data.

The utility::io package provides file stream i/o classes that support gzip-compressed or uncompressed data file i/o through a unified interface so that the same stream i/o operations can be applied regardless of whether the file is compressed or not. They use a modernized version of the zipstream system created by Jonathan de Halleux for the gzip i/o.

The izstream class handles stream input of gzip and uncompressed files. The izstream interface is very similar to std::ifstream except that files with names ending in ".gz" will be opened as gzip compressed files and izstream will try to open other files as gzip files with a .gz appended to the name before opening them as uncompressed files with the specified name.

The orstream class provides the interface for the stream output classes. A hierarchy is needed for output to allow std::endl outputs to gzip files to be intercepted and replaced by non-flushing newlines (since gzip files can't be flushed until closed) while providing a mechanism for predefined stream channels like std::cout to continue to support flushing. The ocstream class is used to support general ostreams and provides predefined ocstream output "channels" cout, cerr, and clog that wrap the corresponding channels in namespace std. Functions written to the abstract orstream interface can work with ozstreams, general ostreams, or predefined ocstream channels.

bzip2 support can be readily added to this system if desired.


Function Documentation

izstream& utility::io::getline ( izstream &  stream,
std::string &  line 
) [inline]

std::getline( std::istream, std::string ) wrapper

Referenced by getline().

izstream& utility::io::getline ( izstream &  stream,
std::string &  line,
char const  delim 
) [inline]

std::getline( std::istream, std::string, char ) wrapper

References getline().

template<class T >
void utility::io::read_vector ( std::istream &  is,
vector1< T > &  vec 
)

References basic::T().

std::istream& utility::io::skip ( std::istream &  stream) [inline]

Skip rest of line and line terminator (manipulator)

References numeric::max().

std::istream& utility::io::skip ( izstream &  stream) [inline]

Skip rest of line and line terminator (manipulator)

References utility::io::izstream::ignore(), and numeric::max().

template<class T >
void utility::io::write_vector ( std::ostream &  out,
vector1< T >const &  vec 
)

Referenced by write_vector().

template<class T >
void utility::io::write_vector ( std::string  filename,
vector1< T > const &  vec 
)

Variable Documentation

std::streamsize const utility::io::OZSTREAM_DEFAULT_BUFFER_SIZE = 921600

default buffer size for ozstreams (900KB)

Note:
this must be at least 4KB, otherwise zipstream will break
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines