Wheefun I/O Library
0.0.5
Useful I/O Primitives.
|
A C++ wrapper for a wfio_device_t. More...
#include <device.h>
Classes | |
class | CXXStrategy |
A strategy for a device. More... | |
Public Types | |
typedef ::wfio_device_t * | CType |
The C type from which a Device is derived. | |
Public Member Functions | |
Device () | |
Construct the default Device. More... | |
Device (CType dev, bool acquire=true) | |
Wrap a wfio_device_t. More... | |
Device (CType dev, IOShare ioshare) | |
Wrap a wfio:device_t using an IOShare. More... | |
WFIO_CXX_DLL | Device (CXXStrategy *strategy) |
Create a new Device from a CXXStrategy. More... | |
Device (const Device &dev) | |
Copy-construct a device. More... | |
~Device () | |
Release this Device. More... | |
size_t | read (void *buf, size_t sz, size_t elem) |
Write elements to this Device. More... | |
size_t | read (void *buf, size_t len) |
Write a vector of bytes to this Device. More... | |
int | read () |
Read a single byte from this Device. More... | |
size_t | write (const void *buf, size_t sz, size_t elem) |
Write a vector of elements to this Device. More... | |
size_t | write (const void *buf, size_t len) |
Write a vector of bytes to this Device. More... | |
bool | write (char c) |
Write a single byte to this Device. More... | |
bool | seek (wfio_off_t offset, wfio_whence_t whence) |
Seek to a position in this Device. More... | |
wfio_off_t | tell () const |
Determine the current stream position of this Device. More... | |
Device | dup () |
Duplicate this Device. More... | |
bool | flush () |
Attempt to flush this Device. More... | |
size_t | bufsz (size_t len) |
Set the buffer size for this Device. More... | |
size_t | bufsz () const |
Obtain the buffer size for this Device. More... | |
bool | buffered () const |
Determine whether or not the device is buffered. More... | |
int | dcntl (::wfio_dcntl_t cmd,...) |
Perform device-independent I/O control on this Device. More... | |
int | ioctl (int cmd,...) |
Perform device-dependent I/O control on this Device. More... | |
int | flags () const throw () |
Obtain the flags vector associated with this Device. | |
int | ecode () const throw () |
Obtain the error code associated with this Device. | |
void | ecode (int ecode) throw () |
Set the error code associated with this Device. More... | |
bool | valid () const throw () |
Determine if this Device is valid. More... | |
operator bool () const throw () | |
Synonymous with this->valid(). More... | |
operator::wfio_device_t * () throw () | |
Implicitly convert this Device into it's C equivalent. | |
WFIO_CXX_DLL Device & | operator= (const Device &rhs) |
Perform assignment on this Device. More... | |
A C++ wrapper for a wfio_device_t.
|
inline |
|
inline |
Wrap a wfio_device_t.
dev | The device to wrap. |
acquire | Whether or not the device should be acquired as a consequence of constructing this object. |
dev
from the context in which it is called, then acquire
should be false
. Wrap a wfio:device_t using an IOShare.
dev | The device to wrap. |
ioshare | The sharing mode to use. |
WFIO_CXX_DLL wfio::Device::Device | ( | CXXStrategy * | strategy | ) |
Create a new Device from a CXXStrategy.
strategy | The CXXStrategy used to implement this device. |
This constructor accepts a CXXStrategy and wraps it around an appropriate CType, which takes direct ownership of the CType. This device therefore indirectly owns strategy
.
|
inline |
Copy-construct a device.
Thie constructor acquires the underlying CType and sets it as this Device's underyling CType.
|
inline |
|
inline |
Determine whether or not the device is buffered.
|
inline |
Set the buffer size for this Device.
sz | The requested size to set. |
|
inline |
Obtain the buffer size for this Device.
|
inline |
Perform device-independent I/O control on this Device.
cmd | The command to send to the device. |
... | Additional arguments to the dcntl. |
|
inline |
|
inline |
Set the error code associated with this Device.
ecode | the new error code to set. |
|
inline |
Attempt to flush this Device.
|
inline |
Perform device-dependent I/O control on this Device.
dev | The device to ioctl. |
cmd | The command to send to the device. |
... | Additional arguments to the ioctl. |
|
inline |
Synonymous with this->valid().
|
inline |
Write elements to this Device.
buf | The buffer to write from. |
sz | The size of each elements. |
sz | The maximum number of elements to write. |
ecode
.
|
inline |
Write a vector of bytes to this Device.
buf | The buffer to write from. |
len | The maximum number of bytes to write. |
|
inline |
Read a single byte from this Device.
|
inline |
Seek to a position in this Device.
offset | The offset relative to whence to seek to. |
whence | The origin added to whence to seek to. |
|
inline |
Determine the current stream position of this Device.
|
inline |
|
inline |
Write a vector of elements to this Device.
buf | The buffer to write from. |
sz | The size of each elements. |
elem | The maximum number of elements to write. |
ecode
.
|
inline |
Write a vector of bytes to this Device.
buf | The buffer to write from. |
len | The maximum number of bytes to write. |
ecode
.
|
inline |
Write a single byte to this Device.
c | The byte to write. |
ecode
.