|
byteme
Read/write bytes from various sources
|
Parallelized buffering to wrap a Writer.
More...
#include <BufferedWriter.hpp>


Public Member Functions | |
| ParallelBufferedWriter (Pointer_ writer, std::size_t buffer_size) | |
| void | finish () |
Public Member Functions inherited from byteme::BufferedWriter< Type_, WriterPointer_ > | |
| unsigned long long | number () |
| void | write (Type_ input) |
| void | write (const Type_ *input, std::size_t number) |
| void | write (const char *string) |
| void | write (const std::string &string) |
| void | flush () |
Parallelized buffering to wrap a Writer.
| Type_ | Type of the output bytes, usually char for text or unsigned char for binary. |
| Pointer_ | Pointer to a class that serves as a source of input bytes. The pointed-to class should satisfy the Writer interface; it may also be a concrete Writer subclass to enable devirtualization. Either a smart or raw pointer may be supplied depending on how the caller wants to manage the lifetime of the pointed-to object. |
This is a subclass of BufferedWriter that calls Writer::write() on a worker thread. The user can fill up the next buffer while the current buffer is flushed to the underlying representation.
|
inline |
| writer | Pointer to a source of input bytes. |
| buffer_size | Size of the internal buffer in which to store bytes that have been passed to write() but not yet flushed to the writer. Larger values reduce the number of write calls at the cost of greater memory usage. Should be positive. |
|
inlinevirtual |
Flush all currently-buffered bytes to the underlying Writer instance and call Writer::finish(). This terminates the write stream so no further calls to write(), flush() or finish() may be performed. It is not called automatically upon BufferedWriter destruction, as the user may want to write further bytes to the same Writer instance after exiting the BufferedWriter wrapper.
Implements byteme::BufferedWriter< Type_, WriterPointer_ >.