functional-dag
Loading...
Searching...
No Matches
Public Member Functions | List of all members
fn_dag::dag_fanout_node< Type, IDType > Class Template Reference

Internal node to take data from parent and run children. More...

#include <dag_fanout_impl.hpp>

Public Member Functions

 dag_fanout_node (const _dag_context &_context)
 This node uses data computed from the previous node to fan-out to it's children.
 
 ~dag_fanout_node ()
 Standard deconstructor.
 
void fan_out (Type *_data)
 Function to do it's job.
 
void print (string _indent)
 Printing function

 
template<typename In , typename Out >
bool add_node_to_subdag (_internal_dag_node< In, Out, IDType > *_node_to_add, const IDType _onto, const IDType _parent_id)
 Recursively adds a node to children.
 

Detailed Description

template<typename Type, typename IDType>
class fn_dag::dag_fanout_node< Type, IDType >

Internal node to take data from parent and run children.

Every node when generating output will send it's output to the nodes children. All child nodes run with the output data being immutable.

Constructor & Destructor Documentation

◆ dag_fanout_node()

template<typename Type , typename IDType >
fn_dag::dag_fanout_node< Type, IDType >::dag_fanout_node ( const _dag_context _context)
inline

This node uses data computed from the previous node to fan-out to it's children.

This node specifically fans data out and makes sure the children can't modify the data as well as cleaning up the data on the heap when finished

Parameters
_contextThe shared state between the nodes

Member Function Documentation

◆ add_node_to_subdag()

template<typename Type , typename IDType >
template<typename In , typename Out >
bool fn_dag::dag_fanout_node< Type, IDType >::add_node_to_subdag ( _internal_dag_node< In, Out, IDType > *  _node_to_add,
const IDType  _onto,
const IDType  _parent_id 
)
inline

Recursively adds a node to children.

This function will check whether the node attaches to the parent of this fan-out. If so, then it becomes a child of the parent function. If it did not attach to parent node, then it will recursively check its children until it finds it. If the parent isn't found, it will return false.

Parameters
_node_to_addThe node to add
_ontoThe ID of the parent the node wants to attach to
_parent_idThe current ID of this nodes parent
Returns
True if it was attached to the graph. Otherwise false.

◆ fan_out()

template<typename Type , typename IDType >
void fn_dag::dag_fanout_node< Type, IDType >::fan_out ( Type _data)
inline

Function to do it's job.

This function will take data from the parent node and execute the subsequent functions with the data. After the subsequent nodes have been run, it deletes the data. The nodes will run on their own threads in the event that run_single_threaded is off. Otherwise, this function will block until the children are finished in a depth-first way.

Parameters
_dataData from the parent node

◆ print()

template<typename Type , typename IDType >
void fn_dag::dag_fanout_node< Type, IDType >::print ( string  _indent)
inline

Printing function

This will print recursively to the logging stream the identity of the nodes. This can help ensure the dag was constructed correctly

Parameters
_indentThe parents indent context