List of all members.
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 |
Detailed Description
Describes an abstract (binary) data source.
Member Function Documentation
virtual void hamcast::util::source::read |
( |
size_t |
buf_size, |
|
|
void * |
buf | |
|
) |
| | [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.
- Parameters:
-
| buf_size | The size of buf . |
| buf | The target buffer. |
- Precondition:
- lock_read() was called
- Exceptions:
-
| std::ios_base::failure | on errors during read (e.g. if the source is closed) |
Implemented in hamcast::util::buffered_source< block_size, maximum_size >, and hamcast::util::read_buffer.
virtual size_t hamcast::util::source::read_some |
( |
size_t |
buf_size, |
|
|
void * |
buf | |
|
) |
| | [pure virtual] |
Read up to buf_size
bytes from the data source and store the bytes in buf
. A closed source always returns 0.
- Parameters:
-
| buf_size | The size of buf . |
| buf | The target buffer. |
- Returns:
- The number of readed bytes (might be <
buf_size
).
- Precondition:
- lock_read() was called
- Exceptions:
-
| std::ios_base::failure | on errors during read. |
Implemented in hamcast::util::buffered_source< block_size, maximum_size >, and hamcast::util::read_buffer.
virtual bool hamcast::util::source::wait_for_data |
( |
long |
seconds, |
|
|
long |
microseconds | |
|
) |
| | [pure virtual] |
Wait until this source becomes "ready" or until a timeout occurs.
- Parameters:
-
| seconds | The seconds part of the maximum block time. |
| microseconds | The microseconds part of the maximum block time. |
- Returns:
true
if there is data to read; otherwise false
- Precondition:
- lock_read() was called
- Exceptions:
-
| std::ios_base::failure | if the source becomes closed |
Implemented in hamcast::util::buffered_source< block_size, maximum_size >, and hamcast::util::read_buffer.
The documentation for this struct was generated from the following file: