15#include <unordered_set>
17#include "functional_dag/dag_interface.hpp"
18#include "functional_dag/impl/dag_fanout_impl.hpp"
27 template<
typename IDType>
31 virtual ~_dag_base() =
default;
36 virtual bool dag_contains(IDType _id) = 0;
39 virtual void print() = 0;
44 virtual IDType get_id() = 0;
47 virtual void push_once() = 0;
58 template<
typename OriginType,
typename IDType>
59 class dag :
public _dag_base<IDType> {
86 m_thread = std::thread(&dag::start_source,
this);
91 if(m_thread.joinable())
126 return m_children_ids.count(
_id) > 0;
139 template<
typename In,
typename Out>
143 m_children_ids.insert(
_newID);
149 *g_context.log <<
"->" << m_id << std::endl;
150 m_children.
print(g_context.indent_str);
161 m_children.fan_out(
dat);
169 void start_source() {
170 while(!g_context.filter_off)
The main DAG function that encapulates generation and mapping of the data across the DAG.
Definition dag_impl.hpp:59
void push_once()
Runs the generator and begins propagating the data to it's children.
Definition dag_impl.hpp:158
~dag()
Default deconstructor.
Definition dag_impl.hpp:90
dag(IDType _id, dag_source< OriginType > *_lsource, const _dag_context &_context, bool _startThread)
Constructor of the DAG.
Definition dag_impl.hpp:76
void add_filter(IDType _newID, dag_node< In, Out > *_new_filter, IDType _on_node)
Adds a new function to the DAG.
Definition dag_impl.hpp:140
void print()
Simple print function to print the ID of this DAG and it's children.
Definition dag_impl.hpp:148
IDType get_id()
Simple getter for the ID of the DAG itself.
Definition dag_impl.hpp:102
bool dag_contains(IDType _id)
Checks whether this DAG contains a specific ID.
Definition dag_impl.hpp:125
void manual_pump(OriginType *_raw_dat)
Manually pumps some data across the children of the DAG.
Definition dag_impl.hpp:113