Wheefun I/O Library  0.0.5
Useful I/O Primitives.
Public Member Functions | List of all members
wfio::FDDevice Class Reference

A Device wrapping a file descriptor. More...

#include <fd.h>

Inheritance diagram for wfio::FDDevice:
Inheritance graph
[legend]
Collaboration diagram for wfio::FDDevice:
Collaboration graph
[legend]

Public Member Functions

 FDDevice (wfio_fd_t fd, int *error=NULL)
 Construct a new FDDevice from a file descriptor. More...
 
- Public Member Functions inherited from wfio::Device
 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 Deviceoperator= (const Device &rhs)
 Perform assignment on this Device. More...
 

Additional Inherited Members

- Public Types inherited from wfio::Device
typedef ::wfio_device_tCType
 The C type from which a Device is derived.
 

Detailed Description

A Device wrapping a file descriptor.

This class wraps a device backed by a file descriptor. On operating systems that support it, this class will provide functionality for such a device.

Constructor & Destructor Documentation

◆ FDDevice()

wfio::FDDevice::FDDevice ( wfio_fd_t  fd,
int *  error = NULL 
)
inline

Construct a new FDDevice from a file descriptor.

Parameters
fdThe file descriptor to wrap.
errorAn optional error indicator.

The documentation for this class was generated from the following file: