streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor > Class Template Reference
Inheritance diagram for streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >:
Collaboration diagram for streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >:

## Classes

struct | epoch_desc

## Public Member Functions

| device_selector (UserFunctor uf, streaming_node &n, StreamFactory &f)
void | operator() (const indexer_node_output_type &v, typename device_selector_node::output_ports_type &op) __TBB_override
device_selector_base * | clone (streaming_node &n) const __TBB_override
Public Member Functions inherited from streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector_base
virtual | ~device_selector_base ()

## Private Types

typedef void(device_selector< UserFunctor >::* | send_and_put_fn_type) (size_t &, const indexer_node_output_type &, typename device_selector_node::output_ports_type &)
typedef std::array< send_and_put_fn_type, NUM_INPUTS > | dispatch_funcs_type

## Private Member Functions

template<typename T >
key_type | get_key (std::false_type, const T &, size_t &epoch)
template<typename T >
key_type | get_key (std::true_type, const T &t, size_t &)
template<int N>
void | send_and_put_impl (size_t &epoch, const indexer_node_output_type &v, typename device_selector_node::output_ports_type &op)
template<typename DevicePort >
device_type | get_device (key_type key, DevicePort &dp)
Private Member Functions inherited from tbb::internal::no_assign
void | operator= (const no_assign &)=delete
| no_assign (const no_assign &)=default
| no_assign ()=default

## Static Private Member Functions

template<int... S>
static dispatch_funcs_type | create_dispatch_funcs (internal::sequence< S... >)

## Private Attributes

std::unordered_map< typename std::decay< key_type >::type, epoch_desc > | my_devices
std::array< size_t, NUM_INPUTS > | my_port_epoches
dispatch_funcs_type | my_dispatch_funcs
UserFunctor | my_user_functor
streaming_node & | my_node
StreamFactory & | my_factory

## Detailed Description

### template<typename... Ports, typename JP, typename StreamFactory>
template<typename UserFunctor>
class streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >

Definition at line 375 of file _flow_graph_streaming_node.h.

## Member Typedef Documentation

## dispatch_funcs_type

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

typedef std::array< send_and_put_fn_type, NUM_INPUTS > streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::dispatch_funcs_type

private

Definition at line 395 of file _flow_graph_streaming_node.h.

## send_and_put_fn_type

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

typedef void(device_selector<UserFunctor>::* streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::send_and_put_fn_type) (size_t &, const indexer_node_output_type &, typename device_selector_node::output_ports_type &)

private

Definition at line 394 of file _flow_graph_streaming_node.h.

## Constructor & Destructor Documentation

## device_selector()

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::device_selector | ( | UserFunctor | uf,
|  | streaming_node< tuple< Ports... >, JP, StreamFactory > & | n,
|  | StreamFactory & | f
| ) |  |

inline

Definition at line 377 of file _flow_graph_streaming_node.h.

: my_dispatch_funcs( create_dispatch_funcs( input_sequence() ) )
, my_user_functor( uf ), my_node(n), my_factory( f )
{
my_port_epoches.fill( 0 );
}

## Member Function Documentation

## clone()

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

device_selector_base* streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::clone | ( | streaming_node< tuple< Ports... >, JP, StreamFactory > & | n | ) | const

inline virtual

Implements streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector_base.

Definition at line 390 of file _flow_graph_streaming_node.h.

{
return new device_selector( my_user_functor, n, my_factory );
}

## create_dispatch_funcs()

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >
template<int... S>

static dispatch_funcs_type streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::create_dispatch_funcs | ( | internal::sequence< S... > |  | ) |

inline static private

Definition at line 398 of file _flow_graph_streaming_node.h.

{
dispatch_funcs_type dispatch = { { &device_selector<UserFunctor>::send_and_put_impl<S>... } };
return dispatch;
}

References S.

## get_device()

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >
template<typename DevicePort >

device_type streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::get_device | ( | key_type | key,
|  | DevicePort & | dp
| ) |  |

inline private

Definition at line 425 of file _flow_graph_streaming_node.h.

{
typename std::unordered_map<typename std::decay<key_type>::type, epoch_desc>::iterator it = my_devices.find( key );
if ( it == my_devices.end() ) {
device_type d = my_user_functor( my_factory );
std::tie( it, std::ignore ) = my_devices.insert( std::make_pair( key, d ) );
bool res = dp.try_put( device_with_key_type( d, key ) );
__TBB_ASSERT_EX( res, NULL );
my_node.notify_new_device( d );
}
epoch_desc &e = it->second;
device_type d = e.my_device;
if ( ++e.my_request_number == NUM_INPUTS ) my_devices.erase( it );
return d;
}

References __TBB_ASSERT_EX, d, key, and type.

## get_key() [1/2]

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >
template<typename T >

key_type streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::get_key | ( | std::false_type | ,
|  | const T & | ,
|  | size_t & | epoch
| ) |  |

inline private

Definition at line 404 of file _flow_graph_streaming_node.h.

{
__TBB_STATIC_ASSERT( (tbb::internal::is_same_type<key_type, size_t>::value), "" );
return epoch++;
}

References __TBB_STATIC_ASSERT.

## get_key() [2/2]

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >
template<typename T >

key_type streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::get_key | ( | std::true_type | ,
|  | const T & | t,
|  | size_t & |
| ) |  |

inline private

Definition at line 410 of file _flow_graph_streaming_node.h.

{
using tbb::flow::key_from_message;
return key_from_message<key_type>( t );
}

References tbb::flow::key_from_message().

Here is the call graph for this function:

## operator()()

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

void streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::operator() | ( | const indexer_node_output_type & | v,
|  | typename device_selector_node::output_ports_type & | op
| ) |  |

