internal::reserving_port< T > Class Template Reference

The two-phase join port. More...

`#include <_flow_graph_join_impl.h>`

Inheritance diagram for internal::reserving_port< T >:
Collaboration diagram for internal::reserving_port< T >:

## Classes

class | reserving_port_operation

## Public Types

typedef T | input_type
typedef receiver< input_type >::predecessor_type | predecessor_type

## 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

## Protected Member Functions

task * | try_put_task (const T &) __TBB_override
graph & | graph_reference () const __TBB_override

## 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_operation > | handler_type

## Private Member Functions

void | handle_operations (reserving_port_operation *op_list)

## Private Attributes

aggregator< handler_type, reserving_port_operation > | my_aggregator
forwarding_base * | my_join
reservable_predecessor_cache< T, null_mutex > | my_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 internal::reserving_port< T >

The two-phase join port.

Definition at line 209 of file _flow_graph_join_impl.h.

## Member Typedef Documentation

## class_type

template<typename T >

typedef reserving_port<T> internal::reserving_port< T >::class_type

private

Definition at line 224 of file _flow_graph_join_impl.h.

## handler_type

template<typename T >

typedef internal::aggregating_functor<class_type, reserving_port_operation> internal::reserving_port< T >::handler_type

private

Definition at line 244 of file _flow_graph_join_impl.h.

## input_type

template<typename T >

typedef T internal::reserving_port< T >::input_type

Definition at line 211 of file _flow_graph_join_impl.h.

## predecessor_type

template<typename T >

typedef receiver<input_type>::predecessor_type internal::reserving_port< T >::predecessor_type

Definition at line 212 of file _flow_graph_join_impl.h.

## Member Enumeration Documentation

## op_type

template<typename T >

enum internal::reserving_port::op_type

private

Enumerator
reg_pred |
rem_pred |
res_item |
rel_res |
con_res |

Definition at line 219 of file _flow_graph_join_impl.h.

{ reg_pred, rem_pred, res_item, rel_res, con_res
#if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
, add_blt_pred, del_blt_pred, blt_pred_cnt, blt_pred_cpy
#endif
};

## Constructor & Destructor Documentation

## reserving_port() [1/2]

template<typename T >

internal::reserving_port< T >::reserving_port | ( |  | ) |

inline

Constructor.

Definition at line 329 of file _flow_graph_join_impl.h.

: reserved(false) {
my_join = NULL;
my_predecessors.set_owner( this );
my_aggregator.initialize_handler(handler_type(this));
}

References internal::reserving_port< T >::my_aggregator, internal::reserving_port< T >::my_join, internal::reserving_port< T >::my_predecessors, and internal::predecessor_cache< T, M >::set_owner().

Here is the call graph for this function:

## reserving_port() [2/2]

template<typename T >

internal::reserving_port< T >::reserving_port | ( | const reserving_port< T > & |  | ) |

inline

Definition at line 336 of file _flow_graph_join_impl.h.

: receiver<T>() {
reserved = false;
my_join = NULL;
my_predecessors.set_owner( this );
my_aggregator.initialize_handler(handler_type(this));
}

References internal::reserving_port< T >::my_aggregator, internal::reserving_port< T >::my_join, internal::reserving_port< T >::my_predecessors, internal::reserving_port< T >::reserved, and internal::predecessor_cache< T, M >::set_owner().

Here is the call graph for this function:

## Member Function Documentation

## consume()

template<typename T >

void internal::reserving_port< T >::consume | ( |  | ) |

inline

Complete use of the port.

Definition at line 375 of file _flow_graph_join_impl.h.

{
reserving_port_operation op_data(con_res);
my_aggregator.execute(&op_data);
}

References internal::reserving_port< T >::con_res, and internal::reserving_port< T >::my_aggregator.

## graph_reference()

template<typename T >

graph& internal::reserving_port< T >::graph_reference | ( |  | ) | const

inline protected

Definition at line 322 of file _flow_graph_join_impl.h.

{
return my_join->graph_ref;
}

