A buffer class that holds a known capacity of fixed sized objects defined during creation.
More...
#include <buffer.h>
|
| FixedBuffer (size_t capacity, size_t objsize) |
| Create a buffer of known capacity for objects of a specified size. More...
|
|
| FixedBuffer (const FixedBuffer &fb) |
| Create a copy of an existing fixed size buffer and duplicate it's contents. More...
|
|
virtual | ~FixedBuffer () |
| Destroy the fixed buffer and free the memory used to store objects. More...
|
|
FixedBuffer & | operator= (const FixedBuffer &fb) |
|
bool | isValid (void) |
|
| Buffer (size_t capacity) |
| Create a buffer object of known capacity. More...
|
|
virtual | ~Buffer () |
| In derived functions, may be used to free the actual memory used to hold buffered data. More...
|
|
size_t | getSize (void) |
| Return the capacity of the buffer as specified at creation. More...
|
|
size_t | getUsed (void) |
| Return the current capacity in use for the buffer. More...
|
|
size_t | wait (void *buf, timeout_t timeout=0) |
| Let one or more threads wait for an object to become available in the buffer. More...
|
|
size_t | post (void *buf, timeout_t timeout=0) |
| Post an object into the buffer and enable a waiting thread to receive it. More...
|
|
size_t | peek (void *buf) |
| Peek at the current content (first object) in the buffer. More...
|
|
| Conditional (const char *id=NULL) |
| Create an instance of a conditional. More...
|
|
virtual | ~Conditional () |
| Destroy the conditional. More...
|
|
void | signal (bool broadcast) |
| Signal a conditional object and a waiting threads. More...
|
|
bool | wait (timeout_t timer=0, bool locked=false) |
| Wait to be signaled from another thread. More...
|
|
void | enterMutex (void) |
| Locks the conditional's mutex for this thread. More...
|
|
void | lock (void) |
| In the future we will use lock in place of enterMutex since the conditional composite is not a recursive mutex, and hence using enterMutex may cause confusion in expectation with the behavior of the Mutex class. More...
|
|
bool | tryEnterMutex (void) |
| Tries to lock the conditional for the current thread. More...
|
|
bool | test (void) |
|
void | leaveMutex (void) |
| Leaving a mutex frees that mutex for use by another thread. More...
|
|
void | unlock (void) |
|
|
size_t | onPeek (void *buf) |
| Return the first object in the buffer. More...
|
|
size_t | onWait (void *buf) |
| Wait for and return a fixed object in the buffer. More...
|
|
size_t | onPost (void *buf) |
| Post an object of the appropriate size into the buffer. More...
|
|
A buffer class that holds a known capacity of fixed sized objects defined during creation.
- Author
- David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m producer/consumer buffer for fixed size objects.
ost::FixedBuffer::FixedBuffer |
( |
size_t |
capacity, |
|
|
size_t |
objsize |
|
) |
| |
Create a buffer of known capacity for objects of a specified size.
- Parameters
-
capacity | of the buffer. |
objsize | for each object held in the buffer. |
ost::FixedBuffer::FixedBuffer |
( |
const FixedBuffer & |
fb | ) |
|
Create a copy of an existing fixed size buffer and duplicate it's contents.
- Parameters
-
virtual ost::FixedBuffer::~FixedBuffer |
( |
| ) |
|
|
virtual |
Destroy the fixed buffer and free the memory used to store objects.
bool ost::FixedBuffer::isValid |
( |
void |
| ) |
|
|
virtual |
size_t ost::FixedBuffer::onPeek |
( |
void * |
buf | ) |
|
|
protectedvirtual |
Return the first object in the buffer.
- Returns
- predefined size of this buffers objects.
- Parameters
-
buf | pointer to copy contents of head of buffer to. |
Implements ost::Buffer.
size_t ost::FixedBuffer::onPost |
( |
void * |
buf | ) |
|
|
protectedvirtual |
Post an object of the appropriate size into the buffer.
- Returns
- predefined size of this buffers objects.
- Parameters
-
buf | pointer to data to copy into the buffer. |
Implements ost::Buffer.
size_t ost::FixedBuffer::onWait |
( |
void * |
buf | ) |
|
|
protectedvirtual |
Wait for and return a fixed object in the buffer.
- Returns
- predefined size of this buffers objects.
- Parameters
-
buf | pointer to hold object returned from the buffer. |
Implements ost::Buffer.
The documentation for this class was generated from the following file: