Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface10::internal::reserving_port< T > Class Template Reference

The two-phase join port. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface10::internal::reserving_port< T >:
Collaboration diagram for tbb::flow::interface10::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::interface10::receiver< T >
typedef T input_type
 The input type of this receiver. More...
 
typedef internal::async_helpers< T >::filtered_type filtered_type
 
- Public Types inherited from tbb::flow::interface10::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::interface10::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::interface10::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 () __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface10::receiver< T >
virtual tasktry_put_task_wrapper (const void *p, bool is_async) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface10::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
}
 
enum  op_stat { WAIT =0, SUCCEEDED, FAILED }
 
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
 

Detailed Description

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

The two-phase join port.

Definition at line 214 of file flow_graph.h.

Member Typedef Documentation

◆ class_type

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

Definition at line 230 of file flow_graph.h.

◆ handler_type

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

Definition at line 250 of file flow_graph.h.

◆ input_type

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

Definition at line 216 of file flow_graph.h.

◆ predecessor_type

Member Enumeration Documentation

◆ op_stat

Enumerator
WAIT 
SUCCEEDED 
FAILED 

Definition at line 229 of file flow_graph.h.

◆ op_type

Enumerator
reg_pred 
rem_pred 
res_item 
rel_res 
con_res 

Definition at line 224 of file flow_graph.h.

228  {

Constructor & Destructor Documentation

◆ reserving_port() [1/2]

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

Constructor.

Definition at line 335 of file flow_graph.h.

341  :

◆ reserving_port() [2/2]

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

Definition at line 342 of file flow_graph.h.

346  {}
347 

Member Function Documentation

◆ consume()

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

Complete use of the port.

Definition at line 381 of file flow_graph.h.

391  { return false; }

◆ graph_reference()

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

Implements tbb::flow::interface10::internal::untyped_receiver.

Definition at line 328 of file flow_graph.h.

330  {

◆ handle_operations()

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

Definition at line 254 of file flow_graph.h.

256  {
257  return *static_cast<T*>(static_cast<async_msg<filtered_type>*>(p));
258  }
259 
260  // Used in receiver<T> class
261  static task* try_put_task_wrapper_impl(receiver<T>* const this_recv, const void *p, bool is_async) {
262  if (is_async) {
263  // Both are async
264  return this_recv->try_put_task(from_void_ptr(p));
265  }
266  else {
267  // This (T) is async and incoming 'X t' is NOT async
268  // Create async_msg for X
270  const T msg(t);
271  return this_recv->try_put_task(msg);
272  }
273  }
274 };
275 
276 class untyped_receiver;
277 
278 class untyped_sender {
279  template< typename, typename > friend class internal::predecessor_cache;
280  template< typename, typename > friend class internal::reservable_predecessor_cache;
281 public:
283  typedef untyped_receiver successor_type;
284 
285  virtual ~untyped_sender() {}
286 
287  // NOTE: Following part of PUBLIC section is copy-paste from original sender<T> class
288 
289  // TODO: Prevent untyped successor registration
290 
292  virtual bool register_successor( successor_type &r ) = 0;
293 
295  virtual bool remove_successor( successor_type &r ) = 0;
296 
298  virtual bool try_release( ) { return false; }
299 
301  virtual bool try_consume( ) { return false; }
302 
303 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
304  typedef internal::edge_container<successor_type> built_successors_type;
306  typedef built_successors_type::edge_list_type successor_list_type;
307  virtual built_successors_type &built_successors() = 0;
308  virtual void internal_add_built_successor( successor_type & ) = 0;
309  virtual void internal_delete_built_successor( successor_type & ) = 0;
310  virtual void copy_successors( successor_list_type &) = 0;
311  virtual size_t successor_count() = 0;
312 #endif /* TBB_DEPRECATED_FLOW_NODE_EXTRACTION */
313 protected:
315  template< typename X >
316  bool try_get( X &t ) {
318  }
A cache of predecessors that only supports try_get.
static const void * to_void_ptr(const T &t)
Definition: flow_graph.h:201
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
internal::async_helpers< T >::filtered_type filtered_type
Definition: flow_graph.h:442
static const T & from_void_ptr(const void *p)
Definition: flow_graph.h:209
An cache of predecessors that supports requests and reservations.

◆ register_predecessor()

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

Add a predecessor.

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

Definition at line 354 of file flow_graph.h.

362  { return false; }

◆ release()

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

Release the port.

Definition at line 375 of file flow_graph.h.

376  :
377  template<typename X>
378  task *try_put_task(const X& t) {
task * try_put_task(const T &) __TBB_override
Put item to successor; return task to run the successor if possible.
Definition: flow_graph.h:324
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

◆ remove_predecessor()

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

Remove a predecessor.

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

Definition at line 361 of file flow_graph.h.

362  { return false; }
363 
365  virtual bool remove_predecessor( predecessor_type & ) { return false; }
receiver< input_type >::predecessor_type predecessor_type
Definition: flow_graph.h:217
bool remove_predecessor(predecessor_type &src) __TBB_override
Remove a predecessor.
Definition: flow_graph.h:361

◆ reserve()

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

Reserve an item from the port.

Definition at line 368 of file flow_graph.h.

376  :
377  template<typename X>

◆ reset_receiver()

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

put receiver back in initial state

Implements tbb::flow::interface10::internal::untyped_receiver.

Definition at line 416 of file flow_graph.h.

422  {

◆ set_join_node_pointer()

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

Definition at line 349 of file flow_graph.h.

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

◆ try_put_task()

template<typename T >
task* tbb::flow::interface10::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::interface10::receiver< T >.

Definition at line 324 of file flow_graph.h.

330  {

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 251 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 322 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 323 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 321 of file flow_graph.h.

Member Data Documentation

◆ my_aggregator

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

Definition at line 252 of file flow_graph.h.

◆ my_join

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

Definition at line 425 of file flow_graph.h.

◆ my_predecessors

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

Definition at line 426 of file flow_graph.h.

◆ reserved

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

Definition at line 427 of file flow_graph.h.


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

Copyright © 2005-2019 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.