|
MT Showcase SDK
|
Wraps results of multiple value generators to a single value stream. More...
#include <GeneratorValueStream.hpp>
Public Member Functions | |
| GeneratorValueStream (std::shared_ptr< folly::Executor > generatorExecutor) | |
| Executor that is given as a parameter to generators. | |
| virtual | ~GeneratorValueStream () |
| Futures that are out will be fulfilled, but the order of the values is not ensured. More... | |
| virtual folly::Future< ValueType > | next () override |
| void | setSynchronizationTest (std::function< bool(const ValueType &)> f) |
| This function tests whether the value received is so called 'synchronization' value. More... | |
| void | setCallback (std::function< void(const ValueType &)> f) |
| Add callback to be executed for every value that flows through the stream. | |
| void | addGenerator (GeneratorPtr generator) |
| Must be called before next on this stream. | |
Public Member Functions inherited from Showcase::ValueStream< Generator::ValueType > | |
| int | forEachSync (const std::function< void(const Generator::ValueType &)> &f, int N, const std::function< bool(const Generator::ValueType &)> &endCond=nullptr) |
| Executes f for each next N values in the Stream as long as values are being generated. More... | |
Wraps results of multiple value generators to a single value stream.
Behaves like an infinite queue
|
virtual |
Futures that are out will be fulfilled, but the order of the values is not ensured.
In other words one can have pending elements between non pending elements even if all underlying generators wouldn't have reached pending state. Basically this allows tapping into the raw stream generators provide. The lifetime of underlying generator is tied to the futures sent out.
Add tasks from generators to the futures sent out that have not yet been taken care of
only assign to generators that haven't been disabled
Capture generator for ensuring the proper calculation
|
overridevirtual |
Double checked locking pattern a'la MULTI_ONCE
Already have some fulfilled promises in stock
Need to make new promise for this request
Launch some new computation on generators that are finished
Implements Showcase::ValueStream< Generator::ValueType >.
| void Showcase::GeneratorValueStream< Generator >::setSynchronizationTest | ( | std::function< bool(const ValueType &)> | f | ) |
This function tests whether the value received is so called 'synchronization' value.