Fan-out & Routing¶
FanoutNode¶
Reads one item and pushes a copy to each of N output channels. All downstream nodes receive every item.
auto fan = make_fanout<Image, 2>(/*capacity=*/8);
net.connect("src", src.output<0>(), "fan", fan.input<0>())
.connect("fan", fan.output<0>(), "nodeA", nodeA.input<0>())
.connect("fan", fan.output<1>(), "nodeB", nodeB.input<0>());
If one downstream channel overflows, that output drops the item independently — the other outputs are unaffected.
See examples/11_static_fanout.
RouterNode¶
Reads one item and pushes it to exactly one of N outputs, chosen by a selector function:
auto router = make_router<Frame, 3>(
[](const Frame& f) -> std::size_t { return f.stream_id % 3; });
net.connect("src", src.output<0>(), "router", router.input<0>())
.connect("router", router.output<0>(), "nodeA", nodeA.input<0>())
.connect("router", router.output<1>(), "nodeB", nodeB.input<0>())
.connect("router", router.output<2>(), "nodeC", nodeC.input<0>());
If the selector returns >= N the item is silently dropped.
FilterNode¶
Reads one item and passes it downstream only when a predicate returns true: