hamcast
Version 0.7
|
#include <buffered_sink.hpp>
Public Member Functions | |
buffered_sink (const intrusive_ptr< sink > &underlying_sink) | |
virtual void | write (size_t buf_size, const void *buf) |
virtual void | flush () |
virtual int | flush_hint () const |
virtual void | close () |
virtual bool | closed () const |
![]() | |
long | ref_count () |
Additional Inherited Members | |
![]() | |
static void | add_ref (ref_counted *rc) |
static void | release (ref_counted *rc) |
![]() | |
ref_counted () | |
void | ref () |
bool | deref () |
A decorator class that adds a write buffer to an otherwise unbuffered sink.
block_size:
buffered_sink allocates storage always in chunks to minimize resizing of the internal buffer.
maximum_size:
The maximum number of bytes buffered_sink should allocate.
hamcast::util::buffered_sink< block_size, maximum_size >::buffered_sink | ( | const intrusive_ptr< sink > & | underlying_sink | ) |
Create a buffered sink that decorates underlying_sink
.
underlying_sink | The original sink. |
underlying_sink
is valid
|
virtual |
Close the data channel.
Implements hamcast::util::closeable.
|
virtual |
Check if the data channel is closed.
true
if this
is closed for read/write operations; otherwise false
. Implements hamcast::util::closeable.
|
virtual |
Force the data sink to flush any buffers.
Any | exception that might be thrown by write(). |
Implements hamcast::util::sink.
|
virtual |
Return the optimal block size for write operations.
Reimplemented from hamcast::util::sink.
|
virtual |
Writes buf_size
bytes from buf
to the sink.
buf_size | The number of bytes that should be written from buf . |
buf | The buffer. |
ios_base::failure | on errors (e.g. if the sink is closed) |
Implements hamcast::util::sink.