Object that manages the connections and state of multiple nodes.
More...
#include <graph.h>
|
| | graph (const std::string name_r="graph") |
| |
| virtual void | add (std::shared_ptr< node > node_p, const std::string &name_r=std::string()) |
| | Adds a node to the graph.
|
| |
| virtual std::shared_ptr< node > | remove (const std::string &name_r) |
| | Removes a node from the graph.
|
| |
| virtual void | remove (const std::shared_ptr< node > &sp_node) |
| | Removes a node from the graph.
|
| |
| template<typename T > |
| bool | connect (const std::string &p_name_r, const size_t p_pin, const std::string &c_name_r, const size_t c_pin, const size_t max_length=0, const size_t max_weight=0) |
| | Connects two nodes' pins from the graph together.
|
| |
| template<typename T > |
| bool | connect (std::shared_ptr< flow::producer< T >> sp_p, const size_t p_pin, std::shared_ptr< flow::consumer< T >> sp_c, const size_t c_pin, const size_t max_length=0, const size_t max_weight=0) |
| | Connects two nodes' pins from the graph together.
|
| |
| template<typename T > |
| void | disconnect (std::shared_ptr< flow::producer< T >> sp_p, const size_t p_pin) |
| | Disconnects a node's pin.
|
| |
| template<typename T > |
| void | disconnect (std::shared_ptr< flow::consumer< T >> sp_c, const size_t c_pin) |
| | Disconnects a node's pin.
|
| |
| virtual void | start () |
| | Starts all nodes in the graph.
|
| |
| virtual void | pause () |
| | Pauses all nodes in the graph.
|
| |
| virtual void | stop () |
| | Stops all nodes in the graph.
|
| |
| virtual std::ostream & | to_dot (std::ostream &o) |
| | Produces a dot syntax of the graph.
|
| |
| | named (const std::string &name_r) |
| | Constructor the takes a name.
|
| |
|
| named (named &&name_rr) |
| | Move constructor.
|
| |
|
| named (const named &name_r) |
| | Copy constructor.
|
| |
|
virtual const std::string & | name () const |
| | A const reference to this object's name.
|
| |
| virtual std::string | rename (const std::string &name_r) |
| | Sets this object's name to a new name.
|
| |
Object that manages the connections and state of multiple nodes.
When starting or stopping a graph, nodes are started and stopped in a fashion to minize build-up of packets.
| flow::graph::graph |
( |
const std::string |
name_r = "graph" | ) |
|
|
inline |
- Parameters
-
| name_r | The name of this graph. |
| virtual void flow::graph::add |
( |
std::shared_ptr< node > |
node_p, |
|
|
const std::string & |
name_r = std::string() |
|
) |
| |
|
inlinevirtual |
Adds a node to the graph.
The node will initially be disconnected and paused.
- Parameters
-
| node_p | Pointer to the node to add. |
| name_r | Optional. New name to give the node. |
| virtual std::shared_ptr<node> flow::graph::remove |
( |
const std::string & |
name_r | ) |
|
|
inlinevirtual |
Removes a node from the graph.
- Parameters
-
| name_r | The name of the node to remove. |
- Returns
- Node that was removed.
| virtual void flow::graph::remove |
( |
const std::shared_ptr< node > & |
sp_node | ) |
|
|
inlinevirtual |
Removes a node from the graph.
- Parameters
-
| sp_node | The name of the node to remove. |
template<typename T >
| bool flow::graph::connect |
( |
const std::string & |
p_name_r, |
|
|
const size_t |
p_pin, |
|
|
const std::string & |
c_name_r, |
|
|
const size_t |
c_pin, |
|
|
const size_t |
max_length = 0, |
|
|
const size_t |
max_weight = 0 |
|
) |
| |
|
inline |
Connects two nodes' pins from the graph together.
- Parameters
-
| p_name_r | Name of the producing node. |
| p_pin | The index of the producing node's output pin to connect. |
| c_name_r | Name of the consuming node. |
| c_pin | The index of the consuming node's input pin to connect. |
| max_length | The maximum length to give the pipe. Do not set or set to 0 for uncapped length. |
| max_weight | The maximum weight to give the pipe. Do not set or set to 0 for uncapped weight. |
- Returns
- False if the nodes had not yet been added to the graph.
template<typename T >
| bool flow::graph::connect |
( |
std::shared_ptr< flow::producer< T >> |
sp_p, |
|
|
const size_t |
p_pin, |
|
|
std::shared_ptr< flow::consumer< T >> |
sp_c, |
|
|
const size_t |
c_pin, |
|
|
const size_t |
max_length = 0, |
|
|
const size_t |
max_weight = 0 |
|
) |
| |
|
inline |
Connects two nodes' pins from the graph together.
- Parameters
-
| sp_p | The producing node. |
| p_pin | The index of the producing node's output pin to connect. |
| sp_c | The consuming node. |
| c_pin | The index of the consuming node's input pin to connect. |
| max_length | The maximum length to give the pipe. Do not set or set to 0 for uncapped length. |
| max_weight | The maximum weight to give the pipe. Do not set or set to 0 for uncapped weight. |
- Returns
- False if the nodes had not yet been added to the graph.
template<typename T >
| void flow::graph::disconnect |
( |
std::shared_ptr< flow::producer< T >> |
sp_p, |
|
|
const size_t |
p_pin |
|
) |
| |
|
inline |
Disconnects a node's pin.
- Parameters
-
| sp_p | The node. |
| p_pin | The pin's index. |
template<typename T >
| void flow::graph::disconnect |
( |
std::shared_ptr< flow::consumer< T >> |
sp_c, |
|
|
const size_t |
c_pin |
|
) |
| |
|
inline |
Disconnects a node's pin.
- Parameters
-
| sp_c | The node. |
| c_pin | The pin's index. |
| virtual void flow::graph::start |
( |
| ) |
|
|
inlinevirtual |
Starts all nodes in the graph.
To avoid packet build-up in pipes, pure consuming node are started first, transforming nodes second and pure producing nodes last. If a node had been stopped earlier, a new thread is created for it.
| virtual void flow::graph::pause |
( |
| ) |
|
|
inlinevirtual |
Pauses all nodes in the graph.
To avoid packet build-up in pipes, pure producing node are paused first, transforming nodes second and pure consuming nodes last.
| virtual void flow::graph::stop |
( |
| ) |
|
|
inlinevirtual |
Stops all nodes in the graph.
node::stop() is called on all nodes.
| virtual std::ostream& flow::graph::to_dot |
( |
std::ostream & |
o | ) |
|
|
inlinevirtual |
Produces a dot syntax of the graph.
- Parameters
-
| o | The output stream to output the syntax. |
The documentation for this class was generated from the following file: