Aufgabe 3: Pro-/Epilog
BBuffer< T, CAP > Class Template Reference
The class BBuffer implements a bounded buffer, that is a circular buffer with a fixed capacity. More...
#include <object/bbuffer.h>
Public Member Functions | |
BBuffer () | |
Constructor that initialized an empty buffer. | |
bool | produce (T val) |
Add an element to the buffer. More... | |
bool | consume (T &val) |
Remove an element from the buffer. More... | |
Detailed Description
template<typename T, unsigned CAP>
class BBuffer< T, CAP >
The class BBuffer implements a bounded buffer, that is a circular buffer with a fixed capacity.
- Template Parameters
-
T the type of data to be stored CAP the buffers capacity (must be greater than 1)
Member Function Documentation
template<typename T , unsigned CAP>
|
inline |
Add an element to the buffer.
- Parameters
-
val The element to be added.
- Returns
false
if the buffer is full and no element can be added;true
otherwise.
template<typename T , unsigned CAP>
|
inline |
Remove an element from the buffer.
- Parameters
-
val Output parameter that receives the next element. If there is (currently) no next element, val
will not be modified.
- Returns
false
if the buffer was empty;true
if the buffer was not empty and an element was written to val.
The documentation for this class was generated from the following file:
- object/bbuffer.h