Manage collection as stream. More...
#include <flux.hpp>
Public Member Functions | |
| Flux () | |
| virtual | ~Flux () |
| void | ready () |
| void | push (const T &... object) |
| void | finalize () |
| void | setConsumer (std::function< void(const T &...)> consumer) |
| void | setFinalizer (std::function< void()> finalizer) |
| void | setErrorHandler (std::function< void()> errorHandler) |
Manage collection as stream.
Each item from the collection will be added with push method.
The synchronization is managed with std::promise / std::future C++ features.
Flux runs with:
When not set, the ready method will set error handler to rethrow and finalizer to do nothing.
When not sure, it is advise to call ready every time you have been to set consummer.
| T | the collection's type |
| anch::Flux< T >::Flux | ( | ) |
Flux default constructor
|
virtual |
Flux destructor
| void anch::Flux< T >::finalize | ( | ) |
Finalize treatment
| void anch::Flux< T >::push | ( | const T &... | object | ) |
Push object in stream
| object | the object to push in stream |
| void anch::Flux< T >::ready | ( | ) |
Set ready to consume
When consumer is not set, std::runtime_error will be raised.
When finalizer is not set, ready set it to nothing to do.
When error handler is not set, ready set it to rethrow.
| std::runtime_error | when consumer function is not set |
| void anch::Flux< T >::setConsumer | ( | std::function< void(const T &...)> | consumer | ) |
Object consumer setter
| consumer | the consumer to use |
| std::runtime_error | when already set |
| void anch::Flux< T >::setErrorHandler | ( | std::function< void()> | errorHandler | ) |
Object error handler setter
| errorHandler | the error handler to use |
| std::runtime_error | when already set |
| void anch::Flux< T >::setFinalizer | ( | std::function< void()> | finalizer | ) |
Object finalizer setter
| finalizer | the finalizer to use |
| std::runtime_error | when already set |