Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface11::internal::reserving_port< T > Class Template Reference

The two-phase join port. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface11::internal::reserving_port< T >:
Collaboration diagram for tbb::flow::interface11::internal::reserving_port< T >:

Classes

class  reserving_port_operation
 

Public Types

typedef T input_type
 
typedef receiver< input_type >::predecessor_type predecessor_type
 
- Public Types inherited from tbb::flow::interface11::internal::untyped_receiver
typedef untyped_sender predecessor_type
 The predecessor type for this node. More...
 

Public Member Functions

 reserving_port ()
 Constructor. More...
 
 reserving_port (const reserving_port &)
 
void set_join_node_pointer (forwarding_base *join)
 
bool register_predecessor (predecessor_type &src) __TBB_override
 Add a predecessor. More...
 
bool remove_predecessor (predecessor_type &src) __TBB_override
 Remove a predecessor. More...
 
bool reserve (T &v)
 Reserve an item from the port. More...
 
void release ()
 Release the port. More...
 
void consume ()
 Complete use of the port. More...
 
void reset_receiver (reset_flags f) __TBB_override
 put receiver back in initial state More...
 
- Public Member Functions inherited from tbb::flow::interface11::receiver< T >
bool try_put (const typename internal::async_helpers< T >::filtered_type &t)
 Put an item to the receiver. More...
 
bool try_put (const typename internal::async_helpers< T >::async_type &t)
 
- Public Member Functions inherited from tbb::flow::interface11::internal::untyped_receiver
virtual ~untyped_receiver ()
 Destructor. More...
 
template<typename X >
bool try_put (const X &t)
 Put an item to the receiver. More...
 

Protected Member Functions

tasktry_put_task (const T &) __TBB_override
 Put item to successor; return task to run the successor if possible. More...
 
graphgraph_reference () const __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface11::receiver< T >
virtual tasktry_put_task_wrapper (const void *p, bool is_async) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface11::internal::untyped_receiver
template<typename X >
tasktry_put_task (const X &t)
 
virtual bool is_continue_receiver ()
 

Private Types

enum  op_type {
  reg_pred, rem_pred, res_item, rel_res,
  con_res
}
 
typedef reserving_port< T > class_type
 
typedef internal::aggregating_functor< class_type, reserving_port_operationhandler_type
 

Private Member Functions

void handle_operations (reserving_port_operation *op_list)
 

Private Attributes

aggregator< handler_type, reserving_port_operationmy_aggregator
 
forwarding_basemy_join
 
reservable_predecessor_cache< T, null_mutexmy_predecessors
 
bool reserved
 

Friends

class internal::aggregating_functor< class_type, reserving_port_operation >
 
template<typename R , typename B >
class run_and_put_task
 
template<typename X , typename Y >
class internal::broadcast_cache
 
template<typename X , typename Y >
class internal::round_robin_cache
 

Additional Inherited Members

- Public Attributes inherited from tbb::flow::interface11::receiver< T >
__TBB_DEPRECATED typedef T input_type
 The input type of this receiver. More...
 
__TBB_DEPRECATED typedef internal::async_helpers< T >::filtered_type filtered_type
 

Detailed Description

template<typename T>
class tbb::flow::interface11::internal::reserving_port< T >

The two-phase join port.

Definition at line 210 of file flow_graph.h.

Member Typedef Documentation

◆ class_type

template<typename T >
typedef reserving_port<T> tbb::flow::interface11::internal::reserving_port< T >::class_type
private

Definition at line 225 of file flow_graph.h.

◆ handler_type

template<typename T >
typedef internal::aggregating_functor<class_type, reserving_port_operation> tbb::flow::interface11::internal::reserving_port< T >::handler_type
private

Definition at line 245 of file flow_graph.h.

◆ input_type

template<typename T >
typedef T tbb::flow::interface11::internal::reserving_port< T >::input_type

