Abstract class representing a yielder. It is, an object which can be used to accumulate inputs until either a yield is explicitly deleted or the yield condition is triggered, probably after a push request.
More...
#include <Yielder.h>
|
| Yielder (std::size_t bufferSize=256) |
| Default constructor for the abstract yielder. More...
|
|
void | yield () |
| Make the yielder flush its elements so the output is performed.
|
|
void | push (T const &elem) |
| Push the element into the yielder. The element could be simply accumulated or either it could be directly written to file depending on yielder status at push time. More...
|
|
virtual void | digest (vector< T > ©)=0 |
| Abstract method that must be overridden by any concrete Yielder implementation to specify how a yield output must be handled/digested.
|
|
virtual vector< T > | copyBuffer () const |
| Make a copy of the buffer with its current state. More...
|
|
void | setBufferSize (size_t const bufferSize) |
| Set the buffer size of the yielder, effectively. More...
|
|
size_t | getBufferSize () const |
| Obtain the current buffer size of the yielder. More...
|
|
|
std::mutex | mtx |
| The mutex to handle concurrent push backs to the buffer vector and the yielding operation itself.
|
|
std::size_t | bufferSize |
| The number of elements that can be buffered before forcing the yield operation.
|
|
std::vector< T > | buffer |
| Where the elements are stored.
|
|
template<typename T>
class Yielder< T >
Abstract class representing a yielder. It is, an object which can be used to accumulate inputs until either a yield is explicitly deleted or the yield condition is triggered, probably after a push request.
- Author
- Alberto M. Esmoris Pena
- Version
- 1.0
- Template Parameters
-
T | The type of object handled by the yielder |
◆ Yielder()
◆ copyBuffer()
template<typename T >
virtual vector<T> Yielder< T >::copyBuffer |
( |
| ) |
const |
|
inlinevirtual |
Make a copy of the buffer with its current state.
- Returns
- The copy of the buffer at its current state
◆ getBufferSize()
template<typename T >
size_t Yielder< T >::getBufferSize |
( |
| ) |
const |
|
inline |
Obtain the current buffer size of the yielder.
- Returns
- The buffer size of the yielder
◆ push()
template<typename T >
void Yielder< T >::push |
( |
T const & |
elem | ) |
|
|
inline |
Push the element into the yielder. The element could be simply accumulated or either it could be directly written to file depending on yielder status at push time.
- Parameters
-
elem | Element to be pushed into the yielder |
◆ setBufferSize()
template<typename T >
void Yielder< T >::setBufferSize |
( |
size_t const |
bufferSize | ) |
|
|
inline |
Set the buffer size of the yielder, effectively.
- Parameters
-
bufferSize | New buffer size for the yielder |
The documentation for this class was generated from the following file: