Functions: extend multi-function network api

This commit is contained in:
2020-07-07 18:45:34 +02:00
parent adfae89f96
commit 67042aa6a1
3 changed files with 57 additions and 10 deletions

View File

@@ -230,7 +230,14 @@ void MFNetwork::remove(MFNode &node)
node_or_null_by_id_[node.id_] = nullptr;
}
std::string MFNetwork::to_dot() const
void MFNetwork::remove(Span<MFNode *> nodes)
{
for (MFNode *node : nodes) {
this->remove(*node);
}
}
std::string MFNetwork::to_dot(Span<const MFNode *> marked_nodes) const
{
dot::DirectedGraph digraph;
digraph.set_rankdir(dot::Attr_rankdir::LeftToRight);
@@ -256,6 +263,13 @@ std::string MFNetwork::to_dot() const
dot_nodes.add_new(node, dot_node_ref);
}
for (const MFDummyNode *node : dummy_nodes_) {
dot_nodes.lookup(node).node().set_background_color("#77EE77");
}
for (const MFNode *node : marked_nodes) {
dot_nodes.lookup(node).node().set_background_color("#7777EE");
}
for (const MFNode *to_node : all_nodes) {
dot::NodeWithSocketsRef to_dot_node = dot_nodes.lookup(to_node);

View File

@@ -58,7 +58,7 @@ class MFNetworkEvaluationStorage {
uint min_array_size_;
public:
MFNetworkEvaluationStorage(IndexMask mask, uint max_socket_id);
MFNetworkEvaluationStorage(IndexMask mask, uint socket_id_amount);
~MFNetworkEvaluationStorage();
/* Add the values that have been provided by the caller of the multi-function network. */
@@ -142,7 +142,7 @@ void MFNetworkEvaluator::call(IndexMask mask, MFParams params, MFContext context
}
const MFNetwork &network = outputs_[0]->node().network();
Storage storage(mask, network.max_socket_id());
Storage storage(mask, network.socket_id_amount());
Vector<const MFInputSocket *> outputs_to_initialize_in_the_end;
@@ -507,9 +507,9 @@ struct OwnVectorValue : public Value {
/** \name Storage methods
* \{ */
MFNetworkEvaluationStorage::MFNetworkEvaluationStorage(IndexMask mask, uint max_socket_id)
MFNetworkEvaluationStorage::MFNetworkEvaluationStorage(IndexMask mask, uint socket_id_amount)
: mask_(mask),
value_per_output_id_(max_socket_id + 1, nullptr),
value_per_output_id_(socket_id_amount, nullptr),
min_array_size_(mask.min_array_size())
{
}