#include <fifo_buffer.h>
Classes | |
class | UnaryConditionIf |
Public Member Functions | |
bool | empty (void) |
FifoBuffer () | |
ElementType | findFirstIf (UnaryConditionIf &condition_impl, bool erase_if_found=false) |
void | notify (void) |
ElementType | pop (void) |
void | push (const ElementType &elem) |
size_t | size (void) |
void | waitForElement () |
void | waitOnceForElement () |
~FifoBuffer () | |
Protected Member Functions | |
void | notifyAll (void) |
void | push_back (const ElementType &elem) |
void | waitForNotify (void) |
Protected Attributes | |
boost::condition_variable | m_buffer_condition |
condition variable to signal changes in buffer size More... | |
boost::mutex | m_condition_mutex |
mutex to lock m_buffer_condition More... | |
std::list< ElementType > | m_fifo_buffer |
list of all elements of the fifo buffer More... | |
MutexType | m_fifo_mutex |
mutex to lock m_fifo_buffer More... | |
Class FifoBuffer implements a threadsafe fifo-buffer ("first in, first out").
Definition at line 66 of file fifo_buffer.h.
|
inline |
Constructor
Definition at line 73 of file fifo_buffer.h.
|
inline |
Destructor
Definition at line 78 of file fifo_buffer.h.
|
inline |
Returns true, if the fifo buffer is empty.
Definition at line 86 of file fifo_buffer.h.
|
inline |
Searches for an element in the fifo by a unary condition. Returns and optionally removes an element from the fifo buffer, if condition_impl.condition(ElementType &) returns true.
[in] | condition_impl | condition (callback interface, returns true, if condition for an element is true, or false otherwise) |
[in] | erase_if_found | if true, the element found will be erased (otherwise left untouched) |
Definition at line 173 of file fifo_buffer.h.
|
inline |
Signal a notification to interrupt a waiting waitForElement() call
Definition at line 151 of file fifo_buffer.h.
|
inlineprotected |
Notification after changes in fifo buffer size.
Definition at line 201 of file fifo_buffer.h.
|
inline |
Removes and returns the first element from the fifo buffer.
Definition at line 114 of file fifo_buffer.h.
|
inline |
Pushes an element to the end of the fifo buffer.
Definition at line 104 of file fifo_buffer.h.
|
inlineprotected |
Pushes an element to the end of the fifo buffer.
Definition at line 194 of file fifo_buffer.h.
|
inline |
Returns the number of elements in the fifo buffer.
Definition at line 95 of file fifo_buffer.h.
|
inline |
Waits until there's at least one element in the fifo buffer.
Definition at line 129 of file fifo_buffer.h.
|
inlineprotected |
Wait until notification signalled.
Definition at line 207 of file fifo_buffer.h.
|
inline |
Waits until there's at least one element in the fifo buffer, or a notification has been signalled.
Definition at line 140 of file fifo_buffer.h.
|
protected |
condition variable to signal changes in buffer size
Definition at line 220 of file fifo_buffer.h.
|
protected |
mutex to lock m_buffer_condition
Definition at line 219 of file fifo_buffer.h.
|
protected |
list of all elements of the fifo buffer
Definition at line 217 of file fifo_buffer.h.
|
protected |
mutex to lock m_fifo_buffer
Definition at line 218 of file fifo_buffer.h.