3#include "Engine/NetworkGraph/Connection.h"
4#include "Engine/NetworkGraph/Unit.h"
6#include <unordered_map>
7#include <unordered_set>
63 using ConnectionMap = std::unordered_map<OpId, std::vector<Connection>>;
64 using CapturedMap = std::unordered_map<Unit, std::vector<Unit>>;
67 static void eraseConnection_(ConnectionMap& side,
OpId key,
const Connection& connection);
70 static void eraseConnectionsTouching_(ConnectionMap& side,
OpId opId);
73 static void eraseCapturedTouching_(CapturedMap& map,
OpId opId);
76 static void eraseUnit_(CapturedMap& map,
const Unit& key,
const Unit& value);
79 static void addDependent_(
81 std::vector<Unit>& dependents,
82 std::unordered_set<Unit>& seen,
83 std::vector<Unit>& pending
89 std::vector<OpId>& opOrder,
90 std::unordered_set<OpId>& addedOps,
91 std::unordered_set<OpId>& opsBeingAdded
95 ConnectionMap byTarget_;
97 ConnectionMap bySource_;
104 CapturedMap capturedDependents_;
106 CapturedMap capturedDependencies_;
Basic attribute, parameter, and node types for Enzo.
uint64_t OpId
The unique ID assigned to each node in the network.
Definition Types.h:137
The single owner of the network's wiring and dependencies.
Definition NetworkGraph.h:24
void removeNode(OpId opId)
Removes every connection and captured edge touching the node.
Definition NetworkGraph.cpp:114
std::vector< OpId > getCookOrder(OpId target) const
Returns the nodes to cook before target, in cook order.
Definition NetworkGraph.cpp:187
void disconnect(const Connection &connection)
Removes a wired connection between two nodes.
Definition NetworkGraph.cpp:14
std::vector< Unit > getDependents(const Unit &changed) const
Returns everything that depends on changed, directly or through a chain.
Definition NetworkGraph.cpp:224
std::vector< Connection > getInputs(OpId target) const
Returns the connections feeding target, ordered by input slot.
Definition NetworkGraph.cpp:45
std::vector< Connection > getOutputs(OpId source) const
Returns the connections leaving source.
Definition NetworkGraph.cpp:67
void setCapturedDependencies(const Unit &dependent, const std::vector< Unit > &dependencies)
Replaces every captured dependency of one parameter at once.
Definition NetworkGraph.cpp:74
void connect(const Connection &connection)
Records a wired connection between two nodes.
Definition NetworkGraph.cpp:8
std::optional< Connection > getInputConnection(OpId target, unsigned int inputSlot) const
Returns the connection on one input slot of target, if any.
Definition NetworkGraph.cpp:56
void clear()
Empties the graph.
Definition NetworkGraph.cpp:179
One wired link between two nodes, the ground truth of the network's wiring.
Definition Connection.h:20
A point in the network graph, either an operator output or a parameter.
Definition Unit.h:20