functional-dag
|
The main DAG function that encapulates generation and mapping of the data across the DAG. More...
#include <dag_impl.hpp>
Public Member Functions | |
dag (IDType _id, dag_source< OriginType > *_lsource, const _dag_context &_context, bool _startThread) | |
Constructor of the DAG. | |
~dag () | |
Default deconstructor. | |
IDType | get_id () |
Simple getter for the ID of the DAG itself. | |
void | manual_pump (OriginType *_raw_dat) |
Manually pumps some data across the children of the DAG. | |
bool | dag_contains (IDType _id) |
Checks whether this DAG contains a specific ID. | |
template<typename In , typename Out > | |
void | add_filter (IDType _newID, dag_node< In, Out > *_new_filter, IDType _on_node) |
Adds a new function to the DAG. | |
void | print () |
Simple print function to print the ID of this DAG and it's children. | |
void | push_once () |
Runs the generator and begins propagating the data to it's children. | |
The main DAG function that encapulates generation and mapping of the data across the DAG.
The DAG calls the source generator to generate some data. That data is then propagated to it's children and across the entire DAG. The DAG stops propagating across the children of any node of the DAG if the previous parent returns nullptr. Otherwise, this runs either multithreaded or single threaded and can be manually manipulated (i.e. skip the generator) by turning it off and manually calling the manual_pump function.
|
inline |
Constructor of the DAG.
Ideally this is created in the manager but you can create your own DAG if you'd like.
_id | The ID of the DAG itself |
_lsource | The main generator (source) of the DAG. Where data originates |
_context | The context shared across the DAG |
_startThread | Whether or not to autostart calling the generator function |
|
inline |
Default deconstructor.
Waits for children to stop before cleaning up.
|
inline |
Adds a new function to the DAG.
Since the generator already exists, this function recursively calls itself with the parents nodes type and, in a strongly typed way, attaches a child to the parent to process the data output by the parent node.
_newID | The ID of the new function |
_new_filter | The mapping function itself to pass along |
_on_node | The ID of the parent to attach the function to. |
|
inline |
Checks whether this DAG contains a specific ID.
Given an ID, it will check the optimized hash set to see if the child exists.
_id | The ID to lookup |
|
inline |
Simple getter for the ID of the DAG itself.
Gets the ID of the DAG.
|
inline |
Manually pumps some data across the children of the DAG.
This is a useful function for testing. It skips the generator and pushes the test source data across the DAGs children.
_raw_dat | The raw data that the user provides. |
|
inline |
Runs the generator and begins propagating the data to it's children.
This function can be called from the thread on a loop or called on a single thread. This encapsulates a single pass across the DAG.