Intel® oneAPI Threading Building Blocks Developer Guide and API Reference
join_node
[flow_graph.join_node]
A node that creates a tuple from a set of messages received at its input ports and broadcasts the tuple to all of its successors.
// Defined in header <oneapi/tbb/flow_graph.h>
namespace oneapi {
namespace tbb {
namespace flow {
using tag_value = /*implementation-specific*/;
template<typename OutputTuple, class JoinPolicy = /*implementation-defined*/>
class join_node : public graph_node, public sender< OutputTuple > {
public:
using input_ports_type = /*implementation-defined*/;
explicit join_node( graph &g );
join_node( const join_node &src );
// Preview feature: Helper Functions for Expressing Graphs
explicit join_node(decltype(follows(...)), JoinPolicy = JoinPolicy());
explicit join_node(decltype(precedes(...)), JoinPolicy = JoinPolicy());
input_ports_type &input_ports( );
bool try_get( OutputTuple &v );
};
template<typename OutputTuple, typename K, class KHash=tbb_hash_compare<K> >
class join_node< OutputTuple, key_matching<K,KHash> > : public graph_node, public sender< OutputTuple > {
public:
using input_ports_type = /*implementation-defined*/;
explicit join_node( graph &g );
join_node( const join_node &src );
template <typename B0, typename... BN>
join_node( graph &g, B0 b0, BN... bn );
join_node( graph &g ); // Preview feature: Type-Specified Message Keys
// Preview feature: Helper Functions for Expressing Graphs
template <typename B0, typename... BN>
join_node(decltype(follows(...)), B0 b0, BN... bn);
template <typename B0, typename... BN>
join_node(decltype(precedes(...)), B0 b0, BN... bn);
input_ports_type &input_ports( );
bool try_get( OutputTuple &v );
};
// Preview feature: Type-Specified Message Keys
template <typename K, typename T>
K key_from_message( const T& t );
} // namespace flow
} // namespace tbb
} // namespace oneapi
Requirements:
The type OutputTuple must be an instantiation of std::tuple. Each type that the tuple stores must meet the DefaultConstructible requirements from [defaultconstructible], CopyConstructible requirements from [copyconstructible] and CopyAssignable requirements from [copyassignable] ISO C++ Standard sections.
The JoinPolicy type must be specified as one of buffering policies for join_node.
The KHash type must meet the HashCompare requirements.
The Bi types must meet the JoinNodeFunctionObject requirements. Since C++17, each of Bi types may also be a pointer to a const member function in Input that returns Key or a pointer to a data member of type Key in Input.
A join_node is a graph_node and a sender<OutputTuple>. It contains a tuple of input ports, each of which is a receiver<Type> for each Type in OutputTuple. It supports multiple input receivers with distinct types and broadcasts a tuple of received messages to all of its successors. All input ports of a join_node must use the same buffering policy.
The behavior of a join_node is based on its buffering policy.
The function template input_port simplifies the syntax for getting a reference to a specific input port.
join_node has a buffering and broadcast-pushproperties.
Member types
input_ports_type is an alias to a tuple of input ports.
Member functions
explicit join_node( graph &g );
Constructs an empty join_node that belongs to the graph g.
template <typename B0, typename... BN>
join_node( graph &g, B0 b0, BN... bn );
A constructor only available in the key_matching specialization of join_node.
Creates a join_node that uses the function objects b0, … , bN to determine the tags for the input ports 0 through N.
Constraints:: only participates in overload resolution if std::tuple_size<OutputTuple>::value is 1 + sizeof...(BN).
join_node( const join_node &src )
Creates a join_node that has the same initial state that src had at its construction. 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 values 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>. The behavior of the ports is based on the selected join_node policy.
bool try_get( output_type &v )
Attempts to generate a tuple based on the buffering policy of the join_node.
If it can successfully generate a tuple, it copies it to v and returns true. Otherwise, it returns false.
Non-Member Types
using tag_value = /*implementation-specific*/;
tag_value is an unsigned integral type for defining the tag_matching policy.
Deduction Guides
template <typename Body, typename... Bodies>
join_node(graph&, Body, Bodies...)
->join_node<std::tuple<std::decay_t<input_t<Body>>, std::decay_t<input_t<Bodies>>...>, key_matching<output_t<Body>>>;
Where:
input_t is an alias to the input argument type of the passed function object.
output_t is an alias to the return type of the passed function object.
Preview Features
The following preview features extend the join_node API:
Type-Specified Message Keys - allows the key_matching specialization to obtain keys via type-associated functions instead of explicit key extractor function objects.
Helper Functions for Expressing Graphs - allows join_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 join_node and wait for all related work to complete.