Wheefun I/O Library  0.0.5
Useful I/O Primitives.
Classes | Namespaces | Typedefs | Functions
bin.h File Reference

Binary Stream Objects. More...

#include <wfio/device.h>
#include <wfio/ieee754.h>

Go to the source code of this file.

Classes

struct  wfio_binstream_t
 A stream intended for binary output. More...
 
class  wfio::BinStream
 Wrap a wfio_binstream_t. More...
 

Namespaces

 wfio
 The root namespace for WFIO.
 

Typedefs

typedef WFIO_C_BEGIN struct wfio_binstream_t wfio_binstream_t
 A stream intended for binary output. More...
 

Functions

WFIO_DLL wfio_binstream_twfio_binstream_fromDeviceEx (struct wfio_device_t *device, wfio_endian_t endian, int *error)
 Create a new binstream with the specified device and endian. More...
 
WFIO_ALWAYS_INLINE wfio_binstream_twfio_binstream_fromDevice (struct wfio_device_t *device, int *error)
 Create a new binstream with the specified device. More...
 
WFIO_DLL_FASTCALL wfio_binstream_twfio_binstream_ioshare (wfio_binstream_t *bin, int ioshare)
 Share this bin with the supplied ioshare mode. More...
 
WFIO_DLL int wfio_binstream_acquire (wfio_binstream_t *bin)
 Share the supplied binstream. More...
 
WFIO_DLL void wfio_binstream_close (wfio_binstream_t *bin)
 Close the supplied binstream. More...
 
WFIO_DLL struct wfio_device_twfio_binstream_toDevice (wfio_binstream_t *bin)
 Wrap this binstream around a device. More...
 
WFIO_DLL_FASTCALL int wfio_binstream_flush (wfio_binstream_t *bin)
 Flush this binstream. More...
 
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. More...
 
WFIO_DLL_FASTCALL int wfio_binstream_canSeek (wfio_binstream_t *bin)
 Determine whether or not this binstream is capable of seeking. More...
 
WFIO_DLL_FASTCALL wfio_off_t wfio_binstream_tell (wfio_binstream_t *bin)
 Determine the current stream position of this binstream. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_dcntl (wfio_binstream_t *bin, wfio_dcntl_t cmd,...)
 Perform device-independent I/O control on this binstream. More...
 
WFIO_DLL int wfio_binstream_vioctl (wfio_binstream_t *bin, int cmd, va_list va)
 Perform device-dependent I/O control on this binstream. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_ioctl (wfio_binstream_t *bin, int cmd,...)
 Perform device-dependent I/O control on this binstream. More...
 
WFIO_DLL_FASTCALL size_t wfio_binstream_getbufsz (wfio_binstream_t *bin)
 Obtain the buffer size. More...
 
WFIO_DLL_FASTCALL size_t wfio_binstream_setbufsz (wfio_binstream_t *bin, size_t sz)
 Set the buffer size. More...
 
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. More...
 
WFIO_ALWAYS_INLINE size_t wfio_binstream_readbV (wfio_binstream_t *bin, void *buf, size_t len)
 Read bytes from the supplied binstream. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_readb (wfio_binstream_t *bin)
 Read a byte from the supplied binstream. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeb (wfio_binstream_t *bin, char c)
 Write a byte to the supplied binstream. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeSI16 (wfio_binstream_t *bin, wfio_sint16_t si16)
 Write a single 16-bit signed integer. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeUI16 (wfio_binstream_t *bin, wfio_uint16_t ui16)
 Write a single 16-bit unsigned integer. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeSI32 (wfio_binstream_t *bin, wfio_sint32_t si32)
 Write a single 32-bit signed integer. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeUI32 (wfio_binstream_t *bin, wfio_uint32_t ui32)
 Write a single 32-bit unsigned integer. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeSI64 (wfio_binstream_t *bin, wfio_sint64_t si64)
 Write a single 64-bit signed integer. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeUI64 (wfio_binstream_t *bin, wfio_uint64_t ui64)
 Write a single 64-bit unsigned integer. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeB32 (wfio_binstream_t *bin, wfio_flt32_t f32)
 Write a single 32-bit IEEE 754 binary float. More...
 
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. More...
 
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. More...
 
WFIO_ALWAYS_INLINE int wfio_binstream_writeB64 (wfio_binstream_t *bin, wfio_flt64_t f64)
 Write a single 64-bit IEEE 754 binary float. More...
 

