A templated typed class for buffering of objects. More...
#include <thread.h>
Public Member Functions | |
bufferof (unsigned count) | |
Create a buffer to hold a series of typed objects. | |
T * | get (void) |
Get the next typed object from the buffer. | |
T * | get (timeout_t timeout) |
Get the next typed object from the buffer. | |
void | put (T *object) |
Put (copy) a typed object into the buffer. | |
bool | put (T *object, timeout_t timeout) |
Put (copy) an object into the buffer. | |
void | copy (T *object) |
Copy the next typed object from the buffer. | |
bool | get (T *object, timeout_t timeout) |
Copy the next typed object from the buffer. |
A templated typed class for buffering of objects.
This operates as a fifo buffer of typed objects which are physically copied into the buffer. The objects that are buffered are accessed from allocated buffer space. As designed this may be used with multiple producer threads and one consumer thread. To use multiple consumers, one can copy the typed object from the buffer through the get pointer and then call release. The copied object can then be used safely. This is what the copy method is used for.
Definition at line 2226 of file thread.h.
ucc::bufferof< T >::bufferof | ( | unsigned | count | ) | [inline] |
void ucc::bufferof< T >::copy | ( | T * | object | ) | [inline] |
bool ucc::bufferof< T >::get | ( | T * | object, | |
timeout_t | timeout | |||
) | [inline] |
T* ucc::bufferof< T >::get | ( | timeout_t | timeout | ) | [inline] |
Get the next typed object from the buffer.
timeout | to wait when buffer is empty in milliseconds. |
Reimplemented from ucc::Buffer.
T* ucc::bufferof< T >::get | ( | void | ) | [inline] |
Get the next typed object from the buffer.
This blocks until an object becomes available.
Reimplemented from ucc::Buffer.
bool ucc::bufferof< T >::put | ( | T * | object, | |
timeout_t | timeout | |||
) | [inline] |
void ucc::bufferof< T >::put | ( | T * | object | ) | [inline] |