|
libtcspc C++ API
Streaming TCSPC and time tag data processing
|
Streams for use with tcspc::write_binary_stream().
An output stream is a movable (usually noncopyable) object with the following member functions:
Functions | |
| auto | tcspc::binary_file_output_stream (std::string const &filename, arg::truncate< bool > truncate=arg::truncate{false}, arg::append< bool > append=arg::append{false}) |
| Create a binary output stream for the given file. | |
| auto | tcspc::borrowed_cfile_output_stream (std::FILE *fp) |
| Create an output stream from a non-owned C file pointer. | |
| auto | tcspc::null_output_stream () |
| Create an output stream that discards all written bytes. | |
| template<typename OStream> | |
| auto | tcspc::ostream_output_stream (OStream stream) |
| Create an output stream from an std::ostream instance. | |
| auto | tcspc::owning_cfile_output_stream (std::FILE *fp) |
| Create an output stream from a C file pointer, taking ownership. | |
|
inline |
Create a binary output stream for the given file.
If both truncate and append are true, behave as if only truncate is true. If neither are true, the file must not exist or the stream will be in an error state. If the file cannot be opened, the stream will be in an error state.
| filename | the filename |
| truncate | if true, overwrite existing file |
| append | if true, file will be appended to if it exists |
|
inline |
Create an output stream from a non-owned C file pointer.
The stream will use the C stdio functions, such as std::fwrite(). The file pointer is not closed when the stream is destroyed. The caller is responsible for ensuring that the file pointer will remain valid throughout the lifetime of the returned output stream.
The file pointer fp should have been opened in binary mode. (If using stdout, use std::freopen() with a full filename on POSIX or _setmode() with _O_BINARY on Windows (via _fileno()).)
If fp is null, the stream will always be in an error state.
| fp | a file pointer |
|
inline |
Create an output stream that discards all written bytes.
|
inline |
Create an output stream from an std::ostream instance.
The ostream is moved into the returned output stream and destroyed together, so you cannot use this with an ostream that you do not own (such as std::cout). For that, see tcspc::borrowed_cfile_output_stream (which works with stdout).
| stream | an ostream (derived from std::ostream) |
|
inline |
Create an output stream from a C file pointer, taking ownership.
The stream will use the C stdio functions, such as std::fwrite(). The file pointer is closed when the stream is destroyed.
The file pointer fp should have been opened in binary mode.
If fp is null, the stream will always be in an error state.
| fp | a file pointer |