References internal::forwarding_base::graph_ref, and internal::reserving_port< T >::my_join.

## handle_operations()

template<typename T >

void internal::reserving_port< T >::handle_operations | ( | reserving_port_operation * | op_list | ) |

inline private

Definition at line 248 of file _flow_graph_join_impl.h.

{
reserving_port_operation *current;
bool no_predecessors;
while(op_list) {
current = op_list;
op_list = op_list->next;
switch(current->type) {
case reg_pred:
no_predecessors = my_predecessors.empty();
my_predecessors.add(*(current->my_pred));
if ( no_predecessors ) {
(void) my_join->decrement_port_count(true); // may try to forward
}
__TBB_store_with_release(current->status, SUCCEEDED);
break;
case rem_pred:
my_predecessors.remove(*(current->my_pred));
if(my_predecessors.empty()) my_join->increment_port_count();
__TBB_store_with_release(current->status, SUCCEEDED);
break;
case res_item:
if ( reserved ) {
__TBB_store_with_release(current->status, FAILED);
}
else if ( my_predecessors.try_reserve( *(current->my_arg) ) ) {
reserved = true;
__TBB_store_with_release(current->status, SUCCEEDED);
} else {
if ( my_predecessors.empty() ) {
my_join->increment_port_count();
}
__TBB_store_with_release(current->status, FAILED);
}
break;
case rel_res:
reserved = false;
my_predecessors.try_release( );
__TBB_store_with_release(current->status, SUCCEEDED);
break;
case con_res:
reserved = false;
my_predecessors.try_consume( );
__TBB_store_with_release(current->status, SUCCEEDED);
break;
#if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
case add_blt_pred:
my_predecessors.internal_add_built_predecessor(*(current->my_pred));
__TBB_store_with_release(current->status, SUCCEEDED);
break;
case del_blt_pred:
my_predecessors.internal_delete_built_predecessor(*(current->my_pred));
__TBB_store_with_release(current->status, SUCCEEDED);
break;
case blt_pred_cnt:
current->cnt_val = my_predecessors.predecessor_count();
__TBB_store_with_release(current->status, SUCCEEDED);
break;
case blt_pred_cpy:
my_predecessors.copy_predecessors(*(current->plist));
__TBB_store_with_release(current->status, SUCCEEDED);
break;
#endif /* TBB_DEPRECATED_FLOW_NODE_EXTRACTION */
}
}
}

References tbb::internal::__TBB_store_with_release(), internal::node_cache< T, M >::add(), internal::reserving_port< T >::con_res, internal::forwarding_base::decrement_port_count(), internal::node_cache< T, M >::empty(), internal::FAILED, internal::forwarding_base::increment_port_count(), internal::reserving_port< T >::reserving_port_operation::my_arg, internal::reserving_port< T >::my_join, internal::reserving_port< T >::reserving_port_operation::my_pred, internal::reserving_port< T >::my_predecessors, tbb::interface6::internal::aggregated_operation< Derived >::next, internal::reserving_port< T >::reg_pred, internal::reserving_port< T >::rel_res, internal::reserving_port< T >::rem_pred, internal::node_cache< T, M >::remove(), internal::reserving_port< T >::res_item, internal::reserving_port< T >::reserved, tbb::interface6::internal::aggregated_operation< Derived >::status, internal::SUCCEEDED, internal::reservable_predecessor_cache< T, M >::try_consume(), internal::reservable_predecessor_cache< T, M >::try_release(), internal::reservable_predecessor_cache< T, M >::try_reserve(), internal::reserving_port< T >::reserving_port_operation::type, and void.

Here is the call graph for this function:

## register_predecessor()

template<typename T >

bool internal::reserving_port< T >::register_predecessor | ( | predecessor_type & | src | ) |

inline

Add a predecessor.

Definition at line 348 of file _flow_graph_join_impl.h.

{
reserving_port_operation op_data(src, reg_pred);
my_aggregator.execute(&op_data);
return op_data.status == SUCCEEDED;
}

