Barrelfish
Functions
flipbuffer.h File Reference

Barrelfish collections library - flip buffer. More...

Functions

void collections_fbuf_append (struct collections_fbuf *fbuf, const void *data, size_t length)
 Append data to front buffer. More...
 
void collections_fbuf_create (struct collections_fbuf **fbuf)
 Create a new flip buffer. More...
 
void collections_fbuf_flip (struct collections_fbuf *fbuf)
 Flip the buffer, i.e. change the role of the front and back buffer. More...
 
void collections_fbuf_free (struct collections_fbuf *fbuf)
 Empty the front buffer. More...
 
void * collections_fbuf_get_data (struct collections_fbuf *fbuf)
 Retrieve the data from the front buffer. More...
 
size_t collections_fbuf_get_length (struct collections_fbuf *fbuf)
 Retrieve the length of the data of the front buffer. More...
 
bool collections_fbuf_is_empty (struct collections_fbuf *fbuf)
 Is the front buffer empty? More...
 
void collections_fbuf_other_free (struct collections_fbuf *fbuf)
 Empty the back buffer. More...
 
bool collections_fbuf_other_is_empty (struct collections_fbuf *fbuf)
 Is the back buffer empty? More...
 
void collections_fbuf_release (struct collections_fbuf *fbuf)
 Free all memory associated with the flip buffer.
 

Detailed Description

Barrelfish collections library - flip buffer.

Function Documentation

void collections_fbuf_append ( struct collections_fbuf *  fbuf,
const void *  data,
size_t  length 
)

Append data to front buffer.

Parameters
fbufFlip buffer to append data to.
dataData to append. Don't have to be \0-terminated.
lengthLength of data to append.
void collections_fbuf_create ( struct collections_fbuf **  fbuf)

Create a new flip buffer.

Parameters
fbufPointer to a pointer to a flip buffer. Filled-in by function.
void collections_fbuf_flip ( struct collections_fbuf *  fbuf)

Flip the buffer, i.e. change the role of the front and back buffer.

Parameters
fbufFlip buffer to flip.
void collections_fbuf_free ( struct collections_fbuf *  fbuf)

Empty the front buffer.

Parameters
fbufFlip buffer to operate on.
void* collections_fbuf_get_data ( struct collections_fbuf *  fbuf)

Retrieve the data from the front buffer.

Parameters
fbufFlip buffer to get data from.
Returns
Content of the front buffer. Not \0 terminated.
size_t collections_fbuf_get_length ( struct collections_fbuf *  fbuf)

Retrieve the length of the data of the front buffer.

Parameters
fbufFlip buffer to get length of data from.
Returns
Length of the data in the front buffer.
bool collections_fbuf_is_empty ( struct collections_fbuf *  fbuf)

Is the front buffer empty?

Parameters
fbufFlip buffer to check.
Returns
Whether or not the front buffer contains any data?
void collections_fbuf_other_free ( struct collections_fbuf *  fbuf)

Empty the back buffer.

Parameters
fbufFlip buffer to operate on.
bool collections_fbuf_other_is_empty ( struct collections_fbuf *  fbuf)

Is the back buffer empty?

Parameters
fbufFlip buffer to check.
Returns
Whether or not the back buffer contains any data?