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 210 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 226 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 246 of file flow_graph.h.

◆ input_type

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

Definition at line 212 of file flow_graph.h.

◆ predecessor_type

Member Enumeration Documentation

◆ op_stat

Enumerator
WAIT 
SUCCEEDED 
FAILED 

Definition at line 225 of file flow_graph.h.

◆ op_type

Enumerator
reg_pred 
rem_pred 
res_item 
rel_res 
con_res 

Definition at line 220 of file flow_graph.h.

224  {

Constructor & Destructor Documentation

◆ reserving_port() [1/2]

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

Constructor.

Definition at line 331 of file flow_graph.h.

337  :

◆ reserving_port() [2/2]

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

Definition at line 338 of file flow_graph.h.

342  {}
343 

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 377 of file flow_graph.h.

387  { 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 324 of file flow_graph.h.

326  {

◆ handle_operations()

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

Definition at line 250 of file flow_graph.h.

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

◆ 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 350 of file flow_graph.h.

358  { return false; }

◆ release()

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

Release the port.

Definition at line 371 of file flow_graph.h.

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

◆ 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 357 of file flow_graph.h.

358  { return false; }
359 
361  virtual bool remove_predecessor( predecessor_type & ) { return false; }
receiver< input_type >::predecessor_type predecessor_type
Definition: flow_graph.h:213
bool remove_predecessor(predecessor_type &src) __TBB_override
Remove a predecessor.
Definition: flow_graph.h:357

◆ 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 364 of file flow_graph.h.

372  :
373  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 412 of file flow_graph.h.

418  {

◆ 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 345 of file flow_graph.h.

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

◆ 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 320 of file flow_graph.h.

326  {

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 247 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 318 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 319 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 317 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 248 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 421 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 422 of file flow_graph.h.

◆ reserved

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

Definition at line 423 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.