#include <trace-tools/tool/datafile.hh>
Public Member Functions | |
datafile (const std::string &) | |
operator std::ostream & () | |
template<class T> | |
std::ostream & | operator<< (const T &) |
A datafile
object represents an output file. It may be casted to std::ostream&
and has an <<
operator for formatted outputs. The main difference with std::ofstream
is the file is not opened until the corresponding stream is effectively solicited. Thus, if the file does not exist on the filesystem and no operation is performed on it, no file will be created.
Unlike std::ostream
, datafile
is copy-constructible.
tool::datafile::datafile | ( | const std::string & | filename | ) | [inline] |
Construct a datafile
object given a filename.
tool::datafile::operator std::ostream & | ( | ) | [inline] |
Retrieve the underlying C++ stream.
std::ostream & tool::datafile::operator<< | ( | const T & | data | ) | [inline] |
Formatted output.