Enzo
Loading...
Searching...
No Matches
enzo::nt::NetworkGraph Class Reference

The single owner of the network's wiring and dependencies. More...

#include <NetworkGraph.h>

Public Member Functions

void connect (const Connection &connection)
 Records a wired connection between two nodes.
 
void disconnect (const Connection &connection)
 Removes a wired connection between two nodes.
 
std::vector< ConnectiongetInputs (NodeId target) const
 Returns the connections feeding target, ordered by input index.
 
std::optional< ConnectiongetInputConnection (NodeId target, unsigned int inputIndex) const
 Returns the connection on one input of target, if any.
 
std::vector< ConnectiongetOutputs (NodeId source) const
 Returns the connections leaving source.
 
std::vector< ConnectiongetConnections () const
 Returns every wired connection in the graph, in no particular order.
 
void setCapturedDependencies (const Unit &dependent, const std::vector< Unit > &dependencies)
 Replaces every captured dependency of one parameter at once.
 
void setTimeDependent (const Unit &dependent, bool dependsOnTime)
 Records whether a unit reads the scene time.
 
std::vector< UnitgetTimeDependents () const
 Returns every unit the scene time reaches, in no particular order.
 
void removeNode (NodeId nodeId)
 Removes every connection and captured edge touching the node.
 
void clear ()
 Empties the graph.
 
std::vector< NodeIdgetCookOrder (NodeId target) const
 Returns the nodes to cook before target, in cook order.
 
std::vector< UnitgetDependents (const Unit &changed) const
 Returns everything that depends on changed, directly or through a chain.
 

Detailed Description

The single owner of the network's wiring and dependencies.

Wired connections are the physical links between nodes. They are the ground truth of the topology and the only edges the cook order considers. Captured dependencies are expression references seen while a parameter evaluates. They are stored for invalidation and never take part in scheduling.

Every edge points from the value depended upon to the value that reads it, so the dependents of a unit are everything that must update when it changes.

Member Function Documentation

◆ getCookOrder()

std::vector< NodeId > enzo::nt::NetworkGraph::getCookOrder ( NodeId target) const

Returns the nodes to cook before target, in cook order.

Note
Considers wired connections only. Reports a cycle rather than looping.

◆ getDependents()

std::vector< Unit > enzo::nt::NetworkGraph::getDependents ( const Unit & changed) const

Returns everything that depends on changed, directly or through a chain.

Note
Considers both wired connections and captured edges.

◆ getInputConnection()

std::optional< Connection > enzo::nt::NetworkGraph::getInputConnection ( NodeId target,
unsigned int inputIndex ) const

Returns the connection on one input of target, if any.

Note
An input holds at most one connection.

◆ getTimeDependents()

std::vector< Unit > enzo::nt::NetworkGraph::getTimeDependents ( ) const

Returns every unit the scene time reaches, in no particular order.

Note
Covers the units that read the time and everything downstream of them.

◆ setCapturedDependencies()

void enzo::nt::NetworkGraph::setCapturedDependencies ( const Unit & dependent,
const std::vector< Unit > & dependencies )

Replaces every captured dependency of one parameter at once.

Note
A parameter rebuilds its full reference set each time it evaluates, so its previous captured edges are dropped and the new set takes over.

◆ setTimeDependent()

void enzo::nt::NetworkGraph::setTimeDependent ( const Unit & dependent,
bool dependsOnTime )

Records whether a unit reads the scene time.

Note
A parameter records this each time it evaluates and a node each time it cooks.

The documentation for this class was generated from the following files: