Intel® oneAPI Threading Building Blocks Developer Guide and API Reference
indexer_node
[flow_graph.indexer_node]
indexer_node broadcasts messages received at input ports to all of its successors. The messages are broadcast individually as they are received at each port. The output is a tagged message that contains a tag and a value; the tag identifies the input port on which the message was received.
// Defined in header <oneapi/tbb/flow_graph.h>
namespace oneapi {
namespace tbb {
namespace flow {
template<typename T0, typename... TN>
class indexer_node : public graph_node, public sender</*implementation_defined*/> {
public:
indexer_node(graph &g);
indexer_node(const indexer_node &src);
// Preview feature: Helper Functions for Expressing Graphs
indexer_node(decltype(follows(...)));
indexer_node(decltype(precedes(...)));
using input_ports_type = /*implementation_defined*/;
input_ports_type &input_ports();
using output_type = tagged_msg<size_t, T0, TN...>;
bool try_get( output_type &v );
};
} // namespace flow
} // namespace tbb
} // namespace oneapi
Requirements:
The T0 type and all types in TN template parameter pack must meet the CopyConstructible requirements from [copyconstructible] ISO C++ Standard section.
An indexer_node is a graph_node and sender<tagged_msg<size_t, T0, TN...>>. It contains a tuple of input ports, each of which is a receiver specified by corresponding input template parameter pack element. It supports multiple input receivers with distinct types and broadcasts each received message to all of its successors. Unlike a join_node, each message is broadcast individually to all successors of the indexer_node as it arrives at an input port. Before broadcasting, a message is tagged with the index of the port on which the message arrived.
indexer_node has a discarding and broadcast-pushproperties.
The function template input_port simplifies the syntax for getting a reference to a specific input port.
Member types
input_ports_type is an alias to a std::tuple of input ports.
output_type is an alias to the message of type tagged_msg, which is sent to successors.
Member functions
indexer_node(graph&g)
Constructs an indexer_node that belongs to the graph g.
indexer_node(constindexer_node&src)
Constructs an indexer_node. The list of predecessors, messages in the input ports, and successors are not copied.
input_ports_type&input_ports()
Returns: A std::tuple of receivers. Each element inherits from receiver<T> where T is the type of message expected at that input. Each tuple element can be used like any other receiver<T>.
booltry_get(output_type&v)
An indexer_node contains no buffering and therefore does not support gets.
Returns: false.
Preview Features
The following preview features extend the indexer_node API:
Helper Functions for Expressing Graphs - allows indexer_node to be constructed as a successor or a predecessor of the set of nodes.
Waiting for Single Message in Flow Graph - allows to put messages to input ports of indexer_node and wait for all related work to complete.
See also: