Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
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_INPUTSdispatch_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_INPUTSmy_port_epoches
 
dispatch_funcs_type my_dispatch_funcs
 
UserFunctor my_user_functor
 
streaming_nodemy_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 376 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 396 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 395 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

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
inlinevirtual

◆ 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... >  )
inlinestaticprivate

Definition at line 399 of file _flow_graph_streaming_node.h.

399  {
401  return dispatch;
402  }
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
void send_and_put_impl(size_t &epoch, const indexer_node_output_type &v, typename device_selector_node::output_ports_type &op)

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 
)
inlineprivate

Definition at line 426 of file _flow_graph_streaming_node.h.

426  {
427  typename std::unordered_map<typename std::decay<key_type>::type, epoch_desc>::iterator it = my_devices.find( key );
428  if ( it == my_devices.end() ) {
430  std::tie( it, std::ignore ) = my_devices.insert( std::make_pair( key, d ) );
431  bool res = dp.try_put( device_with_key_type( d, key ) );
432  __TBB_ASSERT_EX( res, NULL );
433  my_node.notify_new_device( d );
434  }
435  epoch_desc &e = it->second;
436  device_type d = e.my_device;
437  if ( ++e.my_request_number == NUM_INPUTS ) my_devices.erase( it );
438  return d;
439  }
std::unordered_map< typename std::decay< key_type >::type, epoch_desc > my_devices
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
internal::streaming_device_with_key< device_type, key_type > device_with_key_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
#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
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

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 
)
inlineprivate

Definition at line 405 of file _flow_graph_streaming_node.h.

405  {
407  return epoch++;
408  }
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:553
Detects whether two given types are the same.

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 &   
)
inlineprivate

Definition at line 411 of file _flow_graph_streaming_node.h.

411  {
413  return key_from_message<key_type>( t );
414  }
K key_from_message(const T &t)
Definition: flow_graph.h:721

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 
)
inlinevirtual

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

Definition at line 385 of file _flow_graph_streaming_node.h.

385  {
386  (this->*my_dispatch_funcs[ v.tag() ])( my_port_epoches[ v.tag() ], v, op );
388  || my_port_epoches[v.tag()] == 0, "Epoch is changed when key matching is requested" );
389  }
bool_constant< false > false_type
Definition: tbb_stddef.h:490
Detects whether two given types are the same.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
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

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 
)
inlineprivate

Definition at line 417 of file _flow_graph_streaming_node.h.

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

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 447 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 449 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 452 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 451 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 448 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 450 of file _flow_graph_streaming_node.h.


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

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.