Wheefun I/O Library  0.0.5
Useful I/O Primitives.
Public Attributes | List of all members
wfio_iobuf_t Struct Reference

A generic I/O buffer. More...

#include <iobuf.h>

Public Attributes

const int flags
 Flags associated with this buffer.
 
const size_t capacity
 The maximum capacity of this buffer.
 
const size_t facet
 The capacity of this facet of the buffer. More...
 
const size_t avail
 The number of available characters for consumption in this buffer.
 
const size_t start
 The starting index of this buffer.
 
const size_t end
 The end index of this buffer.
 
void *const base
 The base address of this buffer's data.
 

Detailed Description

A generic I/O buffer.

An wfio_iobuf_t represents a generic circular buffer that can be used to implement buffering operations on devices or other objects which do not immediately provide it.

An wfio_iobuf_t may be allocated in two ways: as an exclusive buffer which allocates the entire memory to a single buffer, or as a shared double-buffer. To allocate an exclusive buffer, use the wfio_iobuf_alloc() function.

A shared buffer divides its memory into two facets which are respectively called facet 0 and facet 1. Facet 0 occupies the lower portion of memory, whereas facet 1 occupies the upper portion. Which facet is in use may be interrogated by the WFIO_IOBUF_FLIPPED bit; if it is set, then facet 1 is in use; otherwise, facet 0 is in use.

Shared buffers are extremely useful for implementing read-write devices so that the contents of the read or write buffer are not lost whenever performing the opposing operation.

Member Data Documentation

◆ facet

const size_t wfio_iobuf_t::facet

The capacity of this facet of the buffer.

If this IOBuf is shared, this refers to the maximum writable size of this facet.


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