Definition at line 212 of file flow_graph.h.

◆ predecessor_type

Member Enumeration Documentation

◆ op_type

Enumerator
reg_pred 
rem_pred 
res_item 
rel_res 
con_res 

Definition at line 220 of file flow_graph.h.

223  {
224  typedef async_msg<T> async_type;

Constructor & Destructor Documentation

◆ reserving_port() [1/2]

template<typename T >
tbb::flow::interface11::internal::reserving_port< T >::reserving_port ( )
inline

Constructor.

Definition at line 330 of file flow_graph.h.

341  :

◆ reserving_port() [2/2]

template<typename T >
tbb::flow::interface11::internal::reserving_port< T >::reserving_port ( const reserving_port< T > &  )
inline

Definition at line 337 of file flow_graph.h.

341  :

Member Function Documentation

◆ consume()

template<typename T >
void tbb::flow::interface11::internal::reserving_port< T >::consume ( )
inline

Complete use of the port.

Definition at line 376 of file flow_graph.h.

377  {
378  task *res = try_put_task(t);
379  if (!res) return false;
task * try_put_task(const T &) __TBB_override
Put item to successor; return task to run the successor if possible.
Definition: flow_graph.h:319
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 * task

◆ graph_reference()

template<typename T >
graph& tbb::flow::interface11::internal::reserving_port< T >::graph_reference ( ) const
inlineprotectedvirtual

Implements tbb::flow::interface11::internal::untyped_receiver.

Definition at line 323 of file flow_graph.h.

326  { return false; }

◆ handle_operations()

template<typename T >
void tbb::flow::interface11::internal::reserving_port< T >::handle_operations ( reserving_port_operation op_list)
inlineprivate

Definition at line 249 of file flow_graph.h.

256  {
257  // Incoming 't' is NOT async
258  return this_recv->try_put_task(from_void_ptr(p));
259  }
260  }
261 };
262 
263 template< typename T >
264 struct async_helpers< T, typename std::enable_if< std::is_base_of<async_msg<typename T::async_msg_data_type>, T>::value >::type > {
265  typedef T async_type;
266  typedef typename T::async_msg_data_type filtered_type;
267 
268  static const bool is_async_type = true;
269 
270  // Receiver-classes use const interfaces
271  static const void* to_void_ptr(const T& t) {
272  return static_cast<const void*>(&static_cast<const async_msg<filtered_type>&>(t));
273  }
274 
275  static void* to_void_ptr(T& t) {
276  return static_cast<void*>(&static_cast<async_msg<filtered_type>&>(t));
277  }
278 
279  // Sender-classes use non-const interfaces
280  static const T& from_void_ptr(const void* p) {
281  return *static_cast<const T*>(static_cast<const async_msg<filtered_type>*>(p));
282  }
283 
284  static T& from_void_ptr(void* p) {
285  return *static_cast<T*>(static_cast<async_msg<filtered_type>*>(p));
286  }
287 
288  // Used in receiver<T> class
289  static task* try_put_task_wrapper_impl(receiver<T>* const this_recv, const void *p, bool is_async) {
290  if (is_async) {
291  // Both are async
292  return this_recv->try_put_task(from_void_ptr(p));
293  }
294  else {
295  // This (T) is async and incoming 'X t' is NOT async
296  // Create async_msg for X
298  const T msg(t);
299  return this_recv->try_put_task(msg);
300  }
301  }
302 };
303 
304 class untyped_receiver;
305 
306 class untyped_sender {
307  template< typename, typename > friend class internal::predecessor_cache;
308  template< typename, typename > friend class internal::reservable_predecessor_cache;
309 public:
311  typedef untyped_receiver successor_type;
312 
313  virtual ~untyped_sender() {}
static const T & from_void_ptr(const void *p)
Definition: flow_graph.h:237
void const char const char int ITT_FORMAT __itt_group_sync p
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 * task
An cache of predecessors that supports requests and reservations.
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
__TBB_DEPRECATED typedef internal::async_helpers< T >::filtered_type filtered_type
Definition: flow_graph.h:469
A cache of predecessors that only supports try_get.

◆ register_predecessor()

template<typename T >
bool tbb::flow::interface11::internal::reserving_port< T >::register_predecessor ( predecessor_type src)
inlinevirtual

Add a predecessor.

Reimplemented from tbb::flow::interface11::internal::untyped_receiver.

Definition at line 349 of file flow_graph.h.

350  {
352  }
353 
static const void * to_void_ptr(const T &t)
Definition: flow_graph.h:229

◆ release()

template<typename T >
void tbb::flow::interface11::internal::reserving_port< T >::release ( )
inline

Release the port.

Definition at line 370 of file flow_graph.h.

373  {}

◆ remove_predecessor()

template<typename T >
bool tbb::flow::interface11::internal::reserving_port< T >::remove_predecessor ( predecessor_type src)
inlinevirtual

Remove a predecessor.

Reimplemented from tbb::flow::interface11::internal::untyped_receiver.

Definition at line 356 of file flow_graph.h.

358  {
359  template< typename, typename > friend class run_and_put_task;
360 

◆ reserve()

template<typename T >
bool tbb::flow::interface11::internal::reserving_port< T >::reserve ( T &  v)
inline

Reserve an item from the port.

Definition at line 363 of file flow_graph.h.

368  :

◆ reset_receiver()

template<typename T >
void tbb::flow::interface11::internal::reserving_port< T >::reset_receiver ( reset_flags  f)
inlinevirtual

put receiver back in initial state

Implements tbb::flow::interface11::internal::untyped_receiver.

Definition at line 411 of file flow_graph.h.

418  { return false; }

◆ set_join_node_pointer()

template<typename T >
void tbb::flow::interface11::internal::reserving_port< T >::set_join_node_pointer ( forwarding_base join)
inline

Definition at line 344 of file flow_graph.h.

◆ try_put_task()

template<typename T >
task* tbb::flow::interface11::internal::reserving_port< T >::try_put_task ( const T &  t)
inlineprotectedvirtual

Put item to successor; return task to run the successor if possible.

Implements tbb::flow::interface11::receiver< T >.

Definition at line 319 of file flow_graph.h.

326  { return false; }

Friends And Related Function Documentation

◆ internal::aggregating_functor< class_type, reserving_port_operation >

template<typename T >
friend class internal::aggregating_functor< class_type, reserving_port_operation >
friend

Definition at line 246 of file flow_graph.h.

◆ internal::broadcast_cache

template<typename T >
template<typename X , typename Y >
friend class internal::broadcast_cache
friend

Definition at line 317 of file flow_graph.h.

◆ internal::round_robin_cache

template<typename T >
template<typename X , typename Y >
friend class internal::round_robin_cache
friend

Definition at line 318 of file flow_graph.h.

◆ run_and_put_task

template<typename T >
template<typename R , typename B >
friend class run_and_put_task
friend

Definition at line 316 of file flow_graph.h.

Member Data Documentation

◆ my_aggregator

template<typename T >
aggregator<handler_type, reserving_port_operation> tbb::flow::interface11::internal::reserving_port< T >::my_aggregator
private

Definition at line 247 of file flow_graph.h.

◆ my_join

template<typename T >
forwarding_base* tbb::flow::interface11::internal::reserving_port< T >::my_join
private

Definition at line 424 of file flow_graph.h.

◆ my_predecessors

template<typename T >
reservable_predecessor_cache< T, null_mutex > tbb::flow::interface11::internal::reserving_port< T >::my_predecessors
private

Definition at line 425 of file flow_graph.h.

◆ reserved

template<typename T >
bool tbb::flow::interface11::internal::reserving_port< T >::reserved
private

Definition at line 426 of file flow_graph.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.