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

A strategy for a device. More...

#include <device.h>

Public Member Functions

virtual size_t read (CType dev, void *buf, size_t sz, size_t elem)=0
 Service a read operation. More...
 
virtual size_t write (CType dev, const void *buf, size_t sz, size_t elem)=0
 Service a write operation. More...
 
virtual int seek (CType dev, off_t offset, wfio_whence_t whence)=0
 Service a seek operation. More...
 
virtual off_t tell (CType dev)=0
 Service a tell operation. More...
 
virtual int flush (CType dev)=0
 Service a flush operation. More...
 
virtual size_t setbufsz (CType dev, size_t len)=0
 Service a setbufsz operation. More...
 
virtual size_t getbufsz (CType dev) const =0
 Service a getbufsz operation. More...
 
virtual int dcntl (CType dev, int cmd, va_list args)=0
 Service a dcntl operation. More...
 
virtual int ioctl (CType dev, int cmd, va_list args)=0
 Service an ioctl operation. More...
 
virtual ~CXXStrategy ()
 

Detailed Description

A strategy for a device.

A class of this instance can be supplied to a device to quickly implement a device in C++.

Constructor & Destructor Documentation

◆ ~CXXStrategy()

virtual wfio::Device::CXXStrategy::~CXXStrategy ( )
virtual

Destroy this CXXStrategy.

This function shall additionally close the device represented by this CXXStrategy.

Member Function Documentation

◆ dcntl()

virtual int wfio::Device::CXXStrategy::dcntl ( CType  dev,
int  cmd,
va_list  args 
)
pure virtual

Service a dcntl operation.

Parameters
devThe context from which this method was invoked.
cmdThe command to send to the device.
vaAdditional arguments to the dcntl.

◆ flush()

virtual int wfio::Device::CXXStrategy::flush ( CType  dev)
pure virtual

Service a flush operation.

Parameters
devThe context from which this method was invoked.
Returns
Nonzero on success; otherwise, zero.

◆ getbufsz()

virtual size_t wfio::Device::CXXStrategy::getbufsz ( CType  dev) const
pure virtual

Service a getbufsz operation.

Parameters
devThe context from which this method was invoked.
Returns
The number of elements actually written on success; otherwise, WFIO_NPOS.

◆ ioctl()

virtual int wfio::Device::CXXStrategy::ioctl ( CType  dev,
int  cmd,
va_list  args 
)
pure virtual

Service an ioctl operation.

Parameters
devThe context from which this method was invoked.
cmdThe command to send to the device.
vaAdditional arguments to the dcntl.

◆ read()

virtual size_t wfio::Device::CXXStrategy::read ( CType  dev,
void *  buf,
size_t  sz,
size_t  elem 
)
pure virtual

Service a read operation.

Parameters
devThe context from which this method was invoked.
bufThe buffer to read into.
szThe size of each element to read.
elemThe number of elements to read.
Returns
The number of elements actually read on success; otherwise, WFIO_NPOS.

◆ seek()

virtual int wfio::Device::CXXStrategy::seek ( CType  dev,
off_t  offset,
wfio_whence_t  whence 
)
pure virtual

Service a seek operation.

Parameters
devThe context from which this method was invoked.
bufThe buffer to write from.
szThe size of each elements.
elemThe maximum number of elements to write.
Returns
Zero on success; otherwise, nonzero.

◆ setbufsz()

virtual size_t wfio::Device::CXXStrategy::setbufsz ( CType  dev,
size_t  len 
)
pure virtual

Service a setbufsz operation.

Parameters
devThe context from which this method was invoked.
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 device is unbuffered..

◆ tell()

virtual off_t wfio::Device::CXXStrategy::tell ( CType  dev)
pure virtual

Service a tell operation.

Parameters
devThe context from which this method was invoked.
Returns
The current stream position of the device on success; otherwise,WFIO_NPOS.

◆ write()

virtual size_t wfio::Device::CXXStrategy::write ( CType  dev,
const void *  buf,
size_t  sz,
size_t  elem 
)
pure virtual

Service a write operation.

Parameters
devThe context from which this method was invoked.
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.

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