Wheefun I/O Library
0.0.5
Useful I/O Primitives.
|
A C++ wrapper for a wfio_iobuf_t. More...
#include <iobuf.h>
Public Types | |
typedef ::wfio_iobuf_t * | CType |
The C type from which an IOBuf is derived. | |
typedef ::wfio_iobuf_source_callback_t | SourceCallback |
A callback used to implement a source operation. | |
typedef ::wfio_iobuf_sink_callback_t | SinkCallback |
A callback used to implement a sink operation. | |
Public Member Functions | |
IOBuf () | |
Construct the default IOBuf. More... | |
IOBuf (::wfio_iobuf_t *buf, bool acquire=true) | |
Wrap a wfio_iobuf_t. More... | |
IOBuf (const IOBuf &buf) | |
Copy-construct an IOBuf. More... | |
IOBuf (size_t size, int *error=NULL) | |
Construct a new exclusive buffer of length size . More... | |
IOBuf (size_t read, size_t write, int *error=NULL) | |
Construct a new split buffer. More... | |
~IOBuf () | |
Release this IOBuf. More... | |
int | flags () const throw () |
Obtain this IOBuf's flags. | |
size_t | capacity () const throw () |
Obtain this IOBuf's total capacity. | |
size_t | facet () const throw () |
Obtain the capacity of this IOBuf's current facet. | |
size_t | avail () const throw () |
The number of characters available for consumption in this IOBuf. | |
size_t | remain () const throw () |
Obtain the space remaining in the current facet of this buffer. More... | |
size_t | remainElem (size_t sz) const throw () |
Obtain the space remaining in the current facet of this buffer for elements of size sz . More... | |
size_t | start () const throw () |
Obtain the starting index for this IOBuf's current facet. More... | |
size_t | end () const throw () |
Obtain the end index for this IOBuf's current facet. More... | |
void * | base () throw () |
Obtain the base address of this IOBuf's current facet. More... | |
const void * | base () const throw () |
Obtain the base address of this IOBuf's current facet in a constant context. More... | |
size_t | read (void *dest, size_t sz, size_t elem, int *error=NULL) throw () |
Consume elements from this IOBuf. More... | |
size_t | readbV (void *dest, size_t len, int *error=NULL) throw () |
Consume bytes from this IOBuf. More... | |
int | readb (int *error=NULL) throw () |
Consume bytes from this IOBuf. More... | |
size_t | write (const void *src, size_t sz, size_t elem, int *error=NULL) throw () |
Emplace elements into this IOBuf. More... | |
size_t | writebV (const void *src, size_t len, int *error=NULL) throw () |
Emplace bytes into this IOBuf. More... | |
size_t | writeb (char c, int *error=NULL) throw () |
Emplace bytes into this IOBuf. More... | |
size_t | source (size_t sz, size_t elem, void *src, SourceCallback cb, int *error=NULL) throw () |
Source new elements into this IOBuf from src . More... | |
size_t | fill (void *src, SourceCallback cb, int *error=NULL) throw () |
Fill this IOBuf from src . More... | |
size_t | sink (size_t sz, size_t elem, void *src, SinkCallback cb, int *error=NULL) throw () |
Sink new elements from this IOBuf into dest . More... | |
size_t | empty (void *src, SinkCallback cb, int *error=NULL) throw () |
Empty this buffer into src . More... | |
bool | flip (int *error=NULL) throw () |
Flip this IOBuf. More... | |
bool | notRead () const throw () |
Whether or not this IOBuf is shared and not using the read facet. More... | |
bool | notWrite () const throw () |
Whether or not this IOBuf is shared and not using the write facet. More... | |
bool | ensureRead (int *error=NULL) throw () |
Ensure that this IOBuf is using the read buffer. More... | |
bool | ensureWrite (int *error=NULL) throw () |
Ensure that this IOBuf is using the write buffer. More... | |
bool | forceReorganize (int *error=NULL) throw () |
Force the reorganization of this IOBuf. More... | |
int | clear (int *error=NULL) throw () |
Clear the contents of this IOBuf's current facet. More... | |
bool | valid () const throw () |
Determine if this IOBuf is valid. More... | |
operator bool () const | |
Synonymous with this->valid(). More... | |
operator::wfio_iobuf_t * () | |
Implicitly convert this IOBuf into it's C equivalent. | |
WFIO_CXX_DLL IOBuf & | operator= (const IOBuf &rhs) |
Perform assignment on this IOBuf. More... | |
Static Public Member Functions | |
static IOBuf | allocShared (size_t capacity, int *error=NULL) |
Allocate a new shared IOBuf. More... | |
A C++ wrapper for a wfio_iobuf_t.
|
inline |
|
inline |
Wrap a wfio_iobuf_t.
buf | The buffer to wrap. |
acquire | Whether or not the buffer should be acquired as a consequence of constructing this object. |
buf
from the context in which it is called, then acquire
should be false
.
|
inline |
Copy-construct an IOBuf.
This method acquires the underlying buffer so that it is shared. The buffer provided by buf
is then shared with this one.
buf | The buffer to copy-construct. |
|
inline |
Construct a new exclusive buffer of length size
.
size | The total number of bytes to allocate for this buffer. |
error | An optional error indicator. |
|
inline |
Construct a new split buffer.
read | The size of the read facet of the new buffer. |
write | The size of the write facet of the new buffer. |
error | An optional error indicator. |
|
inline |
Release this IOBuf.
This method releases the underlying CType if this object is valid.
|
inlinestatic |
|
inline |
|
inline |
|
inline |
Clear the contents of this IOBuf's current facet.
error | An optional error indicator. |
|
inline |
Empty this buffer into src
.
dest | The source object to write to. |
cb | The callback to invoke on writing. |
error | An optional error indicator. |
|
inline |
|
inline |
Ensure that this IOBuf is using the read buffer.
error | An optional error indicator. |
|
inline |
Ensure that this IOBuf is using the write buffer.
error | An optional error indicator. |
|
inline |
Fill this IOBuf from src
.
src | The source object to read from. |
cb | The callback to invoke on reading. |
error | An optional error indicator. |
|
inline |
Flip this IOBuf.
This does nothing for an unshared buffer; otherwise, this function swaps the current facet in use by the buffer.
error | An optional error indicator. |
|
inline |
Force the reorganization of this IOBuf.
error | An optional error indicator. |
|
inline |
Whether or not this IOBuf is shared and not using the read facet.
|
inline |
Whether or not this IOBuf is shared and not using the write facet.
|
inline |
Synonymous with this->valid().
|
inline |
|
inline |
|
inline |
|
inline |
Obtain the space remaining in the current facet of this buffer.
The | number of bytes which may be placed in the current facet in this buffer. |
|
inline |
Obtain the space remaining in the current facet of this buffer for elements of size sz
.
sz | The size of the element to scale the count to. |
|
inline |
Sink new elements from this IOBuf into dest
.
sz | The size of each element. |
elem | The number of elements to write out. |
dest | The source object to write to. |
cb | The callback to invoke on writing. |
error | An optional error indicator. |
|
inline |
Source new elements into this IOBuf from src
.
sz | The size of each element. |
elem | The number of elements to read in. |
src | The source object to read from. |
cb | The callback to invoke on reading. |
error | An optional error indicator. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |