Evo C++ Library v0.5.1
Public Types | Public Member Functions | List of all members
IoDevice Class Reference

#include <evo/impl/sysio.h>

Inheritance diagram for IoDevice:
Inheritance graph
[legend]

Detailed Description

I/O device base class for streams.

Public Types

typedef ExceptionStreamIn ExceptionInT
 Input exception type for device (may be overridden by derived) More...
 
typedef ExceptionStreamOut ExceptionOutT
 Output exception type for device (may be overridden by derived) More...
 

Public Member Functions

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...
 

Member Typedef Documentation

◆ ExceptionInT

Input exception type for device (may be overridden by derived)

◆ ExceptionOutT

Output exception type for device (may be overridden by derived)

Member Function Documentation

◆ close()

void close ( )
inline

Close stream.

◆ 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
errStores ENone on success, error code on error [out]
bufBuffer to store data read
sizeSize to read in bytes
timeout_msRead 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
errStores ENone on success, error code on error [out]
bufBuffer to write from
sizeSize to write in bytes
timeout_msWrite 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: