Wheefun I/O Library
0.0.5
Useful I/O Primitives.
|
Generic wrapping around various stream types. More...
Go to the source code of this file.
Classes | |
struct | wfio_peer_t |
A generic stream encapsulation. More... | |
class | wfio::Peer |
Namespaces | |
wfio | |
The root namespace for WFIO. | |
Typedefs | |
typedef WFIO_C_BEGIN struct wfio_peer_t | wfio_peer_t |
A generic stream encapsulation. More... | |
Functions | |
WFIO_DLL int | wfio_peer_fromDeviceEx (wfio_peer_t *peer, struct wfio_device_t *device, int ioshare, int *error) |
Initialize a peer using a device with the specified ioshare mode. More... | |
WFIO_ALWAYS_INLINE int | wfio_peer_fromDevice (wfio_peer_t *peer, struct wfio_device_t *device, int *error) |
Initialize a peer using a device. More... | |
WFIO_DLL int | wfio_peer_fromBinstreamEx (wfio_peer_t *peer, struct wfio_binstream_t *bin, int ioshare, int *error) |
Initialize a peer using a binstream with the specified ioshare mode. More... | |
WFIO_ALWAYS_INLINE int | wfio_peer_fromBinstream (wfio_peer_t *peer, struct wfio_binstream_t *bin, int *error) |
Initialize a peer using a binstream. More... | |
WFIO_DLL_FASTCALL wfio_peer_t | wfio_peer_ioshare (wfio_peer_t *peer, wfio_ioshare_t ioshare, int *error) |
Share this peer with the supplied ioshare mode. More... | |
WFIO_DLL int | wfio_peer_acquire (wfio_peer_t *peer, int *error) |
Share this peer. More... | |
WFIO_DLL void | wfio_peer_close (wfio_peer_t *peer) |
Release this peer. More... | |
WFIO_DLL size_t | wfio_peer_read (wfio_peer_t *peer, void *buf, size_t sz, size_t elem, int *error) |
Read elements from this peer. More... | |
WFIO_ALWAYS_INLINE size_t | wfio_peer_readbV (wfio_peer_t *peer, void *buf, size_t len, int *error) |
Read bytes from this peer. More... | |
WFIO_ALWAYS_INLINE int | wfio_peer_readb (wfio_peer_t *peer, int *error) |
Read a single byte from this peer. More... | |
WFIO_DLL size_t | wfio_peer_write (wfio_peer_t *peer, const void *buf, size_t sz, size_t elem, int *error) |
Write elements to this peer. More... | |
WFIO_ALWAYS_INLINE size_t | wfio_peer_writebV (wfio_peer_t *peer, const void *buf, size_t len, int *error) |
Write bytes to this peer. More... | |
WFIO_ALWAYS_INLINE int | wfio_peer_writeb (wfio_peer_t *peer, char c, int *error) |
Write a single byte to this peer. More... | |
WFIO_DLL int | wfio_peer_vdcntl (wfio_peer_t *peer, wfio_dcntl_t cmd, int *error, va_list va) |
Perform device-independent I/O on this peer using a va_list. More... | |
WFIO_ALWAYS_INLINE int | wfio_peer_dcntl (wfio_peer_t *peer, wfio_dcntl_t cmd, int *error,...) |
Perform device-independent I/O on this peer. More... | |
WFIO_DLL int | wfio_peer_vioctl (wfio_peer_t *peer, int cmd, int *error, va_list va) |
Perform device-dependent I/O on this peer using a va_list. More... | |
WFIO_ALWAYS_INLINE int | wfio_peer_ioctl (wfio_peer_t *peer, int *error, int cmd,...) |
Perform device-dependent I/O on this peer. More... | |
WFIO_DLL int | wfio_peer_seek (wfio_peer_t *peer, wfio_off_t offset, wfio_whence_t whence, int *error) |
Seek to a position in the stream. More... | |
WFIO_DLL_FASTCALL int | wfio_peer_canSeek (wfio_peer_t *peer) |
Determine whether or not this peer can seek. More... | |
WFIO_DLL_FASTCALL wfio_off_t | wfio_peer_tell (wfio_peer_t *peer, int *error) |
Determine the current stream position of this peer. More... | |
WFIO_DLL_FASTCALL int | wfio_peer_flush (wfio_peer_t *peer, int *error) |
Determine the current stream position of this peer. More... | |
WFIO_DLL_FASTCALL size_t | wfio_peer_getbufsz (wfio_peer_t *peer, int *error) |
Obtain the buffer size. More... | |
WFIO_DLL size_t | wfio_peer_setbufsz (wfio_peer_t *peer, size_t sz, int *error) |
Set the buffer size. More... | |
Generic wrapping around various stream types.
typedef WFIO_C_BEGIN struct wfio_peer_t wfio_peer_t |
A generic stream encapsulation.
This type wraps around various stream types. This allows for it to be generically used in other types; for instance,
WFIO_DLL int wfio_peer_acquire | ( | wfio_peer_t * | peer, |
int * | error | ||
) |
Share this peer.
peer | The peer to acquire. |
error | An optional error indicator. |
WFIO_DLL_FASTCALL int wfio_peer_canSeek | ( | wfio_peer_t * | peer | ) |
Determine whether or not this peer can seek.
peer | The peer to interrogate. |
WFIO_DLL void wfio_peer_close | ( | wfio_peer_t * | peer | ) |
Release this peer.
peer | The peer to acquire. |
WFIO_ALWAYS_INLINE int wfio_peer_dcntl | ( | wfio_peer_t * | peer, |
wfio_dcntl_t | cmd, | ||
int * | error, | ||
... | |||
) |
Perform device-independent I/O on this peer.
peer | The peer to dcntl. |
cmd | The command to send to the peer. |
... | Additional arguments to the dcntl. |
WFIO_DLL_FASTCALL int wfio_peer_flush | ( | wfio_peer_t * | peer, |
int * | error | ||
) |
Determine the current stream position of this peer.
peer | The peer to interrogate. |
error | An optional error indicator. |
ecode
. WFIO_ALWAYS_INLINE int wfio_peer_fromBinstream | ( | wfio_peer_t * | peer, |
struct wfio_binstream_t * | bin, | ||
int * | error | ||
) |
Initialize a peer using a binstream.
peer | The peer to initialize. |
bin | The binstream to initialize the peer. |
error | An optional error indicator. |
WFIO_DLL int wfio_peer_fromBinstreamEx | ( | wfio_peer_t * | peer, |
struct wfio_binstream_t * | bin, | ||
int | ioshare, | ||
int * | error | ||
) |
Initialize a peer using a binstream with the specified ioshare mode.
peer | The peer to initialize. |
bin | The binstream to initialize the peer. |
ioshare | The ioshare mode to initialize the peer with. |
error | An optional error indicator. |
WFIO_ALWAYS_INLINE int wfio_peer_fromDevice | ( | wfio_peer_t * | peer, |
struct wfio_device_t * | device, | ||
int * | error | ||
) |
Initialize a peer using a device.
peer | The peer to initialize. |
device | The device to initialize the peer. |
error | An optional error indicator. |
WFIO_DLL int wfio_peer_fromDeviceEx | ( | wfio_peer_t * | peer, |
struct wfio_device_t * | device, | ||
int | ioshare, | ||
int * | error | ||
) |
Initialize a peer using a device with the specified ioshare mode.
peer | The peer to initialize. |
device | The device to initialize the peer. |
ioshare | The ioshare mode to initialize the peer with. |
error | An optional error indicator. |
WFIO_DLL_FASTCALL size_t wfio_peer_getbufsz | ( | wfio_peer_t * | peer, |
int * | error | ||
) |
Obtain the buffer size.
peer | The peer to interrogate. |
error | An optional error indicator. |
WFIO_ALWAYS_INLINE int wfio_peer_ioctl | ( | wfio_peer_t * | peer, |
int * | error, | ||
int | cmd, | ||
... | |||
) |
Perform device-dependent I/O on this peer.
peer | The peer to ioctl. |
cmd | The command to send to the peer. |
... | Additional arguments to the ioctl. |
WFIO_DLL_FASTCALL wfio_peer_t wfio_peer_ioshare | ( | wfio_peer_t * | peer, |
wfio_ioshare_t | ioshare, | ||
int * | error | ||
) |
Share this peer with the supplied ioshare
mode.
peer | The device to share. |
ioshare | The ioshare mode. |
This function allows for the peer to be shared in the specified manner.
WFIO_DLL size_t wfio_peer_read | ( | wfio_peer_t * | peer, |
void * | buf, | ||
size_t | sz, | ||
size_t | elem, | ||
int * | error | ||
) |
Read elements from this peer.
peer | The peer to read from. |
buf | The buffer to read into. |
sz | The size of each element. |
elem | The number of elements to read. |
error | An optional error indicator. |
WFIO_ALWAYS_INLINE int wfio_peer_readb | ( | wfio_peer_t * | peer, |
int * | error | ||
) |
Read a single byte from this peer.
peer | The peer to read from. |
error | An optional error indicator. |
WFIO_ALWAYS_INLINE size_t wfio_peer_readbV | ( | wfio_peer_t * | peer, |
void * | buf, | ||
size_t | len, | ||
int * | error | ||
) |
Read bytes from this peer.
peer | The peer to read from. |
buf | The buffer to read into. |
len | The number of bytes to read. |
error | An optional error indicator. |
WFIO_DLL int wfio_peer_seek | ( | wfio_peer_t * | peer, |
wfio_off_t | offset, | ||
wfio_whence_t | whence, | ||
int * | error | ||
) |
Seek to a position in the stream.
This method attempts to seek the peer to the specified position. This is only successful if the peer is open and seekable.
peer | The peer to seek. |
offset | The offset relative to whence to seek to. |
whence | The origin added to whence to seek to. |
error | An optional error indicator. |
WFIO_DLL size_t wfio_peer_setbufsz | ( | wfio_peer_t * | peer, |
size_t | sz, | ||
int * | error | ||
) |
Set the buffer size.
This function sets the size of the underlying buffer belonging to peer
if it supports this behavior. The peer itself is not required to change the size of the buffer to sz
; if it changes it to a different size, If for some reason this operation fails or is unsupported, then it shall return WFIO_NPOS and the buffer size shall remain unchanged.
peer | The peer to set the buffer size for. |
sz | The requested size to set. |
error | An optional error indicator. |
WFIO_DLL_FASTCALL wfio_off_t wfio_peer_tell | ( | wfio_peer_t * | peer, |
int * | error | ||
) |
Determine the current stream position of this peer.
peer | The peer to interrogate. |
error | An optional error indicator. |
WFIO_DLL int wfio_peer_vdcntl | ( | wfio_peer_t * | peer, |
wfio_dcntl_t | cmd, | ||
int * | error, | ||
va_list | va | ||
) |
Perform device-independent I/O on this peer using a va_list.
peer | The peer to dcntl. |
cmd | The command to send to the peer. |
va | Additional arguments to the dcntl. |
WFIO_DLL int wfio_peer_vioctl | ( | wfio_peer_t * | peer, |
int | cmd, | ||
int * | error, | ||
va_list | va | ||
) |
Perform device-dependent I/O on this peer using a va_list.
peer | The peer to ioctl. |
cmd | The command to send to the peer. |
va | Additional arguments to the ioctl. |
WFIO_DLL size_t wfio_peer_write | ( | wfio_peer_t * | peer, |
const void * | buf, | ||
size_t | sz, | ||
size_t | elem, | ||
int * | error | ||
) |
Write elements to this peer.
peer | The peer to write to. |
buf | The buffer to write from. |
sz | The size of each element. |
elem | The number of elements to write. |
error | An optional error indicator. |
WFIO_ALWAYS_INLINE int wfio_peer_writeb | ( | wfio_peer_t * | peer, |
char | c, | ||
int * | error | ||
) |
Write a single byte to this peer.
peer | The peer to write to. |
c | The byte to write. |
error | An optional error indicator. |
WFIO_ALWAYS_INLINE size_t wfio_peer_writebV | ( | wfio_peer_t * | peer, |
const void * | buf, | ||
size_t | len, | ||
int * | error | ||
) |
Write bytes to this peer.
peer | The peer to write to. |
buf | The buffer to write from. |
len | The number of bytes to write. |
error | An optional error indicator. |