Detailed Description

Binary Stream Objects.

Author
Phillip Kilgore
Since
0.0.1
Note
This file includes device.h
This file includes ieee754.h

Typedef Documentation

◆ wfio_binstream_t

A stream intended for binary output.

A binstream is a stream that is intended for working with files that have some sort of binary representation. This refines the device concept by adding a notion of stream endianness and integer writing functions.

A binstream may optionally be buffered. If the underlying peer is also buffered, then the binstream is in turn double-buffered. By default, a binstream is buffered on creation when the underlying stream is unbuffered.

Function Documentation

◆ wfio_binstream_acquire()

WFIO_DLL int wfio_binstream_acquire ( wfio_binstream_t bin)

Share the supplied binstream.

This function increases the reference count on bin to indicate that it has been shared. A successful call to wfio_binstream_acquire() should be followed by a corresponding call to wfio_binstream_close() to later release it.

Parameters
binThe binstream to share.
Returns
Nonzero if the device could be successfully acquired; otherwise, zero.
Warning
This function must eventually be followed by a call to wfio_binstream_close() or resources will leak.

◆ wfio_binstream_canSeek()

WFIO_DLL_FASTCALL int wfio_binstream_canSeek ( wfio_binstream_t bin)

Determine whether or not this binstream is capable of seeking.

Parameters
binThe binstream to interrogate.
Returns
Nonzero if this device can seek; otherwise, 0.

◆ wfio_binstream_close()

WFIO_DLL void wfio_binstream_close ( wfio_binstream_t bin)

Close the supplied binstream.

This function decrements the reference count on the binstream. If the reference count is then zero, the memory with the binstream is also freed and the underlying peer is closed.

Parameters
binThe binstream to close.

◆ wfio_binstream_dcntl()

WFIO_ALWAYS_INLINE int wfio_binstream_dcntl ( wfio_binstream_t bin,
wfio_dcntl_t  cmd,
  ... 
)

Perform device-independent I/O control on this binstream.

Parameters
devThe device to dcntl.
cmdThe command to send to the binstream.
...Additional arguments to the dcntl.

This function performs standardized I/O control on this device. If the command is not supported, then this device's ecode is set to WFIO_E_NOIMPL; otherwise, the command is performed according to its description in wfio_dcntl_t.

Returns
A return value peculiar to the command invoked.
Note
This method sets ecode.
It is not sufficient to look at the return value from this function to determine failure because the return value is dependent on the dcntl command. Instead, check he value of ecode; if the value is WFIO_E_SUCCESS, then no error has occurred.
If NULL is passed, zero shall be returned.

◆ wfio_binstream_flush()

WFIO_DLL_FASTCALL int wfio_binstream_flush ( wfio_binstream_t bin)

Flush this binstream.

This function commits any data which may be buffered to the peer, then flushes the peer.

Parameters
binThe binstream to flush.
Returns
Nonzero on success; otherwise, zero.

◆ wfio_binstream_fromDevice()

WFIO_ALWAYS_INLINE wfio_binstream_t* wfio_binstream_fromDevice ( struct wfio_device_t device,
int *  error 
)

Create a new binstream with the specified device.

This function creates a binstream in the host endianness. If successful, the device is acquired. It will also create a buffer for it if the device is not buffered.

Parameters
deviceThe device to underly this binstream.
errorAn optional error indicator.
Apointer to the binstream on success; otherwise, NULL.
Warning
This function must eventually be followed by a call to wfio_binstream_close() or resources will leak.

◆ wfio_binstream_fromDeviceEx()

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.

This function works like wfio_binstream_fromDevice(), but it also allows the endianness of the binstream to be specified.

Parameters
deviceThe peer to underly this binstream.
endianThe requested endianness of this binstream.
errorAn optional error indicator.
Apointer to the binstream on success; otherwise, NULL.
Warning
This function must eventually be followed by a call to wfio_binstream_close() or resources will leak.

◆ wfio_binstream_getbufsz()

WFIO_DLL_FASTCALL size_t wfio_binstream_getbufsz ( wfio_binstream_t bin)

Obtain the buffer size.

Parameters
binThe binstream to interrogate.
Returns
The size of the buffer associated with this binstream on success; otherwise, WFIO_NPOS. A return value of zero shall indicate that the bin is unbuffered.
Note
This method may set ecode.