References internal::reserving_port< T >::my_aggregator, internal::reserving_port< T >::reg_pred, tbb::interface6::internal::aggregated_operation< Derived >::status, and internal::SUCCEEDED.

## release()

template<typename T >

void internal::reserving_port< T >::release | ( |  | ) |

inline

Release the port.

Definition at line 369 of file _flow_graph_join_impl.h.

{
reserving_port_operation op_data(rel_res);
my_aggregator.execute(&op_data);
}

References internal::reserving_port< T >::my_aggregator, and internal::reserving_port< T >::rel_res.

## remove_predecessor()

template<typename T >

bool internal::reserving_port< T >::remove_predecessor | ( | predecessor_type & | src | ) |

inline

Remove a predecessor.

Definition at line 355 of file _flow_graph_join_impl.h.

{
reserving_port_operation op_data(src, rem_pred);
my_aggregator.execute(&op_data);
return op_data.status == SUCCEEDED;
}

References internal::reserving_port< T >::my_aggregator, internal::reserving_port< T >::rem_pred, tbb::interface6::internal::aggregated_operation< Derived >::status, and internal::SUCCEEDED.

## reserve()

template<typename T >

bool internal::reserving_port< T >::reserve | ( | T & | v | ) |

inline

Reserve an item from the port.

Definition at line 362 of file _flow_graph_join_impl.h.

{
reserving_port_operation op_data(v, res_item);
my_aggregator.execute(&op_data);
return op_data.status == SUCCEEDED;
}

References internal::reserving_port< T >::my_aggregator, internal::reserving_port< T >::res_item, tbb::interface6::internal::aggregated_operation< Derived >::status, and internal::SUCCEEDED.

## reset_receiver()

template<typename T >

void internal::reserving_port< T >::reset_receiver | ( | reset_flags | f | ) |

inline

Definition at line 410 of file _flow_graph_join_impl.h.

{
if(f & rf_clear_edges) my_predecessors.clear();
else
my_predecessors.reset();
reserved = false;
__TBB_ASSERT(!(f&rf_clear_edges) || my_predecessors.empty(), "port edges not removed");
}

References __TBB_ASSERT, internal::reservable_predecessor_cache< T, M >::clear(), internal::node_cache< T, M >::empty(), internal::reserving_port< T >::my_predecessors, internal::reserving_port< T >::reserved, internal::reservable_predecessor_cache< T, M >::reset(), and tbb::flow::interface11::rf_clear_edges.

Here is the call graph for this function:

## set_join_node_pointer()

template<typename T >

void internal::reserving_port< T >::set_join_node_pointer | ( | forwarding_base * | join | ) |

inline

Definition at line 343 of file _flow_graph_join_impl.h.

{
my_join = join;
}

References internal::reserving_port< T >::my_join.

## try_put_task()

template<typename T >

task* internal::reserving_port< T >::try_put_task | ( | const T & |  | ) |

inline protected

Definition at line 318 of file _flow_graph_join_impl.h.

{
return NULL;
}

## 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 245 of file _flow_graph_join_impl.h.

## internal::broadcast_cache

template<typename T >
template<typename X , typename Y >

friend class internal::broadcast_cache

friend

Definition at line 316 of file _flow_graph_join_impl.h.

## internal::round_robin_cache

template<typename T >
template<typename X , typename Y >

friend class internal::round_robin_cache

friend

Definition at line 317 of file _flow_graph_join_impl.h.

## run_and_put_task

template<typename T >
template<typename R , typename B >

friend class run_and_put_task

friend

Definition at line 315 of file _flow_graph_join_impl.h.

## Member Data Documentation

## my_aggregator

template<typename T >

aggregator<handler_type, reserving_port_operation> internal::reserving_port< T >::my_aggregator

private

Definition at line 246 of file _flow_graph_join_impl.h.

Referenced by internal::reserving_port< T >::consume(), internal::reserving_port< T >::register_predecessor(), internal::reserving_port< T >::release(), internal::reserving_port< T >::remove_predecessor(), internal::reserving_port< T >::reserve(), and internal::reserving_port< T >::reserving_port().

