169 size_t sz,
size_t elem,
int* error);
182 size_t len,
int* error) {
214 size_t sz,
size_t elem,
int* error);
227 const void* buf,
size_t len,
int* error) {
430 inline Peer() : m_type(UNKNOWN), m_impl(NULL) {}
438 inline Peer(CType& ctype,
int* error = 0) :
465 inline Peer(CType* ctype,
int* error = 0) {
548 reinterpret_cast<CType*>(
this));
573 inline size_t read(
void* buf,
size_t sz,
size_t elem,
574 int* error = 0) throw() {
576 reinterpret_cast<CType*>(
this), buf,
590 size_t read(
void* buf,
size_t len,
int* error)
throw() {
591 return read(buf, 1, len, error);
603 if (!read(&c, 1, 1, error) ==
WFIO_NPOS) {
620 size_t write(
const void* buf,
size_t sz,
size_t elem,
623 reinterpret_cast<CType*>(
this), buf, sz,
638 size_t write(
const void* buf,
size_t len,
int* error = 0) {
639 return write(buf, 1, len, error);
651 return write(&c, 1, 1, error) == 1;
722 size_t bufsz(
int* error = 0)
const throw() {
740 size_t bufsz(
size_t sz,
int* error = 0) throw() {
758 reinterpret_cast<CType*>(
this),
775 reinterpret_cast<CType*>(
this),
791 ret = this->vdcntl(cmd, va);
810 ret = this->vdcntlEx(error, cmd, va);
826 reinterpret_cast<CType*>(
this),
843 reinterpret_cast<CType*>(
this),
859 ret = this->vioctl(cmd, va);
878 ret = this->vioctlEx(error, cmd, va);
889 return reinterpret_cast<CType*
>(
this);
912 return this->toDevice(NULL);
935 return this->toBinStream(NULL);
The root namespace for WFIO.
Definition: bin.h:879
int vdcntl(DCntl cmd, va_list va)
Perform device-independent I/O on this peer using a va_list.
Definition: peer.h:756
Peer(CType &ctype, int *error=0)
Construct a peer from a CType.
Definition: peer.h:438
~Peer()
Definition: peer.h:546
bool flush(int *error=0)
Attempt to flush this Peer.
Definition: peer.h:707
A command to be supplied to a device or similar stream.
Definition: iotype.h:334
Peer(Device &device, IOShare share, int *error=0)
Construct a Peer from a Device using the specified IO sharing mode.
Definition: peer.h:508
WFIO_ALWAYS_INLINE int wfio_peer_readb(wfio_peer_t *peer, int *error)
Read a single byte from this peer.
Definition: peer.h:194
Wrap a wfio_binstream_t.
Definition: bin.h:883
#define WFIO_DLL
Mark the symbol as an element of the library.
Definition: host.h:397
WFIO_C_BEGIN typedef long int wfio_off_t
An integer corresponding to a device offset.
Definition: iotype.h:48
#define WFIO_C_BEGIN
Definition: host.h:477
#define WFIO_DLL_FASTCALL
Shorthand for WFIO_DLL WFIO_FASTCALL.
Definition: host.h:425
WFIO_DLL_FASTCALL int wfio_peer_canSeek(wfio_peer_t *peer)
Determine whether or not this peer can seek.
A generic stream encapsulation.
Definition: peer.h:44
Peer(CType *ctype, int *error=0)
Construct a peer from a CType pointer.
Definition: peer.h:465
Peer(BinStream &bin, int *error=0)
Construct a Peer from a BinsStream.
Definition: peer.h:521
void *const any
Definition: peer.h:54
Type type() const
Obtain the type of this Peer.
Definition: peer.h:556
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.
int dcntl(int *error, DCntl cmd,...)
Perform device-independent I/O on this Peer, capturing any errors in error.
Definition: peer.h:806
int write(char c, int *error=0)
Write a single byte to this peer.
Definition: peer.h:650
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.
size_t read(void *buf, size_t len, int *error)
Read bytes from this Peer.
Definition: peer.h:590
int ioctl(int cmd,...)
Perform device-dependent I/O on this Peer.
Definition: peer.h:855
WFIO_DLL_FASTCALL wfio_off_t wfio_peer_tell(wfio_peer_t *peer, int *error)
Determine the current stream position of this peer.
const wfio_peer_type_t type
The type of this peer.
Definition: peer.h:48
#define WFIO_ALWAYS_INLINE
Mark this symbol to be forced inline.
Definition: host.h:447
bool seek(off_t offset, wfio_whence_t whence, int *error=0)
Seek to a position in the stream.
Definition: peer.h:669
wfio_whence_t
The type corresponding to the point of reference in a seek operation.
Definition: iotype.h:60
wfio_peer_type_t
The type associated with a peer.
Definition: iotype.h:127
Peer(Device &device, int *error=0)
Construct a peer from a Device.
Definition: peer.h:494
size_t read(void *buf, size_t sz, size_t elem, int *error=0)
Read elements from this Peer.
Definition: peer.h:573
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.
Definition: peer.h:226
An IO sharing mode.
Definition: iotype.h:253
struct wfio_binstream_t *const bin
Definition: peer.h:58
WFIO_DLL int wfio_peer_acquire(wfio_peer_t *peer, int *error)
Share this peer.
Type
A type specification for a peer.
Definition: peer.h:407
WFIO_DLL size_t wfio_peer_setbufsz(wfio_peer_t *peer, size_t sz, int *error)
Set the buffer size.
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.
WFIO_ALWAYS_INLINE int wfio_peer_fromBinstream(wfio_peer_t *peer, struct wfio_binstream_t *bin, int *error)
Initialize a peer using a binstream.
Definition: peer.h:113
Peer(CType *ctype, IOShare share, int *error=0)
Construct a peer from a CType pointer using the specified IO sharing mode.
Definition: peer.h:481
wfio_dcntl_t
A command to be supplied to a device or similar stream.
Definition: iotype.h:175
Peer(CType &ctype, IOShare share, int *error=0)
Construct a peer from a CType using the specified IO sharing mode.
Definition: peer.h:452
A C++ wrapper for a wfio_device_t.
Definition: device.h:783
size_t bufsz(size_t sz, int *error=0)
Set the buffer size for this Peer.
Definition: peer.h:740
int vioctlEx(int *error, int cmd, va_list va)
Perform device-dependent I/O on this peer using a va_list, capturing any errors in error...
Definition: peer.h:840
union wfio_peer_t::@20 impl
The implementaton for this peer.
Peer(BinStream &bin, IOShare share, int *error=0)
Construct a Peer from a BinsStream using the specified IO sharing mode.
Definition: peer.h:535
A stream intended for binary output.
Definition: bin.h:54
struct wfio_device_t *const device
Definition: peer.h:56
A constant indicating no position.
Definition: iotype.h:226
int dcntl(DCntl cmd,...)
Perform device-independent I/O on this Peer.
Definition: peer.h:787
int ioctlExt(int *error, int cmd,...)
Perform device-dependent I/O on this Peer, capturing any errors in error.
Definition: peer.h:874
size_t write(const void *buf, size_t sz, size_t elem, int *error=0)
Write elements to this Peer.
Definition: peer.h:620
#define WFIO_C_END
Definition: host.h:485
A simple, byte-oriented channel.
Definition: device.h:164
int wfio_ioshare_t
An I/O sharing mode.
Definition: iotype.h:167
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.
An IOShare mode indicating that the stream is acquired.
Definition: iotype.h:148
WFIO_ALWAYS_INLINE int wfio_peer_writeb(wfio_peer_t *peer, char c, int *error)
Write a single byte to this peer.
Definition: peer.h:240
WFIO_DLL_FASTCALL size_t wfio_peer_getbufsz(wfio_peer_t *peer, int *error)
Obtain the buffer size.
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.
WFIO_ALWAYS_INLINE int wfio_peer_ioctl(wfio_peer_t *peer, int *error, int cmd,...)
Perform device-dependent I/O on this peer.
Definition: peer.h:297
::wfio_peer_t CType
The C type from which a Peer is derived.
Definition: peer.h:402
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.
off_t tell(int *error=0)
Determine the current stream position of this peer.
Definition: peer.h:694
int vioctl(int cmd, va_list va)
Perform device-dependent I/O on this peer using a va_list.
Definition: peer.h:824
Peer()
Construct the default Peer.
Definition: peer.h:430
WFIO_ALWAYS_INLINE int wfio_peer_fromDevice(wfio_peer_t *peer, struct wfio_device_t *device, int *error)
Initialize a peer using a device.
Definition: peer.h:84
WFIO_C_BEGIN struct wfio_peer_t wfio_peer_t
A generic stream encapsulation.
WFIO_DLL void wfio_peer_close(wfio_peer_t *peer)
Release this peer.
bool canSeek() const
Determine whether or not this Peer can seek.
Definition: peer.h:680
int read(int *error=0)
Read a single byte from this peer.
Definition: peer.h:601
size_t bufsz(int *error=0) const
Obtain the buffer size for this Peer.
Definition: peer.h:722
::wfio_off_t off_t
An integer corresponding to a device offset.
Definition: iotype.h:234
WFIO_ALWAYS_INLINE size_t wfio_peer_readbV(wfio_peer_t *peer, void *buf, size_t len, int *error)
Read bytes from this peer.
Definition: peer.h:181
WFIO_DLL_FASTCALL int wfio_peer_flush(wfio_peer_t *peer, int *error)
Determine the current stream position of this peer.
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.
size_t write(const void *buf, size_t len, int *error=0)
Write bytes to this peer.
Definition: peer.h:638
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.
Definition: peer.h:266
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.
int vdcntlEx(int *error, DCntl cmd, va_list va)
Perform device-independent I/O on this peer using a va_list, capturing any errors in error...
Definition: peer.h:772