inline virtual

Implements streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector_base.

Definition at line 384 of file _flow_graph_streaming_node.h.

{
(this->*my_dispatch_funcs[ v.tag() ])( my_port_epoches[ v.tag() ], v, op );
__TBB_ASSERT( (tbb::internal::is_same_type<typename internal::key_from_policy<JP>::is_key_matching, std::false_type>::value)
|| my_port_epoches[v.tag()] == 0, "Epoch is changed when key matching is requested" );
}

References __TBB_ASSERT, and value.

## send_and_put_impl()

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >
template<int N>

void streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::send_and_put_impl | ( | size_t & | epoch,
|  | const indexer_node_output_type & | v,
|  | typename device_selector_node::output_ports_type & | op
| ) |  |

inline private

Definition at line 416 of file _flow_graph_streaming_node.h.

{
typedef typename tuple_element<N + 1, typename device_selector_node::output_ports_type>::type::output_type elem_type;
elem_type e = internal::cast_to<elem_type>( v );
device_type device = get_device( get_key( typename internal::key_from_policy<JP>::is_key_matching(), e, epoch ), get<0>( op ) );
my_factory.send_data( device, e );
get<N + 1>( op ).try_put( e );
}

## Member Data Documentation

## my_devices

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

std::unordered_map<typename std::decay<key_type>::type, epoch_desc> streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::my_devices

private

Definition at line 446 of file _flow_graph_streaming_node.h.

## my_dispatch_funcs

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

dispatch_funcs_type streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::my_dispatch_funcs

private

Definition at line 448 of file _flow_graph_streaming_node.h.

## my_factory

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

StreamFactory& streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::my_factory

private

Definition at line 451 of file _flow_graph_streaming_node.h.

## my_node

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

streaming_node& streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::my_node

private

Definition at line 450 of file _flow_graph_streaming_node.h.

## my_port_epoches

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

std::array<size_t, NUM_INPUTS> streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::my_port_epoches

private

Definition at line 447 of file _flow_graph_streaming_node.h.

## my_user_functor

template<typename... Ports, typename JP , typename StreamFactory >
template<typename UserFunctor >

UserFunctor streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector< UserFunctor >::my_user_functor

private

Definition at line 449 of file _flow_graph_streaming_node.h.

The documentation for this class was generated from the following file:

- _flow_graph_streaming_node.h

streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::my_node
streaming_node & my_node
Definition: _flow_graph_streaming_node.h:450
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::send_and_put_impl
void send_and_put_impl(size_t &epoch, const indexer_node_output_type &v, typename device_selector_node::output_ports_type &op)
Definition: _flow_graph_streaming_node.h:416
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_with_key_type
internal::streaming_device_with_key< device_type, key_type > device_with_key_type
Definition: _flow_graph_streaming_node.h:317
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::my_user_functor
UserFunctor my_user_functor
Definition: _flow_graph_streaming_node.h:449
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::dispatch_funcs_type
std::array< send_and_put_fn_type, NUM_INPUTS > dispatch_funcs_type
Definition: _flow_graph_streaming_node.h:395
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::get_key
key_type get_key(std::false_type, const T &, size_t &epoch)
Definition: _flow_graph_streaming_node.h:404
d
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d
Definition: ittnotify_static.h:109
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::my_factory
StreamFactory & my_factory
Definition: _flow_graph_streaming_node.h:451
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_type
StreamFactory::device_type device_type
Definition: _flow_graph_streaming_node.h:314
streaming_node< tuple< Ports... >, JP, StreamFactory >::NUM_INPUTS
static const size_t NUM_INPUTS
Definition: _flow_graph_streaming_node.h:319
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::device_selector
device_selector(UserFunctor uf, streaming_node &n, StreamFactory &f)
Definition: _flow_graph_streaming_node.h:377
tbb::flow::key_from_message
K key_from_message(const T &t)
Definition: flow_graph.h:713
__TBB_STATIC_ASSERT
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:553
key
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle * key
Definition: ittnotify_static.h:198
internal::key_from_policy::is_key_matching
std::false_type is_key_matching
Definition: _flow_graph_streaming_node.h:75
tbb::internal::is_same_type
Detects whether two given types are the same.
Definition: _template_helpers.h:61
value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
Definition: ittnotify_static.h:192
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::create_dispatch_funcs
static dispatch_funcs_type create_dispatch_funcs(internal::sequence< S... >)
Definition: _flow_graph_streaming_node.h:398
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::my_devices
std::unordered_map< typename std::decay< key_type >::type, epoch_desc > my_devices
Definition: _flow_graph_streaming_node.h:446
tbb::internal::false_type
bool_constant< false > false_type
Definition: tbb_stddef.h:490
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::my_port_epoches
std::array< size_t, NUM_INPUTS > my_port_epoches
Definition: _flow_graph_streaming_node.h:447
streaming_node< tuple< Ports... >, JP, StreamFactory >::input_sequence
internal::make_sequence< NUM_INPUTS >::type input_sequence
Definition: _flow_graph_streaming_node.h:322
S
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark S
Definition: ittnotify_static.h:212
type
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
Definition: ittnotify_static.h:198
__TBB_ASSERT_EX
#define __TBB_ASSERT_EX(predicate, comment)
"Extended" version is useful to suppress warnings if a variable is only used with an assert
Definition: tbb_stddef.h:167
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::my_dispatch_funcs
dispatch_funcs_type my_dispatch_funcs
Definition: _flow_graph_streaming_node.h:448
streaming_node< tuple< Ports... >, JP, StreamFactory >::device_selector::get_device
device_type get_device(key_type key, DevicePort &dp)
Definition: _flow_graph_streaming_node.h:425

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.