#include <evo/impl/sysio.h>
I/O device base class for streams.
- This interface is used to define an I/O device concept for stream I/O
- This doesn't need virtual methods because the derived class is used as a template parameter to a Stream class
- Do not throw exceptions here, use Error code
|
void | close () |
| Close stream. More...
|
|
ulong | read (Error &err, void *buf, ulong size, ulong timeout_ms=0) |
| Read input data from device. More...
|
|
ulong | write (Error &err, const void *buf, ulong size, ulong timeout_ms=0) |
| Write output data to device. More...
|
|
◆ ExceptionInT
Input exception type for device (may be overridden by derived)
◆ ExceptionOutT
Output exception type for device (may be overridden by derived)
◆ close()
◆ read()
ulong read |
( |
Error & |
err, |
|
|
void * |
buf, |
|
|
ulong |
size, |
|
|
ulong |
timeout_ms = 0 |
|
) |
| |
|
inline |
Read input data from device.
- On success this reads at least 1 byte and may read less than requested size
- If not open/readable, returns end-of-file (0)
- Parameters
-
err | Stores ENone on success, error code on error [out] |
buf | Buffer to store data read |
size | Size to read in bytes |
timeout_ms | Read timeout in milliseconds, 0 for none (don't timeout) |
- Returns
- Size actually read in bytes, 0 on end-of-file or error
◆ write()
ulong write |
( |
Error & |
err, |
|
|
const void * |
buf, |
|
|
ulong |
size, |
|
|
ulong |
timeout_ms = 0 |
|
) |
| |
|
inline |
Write output data to device.
- On success at least 1 byte is written but may be less than requested size
- If not open/writable, returns ENotImpl error
- Parameters
-
err | Stores ENone on success, error code on error [out] |
buf | Buffer to write from |
size | Size to write in bytes |
timeout_ms | Write timeout in milliseconds, 0 for none (don't timeout) |
- Returns
- Size actually written in bytes, 0 on error (check err)
The documentation for this class was generated from the following file: