58 const size_t refcount;
334 int cmd, va_list va);
418 size_t sz,
size_t elem);
430 void* buf,
size_t len) {
463 const void* buf,
size_t sz,
size_t elem);
478 const void* buf,
size_t len) {
512 wfio_sint16_t* buf,
size_t len);
527 const wfio_sint16_t* buf,
size_t len);
540 wfio_sint16_t si16) {
557 wfio_uint16_t* buf,
size_t len) {
574 const wfio_uint16_t* buf,
size_t len) {
590 wfio_uint16_t ui16) {
607 wfio_sint32_t* buf,
size_t len);
622 const wfio_sint32_t* buf,
size_t len);
635 wfio_sint32_t si32) {
652 wfio_uint32_t* buf,
size_t len) {
669 const wfio_uint32_t* buf,
size_t len) {
685 wfio_uint32_t ui32) {
702 wfio_sint64_t* buf,
size_t len);
717 const wfio_sint64_t* buf,
size_t len);
730 wfio_sint64_t si64) {
747 wfio_uint64_t* buf,
size_t len) {
764 const wfio_uint64_t* buf,
size_t len) {
780 wfio_uint64_t ui64) {
914 bool acquire =
true) : m_bin(bin) {
953 return m_bin->endian;
958 m_bin->endian = endian;
961 endian_t floatEndian()
const throw() {
962 return m_bin->floatEndian;
967 m_bin->floatEndian = endian;
982 inline size_t read(
void* buf,
size_t sz,
size_t elem) {
994 inline size_t read(
void* buf,
size_t len) {
1015 inline size_t write(
const void* buf,
size_t sz,
1030 inline size_t write(
const void* buf,
size_t len) {
1477 return m_bin ? m_bin->ecode : 1;
1488 m_bin->ecode = ecode;
1501 return m_bin != NULL;
1509 inline operator bool()
const throw() {
1510 return m_bin != NULL;
bool writeUI32(uint32_t ui32)
Write a single 32-bit unsigned integer.
Definition: bin.h:1194
The root namespace for WFIO.
Definition: bin.h:879
WFIO_DLL size_t wfio_binstream_writeB64V(wfio_binstream_t *bin, const wfio_flt64_t *buf, size_t len)
Write a vector of 64-bit IEEE 754 binary floats.
size_t writeUI16V(const uint16_t *buf, size_t len)
Write a vector of 16-bit unsigned integers.
Definition: bin.h:1107
WFIO_ALWAYS_INLINE size_t wfio_binstream_readbV(wfio_binstream_t *bin, void *buf, size_t len)
Read bytes from the supplied binstream.
Definition: bin.h:429
::wfio_uint32_t uint32_t
Definition: integer.h:128
WFIO_DLL size_t wfio_binstream_writeSI16V(wfio_binstream_t *bin, const wfio_sint16_t *buf, size_t len)
Write a vector of 16-bit signed integers.
::wfio_binstream_t CType
The C type from which a BinStream is derived.
Definition: bin.h:891
Wrap a wfio_binstream_t.
Definition: bin.h:883
WFIO_DLL size_t wfio_binstream_readSI64V(wfio_binstream_t *bin, wfio_sint64_t *buf, size_t len)
Read a vector of 64-bit signed integers.
WFIO_DLL size_t wfio_binstream_writeSI32V(wfio_binstream_t *bin, const wfio_sint32_t *buf, size_t len)
Write a vector of 32-bit signed integers.
size_t writeB32V(const wfio_flt32_t *buf, size_t len)
Write a vector of 32-bit IEEE 754 binary floats.
Definition: bin.h:1305
#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
bool writeSI16(wfio_sint16_t si16)
Write a single 16-bit signed integer.
Definition: bin.h:1081
WFIO_DLL_FASTCALL wfio_binstream_t * wfio_binstream_ioshare(wfio_binstream_t *bin, int ioshare)
Share this bin with the supplied ioshare mode.
#define WFIO_DLL_FASTCALL
Shorthand for WFIO_DLL WFIO_FASTCALL.
Definition: host.h:425
size_t writeSI32V(const sint32_t *buf, size_t len)
Write a vector of 32-bit signed integers.
Definition: bin.h:1146
size_t read(void *buf, size_t len)
Read bytes from this BinStream.
Definition: bin.h:994
WFIO_DLL int wfio_binstream_acquire(wfio_binstream_t *bin)
Share the supplied binstream.
WFIO_DLL int wfio_binstream_seek(wfio_binstream_t *bin, wfio_off_t offset, wfio_whence_t whence)
Seek to a position in the stream.
A generic stream encapsulation.
Definition: peer.h:44
bool writeB32(wfio_flt32_t f32)
Write a single 32-bit IEEE 754 binary float.
Definition: bin.h:1319
size_t bufSz(size_t sz)
Set the buffer size for this BinStream.
Definition: bin.h:1402
WFIO_ALWAYS_INLINE int wfio_binstream_dcntl(wfio_binstream_t *bin, wfio_dcntl_t cmd,...)
Perform device-independent I/O control on this binstream.
Definition: bin.h:304
WFIO_ALWAYS_INLINE int wfio_binstream_writeSI32(wfio_binstream_t *bin, wfio_sint32_t si32)
Write a single 32-bit signed integer.
Definition: bin.h:634
WFIO_DLL int wfio_binstream_vdcntl(wfio_binstream_t *bin, wfio_dcntl_t cmd, va_list va)
Perform device-independent I/O control on this binstream using a va_list.
WFIO_DLL size_t wfio_binstream_write(struct wfio_binstream_t *bin, const void *buf, size_t sz, size_t elem)
Write elements to the supplied binstream.
bool writeSI32(sint32_t si32)
Write a single 32-bit signed integer.
Definition: bin.h:1157
bool writeUI64(uint64_t ui64)
Write a single 64-bit unsigned integer.
Definition: bin.h:1272
WFIO_DLL_FASTCALL int wfio_binstream_canSeek(wfio_binstream_t *bin)
Determine whether or not this binstream is capable of seeking.
int vdcntl(wfio_dcntl_t cmd, va_list va)
Perform device-independent I/O control on this binstream using a va_list.
Definition: bin.h:1416
#define WFIO_ALWAYS_INLINE
Mark this symbol to be forced inline.
Definition: host.h:447
size_t readB64V(wfio_flt64_t *buf, size_t len)
Read a vector of 64-bit IEEE 754 binary floats.
Definition: bin.h:1334
wfio_whence_t
The type corresponding to the point of reference in a seek operation.
Definition: iotype.h:60
::wfio_uint16_t uint16_t
Definition: integer.h:122
WFIO_ALWAYS_INLINE size_t wfio_binstream_writeUI32V(wfio_binstream_t *bin, const wfio_uint32_t *buf, size_t len)
Write a vector of 32-bit unsigned integers.
Definition: bin.h:668
size_t writeUI64V(const uint64_t *buf, size_t len)
Write a vector of 64-bit unsigned integers.
Definition: bin.h:1260
WFIO_DLL size_t wfio_binstream_readSI16V(wfio_binstream_t *bin, wfio_sint16_t *buf, size_t len)
Read a vector of 16-bit signed integers.
WFIO_ALWAYS_INLINE size_t wfio_binstream_readUI32V(wfio_binstream_t *bin, wfio_uint32_t *buf, size_t len)
Read a vector of 32-bit unsigned integers.
Definition: bin.h:651
bool write(char c)
Write a byte to the this BinStream.
Definition: bin.h:1042
::wfio_uint64_t uint64_t
Definition: integer.h:134
::wfio_sint32_t sint32_t
Definition: integer.h:125
WFIO_DLL size_t wfio_binstream_readSI32V(wfio_binstream_t *bin, wfio_sint32_t *buf, size_t len)
Read a vector of 32-bit signed integers.
WFIO_ALWAYS_INLINE int wfio_binstream_writeSI16(wfio_binstream_t *bin, wfio_sint16_t si16)
Write a single 16-bit signed integer.
Definition: bin.h:539
size_t readSI64V(sint64_t *buf, size_t len)
Read a vector of 64-bit signed integers.
Definition: bin.h:1207
WFIO_DLL size_t wfio_binstream_read(wfio_binstream_t *bin, void *buf, size_t sz, size_t elem)
Read elements from the supplied binstream.
WFIO_ALWAYS_INLINE int wfio_binstream_ioctl(wfio_binstream_t *bin, int cmd,...)
Perform device-dependent I/O control on this binstream.
Definition: bin.h:357
IEEE754 floating point manipulation.
wfio_dcntl_t
A command to be supplied to a device or similar stream.
Definition: iotype.h:175
WFIO_DLL size_t wfio_binstream_readB64V(wfio_binstream_t *bin, wfio_flt64_t *buf, size_t len)
Read a vector of 64-bit IEEE 754 binary floats.
WFIO_DLL size_t wfio_binstream_readB32V(wfio_binstream_t *bin, wfio_flt32_t *buf, size_t len)
Read a vector of 32-bit IEEE 754 binary floats.
size_t writeUI32V(const uint32_t *buf, size_t len)
Write a vector of 32-bit unsigned integers.
Definition: bin.h:1183
size_t writeB64V(const wfio_flt64_t *buf, size_t len)
Write a vector of 64-bit IEEE 754 binary floats.
Definition: bin.h:1349
A C++ wrapper for a wfio_device_t.
Definition: device.h:783
WFIO_DLL_FASTCALL size_t wfio_binstream_setbufsz(wfio_binstream_t *bin, size_t sz)
Set the buffer size.
WFIO_ALWAYS_INLINE int wfio_binstream_readb(wfio_binstream_t *bin)
Read a byte from the supplied binstream.
Definition: bin.h:441
int ecode() const
Obtain the error code associated with this BinStream.
Definition: bin.h:1476
size_t readB32V(wfio_flt32_t *buf, size_t len)
Read a vector of 32-bit IEEE 754 binary floats.
Definition: bin.h:1290
WFIO_ALWAYS_INLINE int wfio_binstream_writeB64(wfio_binstream_t *bin, wfio_flt64_t f64)
Write a single 64-bit IEEE 754 binary float.
Definition: bin.h:871
WFIO_DLL_FASTCALL size_t wfio_binstream_getbufsz(wfio_binstream_t *bin)
Obtain the buffer size.
size_t readUI32V(uint32_t *buf, size_t len)
Read a vector of 32-bit unsigned integers.
Definition: bin.h:1170
WFIO_ALWAYS_INLINE size_t wfio_binstream_writebV(wfio_binstream_t *bin, const void *buf, size_t len)
Write a byte vector to the supplied binstream.
Definition: bin.h:477
A stream intended for binary output.
Definition: bin.h:54
size_t readSI16V(sint16_t *buf, size_t len)
Read a vector of 16-bit signed integers.
Definition: bin.h:1057
WFIO_ALWAYS_INLINE int wfio_binstream_writeUI16(wfio_binstream_t *bin, wfio_uint16_t ui16)
Write a single 16-bit unsigned integer.
Definition: bin.h:589
::wfio_sint16_t sint16_t
Definition: integer.h:119
size_t write(const void *buf, size_t len)
Write a byte vector to this BinStream.
Definition: bin.h:1030
A constant indicating no position.
Definition: iotype.h:226
size_t readUI16V(uint16_t *buf, size_t len)
Read a vector of 16-bit unsigned integers.
Definition: bin.h:1094
size_t read(void *buf, size_t sz, size_t elem)
Read elements from this BinStream.
Definition: bin.h:982
WFIO_ALWAYS_INLINE size_t wfio_binstream_readUI64V(wfio_binstream_t *bin, wfio_uint64_t *buf, size_t len)
Read a vector of 64-bit unsigned integers.
Definition: bin.h:746
BinStream(Device &dev, int *error=NULL)
Construct a BinStream by supplying a Device.
Definition: bin.h:936
WFIO_ALWAYS_INLINE int wfio_binstream_writeSI64(wfio_binstream_t *bin, wfio_sint64_t si64)
Write a single 64-bit signed integer.
Definition: bin.h:729
#define WFIO_C_END
Definition: host.h:485
A simple, byte-oriented channel.
Definition: device.h:164
WFIO_ALWAYS_INLINE size_t wfio_binstream_writeUI16V(wfio_binstream_t *bin, const wfio_uint16_t *buf, size_t len)
Write a vector of 16-bit unsigned integers.
Definition: bin.h:573
bool valid() const
Determine if this BinStream is valid.
Definition: bin.h:1500
bool writeUI16(uint16_t ui16)
Write a single 16-bit unsigned integer.
Definition: bin.h:1118
~BinStream()
Release this BinStream.
Definition: bin.h:946
WFIO_DLL size_t wfio_binstream_writeSI64V(wfio_binstream_t *bin, const wfio_sint64_t *buf, size_t len)
Write a vector of 64-bit signed integers.
WFIO_DLL wfio_binstream_t * wfio_binstream_fromDeviceEx(struct wfio_device_t *device, wfio_endian_t endian, int *error)
Create a new binstream with the specified device and endian.
int vioctl(int cmd, va_list va)
Perform device-dependent I/O control on this binstream.
Definition: bin.h:1447
BinStream(const BinStream &bin)
Copy-construct a BinStream.
Definition: bin.h:925
WFIO_ALWAYS_INLINE int wfio_binstream_writeUI32(wfio_binstream_t *bin, wfio_uint32_t ui32)
Write a single 32-bit unsigned integer.
Definition: bin.h:684
size_t bufSz() const
Obtain the buffer size for this BinStream.
Definition: bin.h:1385
WFIO_ALWAYS_INLINE int wfio_binstream_writeUI64(wfio_binstream_t *bin, wfio_uint64_t ui64)
Write a single 64-bit unsigned integer.
Definition: bin.h:779
WFIO_DLL_FASTCALL int wfio_binstream_flush(wfio_binstream_t *bin)
Flush this binstream.
bool flush()
Attempt to flush this BinStream.
Definition: bin.h:1374
wfio_endian_t
A categorization of the byte-order of multibyte integers.
Definition: misctype.h:61
WFIO_DLL void wfio_binstream_close(wfio_binstream_t *bin)
Close the supplied binstream.
WFIO_DLL_FASTCALL wfio_off_t wfio_binstream_tell(wfio_binstream_t *bin)
Determine the current stream position of this binstream.
The endianness of this system.
Definition: misctype.h:173
BinStream(::wfio_binstream_t *bin, bool acquire=true)
Wrap a wfio_binstream_t.
Definition: bin.h:913
int ioctl(wfio_binstream_t *bin, int cmd,...)
Perform device-dependent I/O control on this binstream.
Definition: bin.h:1460
size_t write(const void *buf, size_t sz, size_t elem)
Write elements to this BinStream.
Definition: bin.h:1015
::wfio_sint64_t sint64_t
Definition: integer.h:131
WFIO_C_BEGIN struct wfio_binstream_t wfio_binstream_t
A stream intended for binary output.
WFIO_DLL int wfio_binstream_vioctl(wfio_binstream_t *bin, int cmd, va_list va)
Perform device-dependent I/O control on this binstream.
WFIO_ALWAYS_INLINE int wfio_binstream_writeb(wfio_binstream_t *bin, char c)
Write a byte to the supplied binstream.
Definition: bin.h:492
int dcntl(wfio_dcntl_t cmd,...)
Perform device-independent I/O control on this binstream.
Definition: bin.h:1429
WFIO_DLL size_t wfio_binstream_writeB32V(wfio_binstream_t *bin, const wfio_flt32_t *buf, size_t len)
Write a vector of 32-bit IEEE 754 binary floats.
size_t writeSI64V(const sint64_t *buf, size_t len)
Write a vector of 64-bit signed integers.
Definition: bin.h:1222
bool writeSI64(sint64_t si64)
Write a single 64-bit signed integer.
Definition: bin.h:1234
size_t readUI64V(uint64_t *buf, size_t len)
Read a vector of 64-bit unsigned integers.
Definition: bin.h:1247
bool writeB64(wfio_flt64_t f64)
Write a single 64-bit IEEE 754 binary float.
Definition: bin.h:1363
WFIO_ALWAYS_INLINE size_t wfio_binstream_readUI16V(wfio_binstream_t *bin, wfio_uint16_t *buf, size_t len)
Read a vector of 16-bit unsigned integers.
Definition: bin.h:556
void ecode(int ecode)
Set the error code associated with this BinStream.
Definition: bin.h:1486
BinStream()
Construct the default BinStream.
Definition: bin.h:900
A structure indicating no definition.
Definition: misctype.h:47
size_t readSI32V(sint32_t *buf, size_t len)
Read a vector of 32-bit signed integers.
Definition: bin.h:1133
WFIO_ALWAYS_INLINE int wfio_binstream_writeB32(wfio_binstream_t *bin, wfio_flt32_t f32)
Write a single 32-bit IEEE 754 binary float.
Definition: bin.h:826
WFIO_ALWAYS_INLINE wfio_binstream_t * wfio_binstream_fromDevice(struct wfio_device_t *device, int *error)
Create a new binstream with the specified device.
Definition: bin.h:137
size_t writeSI16V(const sint16_t *buf, size_t len)
Write a vector of 16-bit signed integers.
Definition: bin.h:1070
WFIO_DLL struct wfio_device_t * wfio_binstream_toDevice(wfio_binstream_t *bin)
Wrap this binstream around a device.
int read()
Read a byte from the supplied binstream.
Definition: bin.h:1001
WFIO_ALWAYS_INLINE size_t wfio_binstream_writeUI64V(wfio_binstream_t *bin, const wfio_uint64_t *buf, size_t len)
Write a vector of 64-bit unsigned integers.
Definition: bin.h:763