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 (OpId target) const
 Returns the connections feeding target, ordered by input slot.
 
std::optional< ConnectiongetInputConnection (OpId target, unsigned int inputSlot) const
 Returns the connection on one input slot of target, if any.
 
std::vector< ConnectiongetOutputs (OpId source) const
 Returns the connections leaving source.
 
void setCapturedDependencies (const Unit &dependent, const std::vector< Unit > &dependencies)
 Replaces every captured dependency of one parameter at once.
 
void removeNode (OpId opId)
 Removes every connection and captured edge touching the node.
 
void clear ()
 Empties the graph.
 
std::vector< OpIdgetCookOrder (OpId 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< OpId > enzo::nt::NetworkGraph::getCookOrder ( OpId 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 ( OpId target,
unsigned int inputSlot ) const

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

Note
An input slot holds at most one connection.

◆ 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.

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