hamcast
Version 0.7
|
#include <source.hpp>
Public Member Functions | |
virtual bool | wait_for_data (long seconds, long microseconds)=0 |
virtual size_t | read_some (size_t buf_size, void *buf)=0 |
virtual void | read (size_t buf_size, void *buf)=0 |
![]() | |
virtual void | close ()=0 |
virtual bool | closed () const =0 |
![]() | |
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 () |
Describes an abstract (binary) data source.
|
pure virtual |
Read buf_size
bytes from the data source. This function blocks until enough bytes are available and throws and exception if the source becomes unreadable before buf_size
bytes are read.
buf_size | The size of buf . |
buf | The target buffer. |
std::ios_base::failure | on errors during read (e.g. if the source is closed) |
Implemented in hamcast::util::read_buffer, and hamcast::util::buffered_source< block_size, maximum_size >.
|
pure virtual |
Read up to buf_size
bytes from the data source and store the bytes in buf
. A closed source always returns 0.
buf_size | The size of buf . |
buf | The target buffer. |
buf_size
). std::ios_base::failure | on errors during read. |
Implemented in hamcast::util::buffered_source< block_size, maximum_size >, and hamcast::util::read_buffer.
|
pure virtual |
Wait until this source becomes "ready" or until a timeout occurs.
seconds | The seconds part of the maximum block time. |
microseconds | The microseconds part of the maximum block time. |
true
if there is data to read; otherwise false
std::ios_base::failure | if the source becomes closed |
Implemented in hamcast::util::buffered_source< block_size, maximum_size >, and hamcast::util::read_buffer.