◆ wfio_binstream_ioctl()

WFIO_ALWAYS_INLINE int wfio_binstream_ioctl ( wfio_binstream_t bin,
int  cmd,
  ... 
)

Perform device-dependent I/O control on this binstream.

This function performs operations peculiar to the device. The cmd parameter shall accept an integer command name which is specific to the device, but shall set WFIO_E_NOIMPL if the command is not recognized.

Parameters
binThe binstream to ioctl.
cmdThe command to send to the binstream.
...Additional arguments to the ioctl.
Returns
A return value peculiar to the command invoked.
Note
This method sets ecode.
It is not sufficient to look at the return value from this function to determine failure because the return value is dependent on the dcntl command. Instead, check he value of ecode; if the value is WFIO_E_SUCCESS, then no error has occurred.

◆ wfio_binstream_ioshare()

WFIO_DLL_FASTCALL wfio_binstream_t* wfio_binstream_ioshare ( wfio_binstream_t bin,
int  ioshare 
)

Share this bin with the supplied ioshare mode.

Parameters
binThe binstream to share.
ioshareThe ioshare mode.

This function allows for the device to be shared in the specified manner.

Returns
The shared instance of this binstream.
Warning
If WFIO_IOSHARE_O_ACQUIRE or WFIO_IOSHARE_DUP is specified, then the resulting binstream must be matched with a corresponding call to wfio_binstream_close() or resources will leak.

◆ wfio_binstream_read()

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.

Parameters
binThe binstream to read from.
bufThe buffer to read into.
szThe size of each element to read.
elemThe number of elements to read.
Note
This method may set ecode.

◆ wfio_binstream_readb()

WFIO_ALWAYS_INLINE int wfio_binstream_readb ( wfio_binstream_t bin)

Read a byte from the supplied binstream.

Parameters
binThe binstream to read from.
Note
This method may set ecode.

◆ wfio_binstream_readB32V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_readB64V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_readbV()

WFIO_ALWAYS_INLINE size_t wfio_binstream_readbV ( wfio_binstream_t bin,
void *  buf,
size_t  len 
)

Read bytes from the supplied binstream.

Parameters
binThe binstream to read from.
bufThe buffer to read into.
lenThe number of bytes to write.
Note
This method may set ecode.

◆ wfio_binstream_readSI16V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_readSI32V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_readSI64V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_readUI16V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_readUI32V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_readUI64V()

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.

Parameters
binThe stream to read from.
bufThe buffer to read into.
lenThe maximum number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_seek()

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.

This method attempts to seek the binstream to the specified position. This is only successful if the binstream is open and seekable.

Parameters
binThe binstream to seek.
offsetThe offset relative to whence to seek to.
whenceThe origin added to whence to seek to.
Returns
Nonzero on success; otherwise, zero.

◆ wfio_binstream_setbufsz()

WFIO_DLL_FASTCALL size_t wfio_binstream_setbufsz ( wfio_binstream_t bin,
size_t  sz 
)

Set the buffer size.

This function sets the size of the underlying buffer belonging to bin if it supports this behavior. The binstream 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.

Parameters
binThe binstream to set the buffer size for.
szThe requested size to set.
Returns
The size of the buffer after this operation; otherwise, WFIO_NPOS. A return value of zero shall indicate that peer is unbuffered.
Note
This method may set ecode.
When the buffer size is immutable or the device cannot be buffered, but is otherwise known, then the size of the buffer is returned.

◆ wfio_binstream_tell()

WFIO_DLL_FASTCALL wfio_off_t wfio_binstream_tell ( wfio_binstream_t bin)

Determine the current stream position of this binstream.

Parameters
binThe binstream to interrogate.
Returns
The current stream position of the peer on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_toDevice()

WFIO_DLL struct wfio_device_t* wfio_binstream_toDevice ( wfio_binstream_t bin)

Wrap this binstream around a device.

This function can be used to convert bin to a device, thereby rendering it suitable for . On success, the binstream will be acquired by the device and functions on the resulting device will be redirected to the binstream.

Parameters
binThe binstream to wrap.
Returns
A valid device on success; otherwise, NULL.
Warning
This function must eventually be followed by a call to wfio_device_close() or resources will leak.

◆ wfio_binstream_vdcntl()

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.

This function is like wfio_binstream_dcntl(), except it accepts a va_list instead of an elipsis.