## my_join

template<typename T >

forwarding_base* internal::reserving_port< T >::my_join

private

Definition at line 423 of file _flow_graph_join_impl.h.

Referenced by internal::reserving_port< T >::graph_reference(), internal::reserving_port< T >::handle_operations(), internal::reserving_port< T >::reserving_port(), and internal::reserving_port< T >::set_join_node_pointer().

## my_predecessors

template<typename T >

reservable_predecessor_cache< T, null_mutex > internal::reserving_port< T >::my_predecessors

private

Definition at line 424 of file _flow_graph_join_impl.h.

Referenced by internal::reserving_port< T >::handle_operations(), internal::reserving_port< T >::reserving_port(), and internal::reserving_port< T >::reset_receiver().

## reserved

template<typename T >

bool internal::reserving_port< T >::reserved

private

Definition at line 425 of file _flow_graph_join_impl.h.

Referenced by internal::reserving_port< T >::handle_operations(), internal::reserving_port< T >::reserving_port(), and internal::reserving_port< T >::reset_receiver().

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

- _flow_graph_join_impl.h

internal::reservable_predecessor_cache::try_release
bool try_release()
Definition: _flow_graph_cache_impl.h:242
internal::node_cache::add
void add(T &n)
Definition: _flow_graph_cache_impl.h:40
internal::SUCCEEDED
Definition: _flow_graph_types_impl.h:719
void
void
Definition: ittnotify_static.h:91
internal::reserving_port::rel_res
Definition: _flow_graph_join_impl.h:219
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
internal::reserving_port::my_aggregator
aggregator< handler_type, reserving_port_operation > my_aggregator
Definition: _flow_graph_join_impl.h:246
internal::reserving_port::reserved
bool reserved
Definition: _flow_graph_join_impl.h:425
internal::reservable_predecessor_cache::clear
void clear()
Definition: _flow_graph_cache_impl.h:260
internal::reserving_port::con_res
Definition: _flow_graph_join_impl.h:219
internal::reserving_port::reg_pred
Definition: _flow_graph_join_impl.h:219
internal::reserving_port::res_item
Definition: _flow_graph_join_impl.h:219
internal::forwarding_base::graph_ref
graph & graph_ref
Definition: _flow_graph_join_impl.h:34
internal::reserving_port::my_join
forwarding_base * my_join
Definition: _flow_graph_join_impl.h:423
internal::reservable_predecessor_cache::reset
void reset()
Definition: _flow_graph_cache_impl.h:255
internal::forwarding_base::increment_port_count
virtual void increment_port_count()=0
tbb::internal::__TBB_store_with_release
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:716
internal::reserving_port::my_predecessors
reservable_predecessor_cache< T, null_mutex > my_predecessors
Definition: _flow_graph_join_impl.h:424
internal::node_cache::empty
bool empty()
Definition: _flow_graph_cache_impl.h:35
internal::reserving_port::handler_type
internal::aggregating_functor< class_type, reserving_port_operation > handler_type
Definition: _flow_graph_join_impl.h:244
internal::predecessor_cache::set_owner
void set_owner(successor_type *owner)
Definition: _flow_graph_cache_impl.h:141
tbb::flow::interface11::rf_clear_edges
Definition: _flow_graph_impl.h:161
internal::forwarding_base::decrement_port_count
virtual task * decrement_port_count(bool handle_task)=0
internal::FAILED
Definition: _flow_graph_types_impl.h:719
internal::reservable_predecessor_cache::try_reserve
bool try_reserve(output_type &v)
Definition: _flow_graph_cache_impl.h:212
internal::node_cache::remove
void remove(T &n)
Definition: _flow_graph_cache_impl.h:45
internal::reservable_predecessor_cache::try_consume
bool try_consume()
Definition: _flow_graph_cache_impl.h:249
internal::reserving_port::rem_pred
Definition: _flow_graph_join_impl.h:219

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.