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.

222  {
223  typedef async_msg<T> async_type;
224  typedef T filtered_type;
__TBB_DEPRECATED typedef internal::async_helpers< T >::filtered_type filtered_type
Definition: flow_graph.h:468

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.

340  :

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

340  :
342  template< typename X >

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.

376  {
377  task *res = try_put_task(t);
378  if (!res) return false;
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
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
static tbb::task *const SUCCESSFULLY_ENQUEUED
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 & graph_reference() const __TBB_override
Definition: flow_graph.h:323

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

325  { 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.

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

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

349  {
351  }
352 
353  virtual bool try_get_wrapper( void* p, bool is_async ) = 0;
static const void * to_void_ptr(const T &t)
Definition: flow_graph.h:228
void const char const char int ITT_FORMAT __itt_group_sync p

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

372  {}
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.

357  {
358  template< typename, typename > friend class run_and_put_task;
359 
360  template< typename, typename > friend class internal::broadcast_cache;
A cache of successors that are broadcast to.

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

367  :

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

417  { 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.

349  {

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

325  { 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.