Parameters
binThe binstream to ioctl.
cmdThe command to send to the binstream.
vaAdditional arguments to the ioctl.
Note
This method sets ecode.
It is not sufficient to look at the return value from this function to determine failure because the return value is dependent on the dcntl command. Instead, check he value of ecode; if the value is WFIO_E_SUCCESS, then no error has occurred.
If NULL is passed, zero shall be returned.

◆ wfio_binstream_vioctl()

WFIO_DLL int wfio_binstream_vioctl ( wfio_binstream_t bin,
int  cmd,
va_list  va 
)

Perform device-dependent I/O control on this binstream.

This function is like wfio_binstream_ioctl(), except it accepts a va_list instead of an elipsis.

Parameters
binThe binstream to ioctl.
cmdThe command to send to the binstream.
...Additional arguments to the ioctl.
Returns
A return value peculiar to the command invoked.
Note
This method sets ecode.
It is not sufficient to look at the return value from this function to determine failure because the return value is dependent on the dcntl command. Instead, check he value of ecode; if the value is WFIO_E_SUCCESS, then no error has occurred.

◆ wfio_binstream_write()

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.

Parameters
binThe binstream to write to.
bufThe buffer to write from.
szThe size of each elements.
elemThe maximum number of elements to write.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeb()

WFIO_ALWAYS_INLINE int wfio_binstream_writeb ( wfio_binstream_t bin,
char  c 
)

Write a byte to the supplied binstream.

Parameters
binThe binstream to write to.
cThe byte to write.
Returns
Nonzero if the byte was written; otherwise, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeB32()

WFIO_ALWAYS_INLINE int wfio_binstream_writeB32 ( wfio_binstream_t bin,
wfio_flt32_t  f32 
)

Write a single 32-bit IEEE 754 binary float.

Parameters
binThe stream to write to.
ui64The float to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeB32V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeB64()

WFIO_ALWAYS_INLINE int wfio_binstream_writeB64 ( wfio_binstream_t bin,
wfio_flt64_t  f64 
)

Write a single 64-bit IEEE 754 binary float.

Parameters
binThe stream to write to.
ui64The float to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeB64V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writebV()

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.

Parameters
binThe binstream to write to.
bufThe buffer to write from.
lenThe maximum number of bytes to write.
Returns
The number of bytes actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeSI16()

WFIO_ALWAYS_INLINE int wfio_binstream_writeSI16 ( wfio_binstream_t bin,
wfio_sint16_t  si16 
)

Write a single 16-bit signed integer.

Parameters
binThe stream to write to.
si16The integer to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeSI16V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeSI32()

WFIO_ALWAYS_INLINE int wfio_binstream_writeSI32 ( wfio_binstream_t bin,
wfio_sint32_t  si32 
)

Write a single 32-bit signed integer.

Parameters
binThe stream to write to.
si32The integer to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeSI32V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeSI64()

WFIO_ALWAYS_INLINE int wfio_binstream_writeSI64 ( wfio_binstream_t bin,
wfio_sint64_t  si64 
)

Write a single 64-bit signed integer.

Parameters
binThe stream to write to.
si64The integer to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeSI64V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeUI16()

WFIO_ALWAYS_INLINE int wfio_binstream_writeUI16 ( wfio_binstream_t bin,
wfio_uint16_t  ui16 
)

Write a single 16-bit unsigned integer.

Parameters
binThe stream to write to.
ui16The integer to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeUI16V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeUI32()

WFIO_ALWAYS_INLINE int wfio_binstream_writeUI32 ( wfio_binstream_t bin,
wfio_uint32_t  ui32 
)

Write a single 32-bit unsigned integer.

Parameters
binThe stream to write to.
ui32The integer to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeUI32V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.

◆ wfio_binstream_writeUI64()

WFIO_ALWAYS_INLINE int wfio_binstream_writeUI64 ( wfio_binstream_t bin,
wfio_uint64_t  ui64 
)

Write a single 64-bit unsigned integer.

Parameters
binThe stream to write to.
ui64The integer to write.
Returns
Nonzero on success; otherwiser, zero.
Note
This method may set ecode.

◆ wfio_binstream_writeUI64V()

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.

Parameters
binThe stream to write to.
bufThe buffer to write from.
lenThe maximum number of elements to read.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.
Note
This method may set ecode.