internal::function_input_base< Input, Policy, A, ImplType > Class Template Reference

Input and scheduling for a function node that takes a type Input as input. More...

`#include <_flow_graph_node_impl.h>`

Inheritance diagram for internal::function_input_base< Input, Policy, A, ImplType >:
Collaboration diagram for internal::function_input_base< Input, Policy, A, ImplType >:

## Classes

class | operation_type

## Public Types

typedef Input | input_type
| The input type of this receiver. More...
typedef receiver< input_type >::predecessor_type | predecessor_type
typedef predecessor_cache< input_type, null_mutex > | predecessor_cache_type
typedef function_input_queue< input_type, A > | input_queue_type
typedef A::template rebind< input_queue_type >::other | queue_allocator_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

| __TBB_STATIC_ASSERT (!((internal::has_policy< queueing, Policy >::value) &&(internal::has_policy< rejecting, Policy >::value)), "queueing and rejecting policies can't be specified simultaneously")
| function_input_base (graph &g, __TBB_FLOW_GRAPH_PRIORITY_ARG1(size_t max_concurrency, node_priority_t priority))
| Constructor for function_input_base. More...
| function_input_base (const function_input_base &src)
| Copy constructor. More...
virtual | ~function_input_base ()
| Destructor. More...
task * | try_put_task (const input_type &t) __TBB_override
| Put item to successor; return task to run the successor if possible. More...
bool | register_predecessor (predecessor_type &src) __TBB_override
| Adds src to the list of cached predecessors. More...
bool | remove_predecessor (predecessor_type &src) __TBB_override
| Removes src from the list of cached predecessors. More...
Public Member Functions inherited from tbb::flow::interface11::receiver< Input >
bool | try_put (const typename internal::async_helpers< Input >::filtered_type &t)
| Put an item to the receiver. More...
bool | try_put (const typename internal::async_helpers< Input >::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

void | reset_function_input_base (reset_flags f)
void | reset_receiver (reset_flags f) __TBB_override
graph & | graph_reference () const __TBB_override
task * | try_get_postponed_task (const input_type &i)
Protected Member Functions inherited from tbb::flow::interface11::receiver< Input >
virtual task * | try_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 >
task * | try_put_task (const X &t)
virtual void | reset_receiver (reset_flags f=rf_reset_protocol)=0
| put receiver back in initial state More...
virtual bool | is_continue_receiver ()

## Protected Attributes

graph & | my_graph_ref
const size_t | my_max_concurrency
size_t | my_concurrency
input_queue_type * | my_queue
predecessor_cache< input_type, null_mutex > | my_predecessors

## Private Types

enum | op_type { reg_pred, rem_pred, try_fwd, tryput_bypass, app_body_bypass, occupy_concurrency }
typedef function_input_base< Input, Policy, A, ImplType > | class_type
typedef internal::aggregating_functor< class_type, operation_type > | handler_type

## Private Member Functions

task * | perform_queued_requests ()
void | handle_operations (operation_type *op_list)
void | internal_try_put_task (operation_type *op)
| Put to the node, but return the task instead of enqueueing it. More...
void | internal_forward (operation_type *op)
| Creates tasks for postponed messages if available and if concurrency allows. More...
task * | internal_try_put_bypass (const input_type &t)
task * | try_put_task_impl (const input_type &t, tbb::internal::true_type)
task * | try_put_task_impl (const input_type &t, tbb::internal::false_type)
task * | apply_body_bypass (const input_type &i)
| Applies the body to the provided input. More...
task * | create_body_task (const input_type &input)
| allocates a task to apply a body More...
task * | forward_task ()
| This is executed by an enqueued task, the "forwarder". More...
task * | create_forward_task ()
void | spawn_forward_task ()
| Spawns a task that calls forward() More...
Private Member Functions inherited from tbb::internal::no_assign
void | operator= (const no_assign &)=delete
| no_assign (const no_assign &)=default
| no_assign ()=default

## Private Attributes

bool | forwarder_busy
aggregator< handler_type, operation_type > | my_aggregator

## Friends

class | apply_body_task_bypass< class_type, input_type >
class | forward_task_bypass< class_type >
class | internal::aggregating_functor< class_type, operation_type >

## Additional Inherited Members

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

## Detailed Description

### template<typename Input, typename Policy, typename A, typename ImplType>
class internal::function_input_base< Input, Policy, A, ImplType >

Input and scheduling for a function node that takes a type Input as input.

Definition at line 61 of file _flow_graph_node_impl.h.

## Member Typedef Documentation

## class_type

template<typename Input, typename Policy, typename A, typename ImplType>

typedef function_input_base<Input, Policy, A, ImplType> internal::function_input_base< Input, Policy, A, ImplType >::class_type

private

Definition at line 68 of file _flow_graph_node_impl.h.

## handler_type

template<typename Input, typename Policy, typename A, typename ImplType>

typedef internal::aggregating_functor<class_type, operation_type> internal::function_input_base< Input, Policy, A, ImplType >::handler_type

private

Definition at line 227 of file _flow_graph_node_impl.h.

## input_queue_type

template<typename Input, typename Policy, typename A, typename ImplType>

typedef function_input_queue<input_type, A> internal::function_input_base< Input, Policy, A, ImplType >::input_queue_type

Definition at line 76 of file _flow_graph_node_impl.h.

## input_type

template<typename Input, typename Policy, typename A, typename ImplType>

typedef Input internal::function_input_base< Input, Policy, A, ImplType >::input_type

The input type of this receiver.

Definition at line 73 of file _flow_graph_node_impl.h.

## predecessor_cache_type

template<typename Input, typename Policy, typename A, typename ImplType>

typedef predecessor_cache<input_type, null_mutex > internal::function_input_base< Input, Policy, A, ImplType >::predecessor_cache_type

Definition at line 75 of file _flow_graph_node_impl.h.

## predecessor_type

template<typename Input, typename Policy, typename A, typename ImplType>

typedef receiver<input_type>::predecessor_type internal::function_input_base< Input, Policy, A, ImplType >::predecessor_type

Definition at line 74 of file _flow_graph_node_impl.h.

## queue_allocator_type

template<typename Input, typename Policy, typename A, typename ImplType>

typedef A::template rebind< input_queue_type >::other internal::function_input_base< Input, Policy, A, ImplType >::queue_allocator_type

Definition at line 77 of file _flow_graph_node_impl.h.

## Member Enumeration Documentation

## op_type

template<typename Input, typename Policy, typename A, typename ImplType>

enum internal::function_input_base::op_type

private

Enumerator
reg_pred |
rem_pred |
try_fwd |
tryput_bypass |
app_body_bypass |
occupy_concurrency |

Definition at line 62 of file _flow_graph_node_impl.h.

{reg_pred, rem_pred, try_fwd, tryput_bypass, app_body_bypass, occupy_concurrency
#if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
, add_blt_pred, del_blt_pred,
blt_pred_cnt, blt_pred_cpy // create vector copies of preds and succs
#endif
};

## Constructor & Destructor Documentation

## function_input_base() [1/2]

template<typename Input, typename Policy, typename A, typename ImplType>

internal::function_input_base< Input, Policy, A, ImplType >::function_input_base | ( | graph & | g,
|  | __TBB_FLOW_GRAPH_PRIORITY_ARG1(size_t max_concurrency, node_priority_t priority) |
| ) |  |

inline

Constructor for function_input_base.

Definition at line 87 of file _flow_graph_node_impl.h.

: my_graph_ref(g), my_max_concurrency(max_concurrency)
, __TBB_FLOW_GRAPH_PRIORITY_ARG1(my_concurrency(0), my_priority(priority))
, my_queue(!internal::has_policy<rejecting, Policy>::value ? new input_queue_type() : NULL)
, forwarder_busy(false)
{
my_predecessors.set_owner(this);
my_aggregator.initialize_handler(handler_type(this));
}

## function_input_base() [2/2]

template<typename Input, typename Policy, typename A, typename ImplType>

internal::function_input_base< Input, Policy, A, ImplType >::function_input_base | ( | const function_input_base< Input, Policy, A, ImplType > & | src | ) |

inline

Copy constructor.

Definition at line 99 of file _flow_graph_node_impl.h.

: receiver<Input>(), tbb::internal::no_assign()
, my_graph_ref(src.my_graph_ref), my_max_concurrency(src.my_max_concurrency)
, __TBB_FLOW_GRAPH_PRIORITY_ARG1(my_concurrency(0), my_priority(src.my_priority))
, my_queue(src.my_queue ? new input_queue_type() : NULL), forwarder_busy(false)
{
my_predecessors.set_owner(this);
my_aggregator.initialize_handler(handler_type(this));
}

## ~function_input_base()

template<typename Input, typename Policy, typename A, typename ImplType>

virtual internal::function_input_base< Input, Policy, A, ImplType >::~function_input_base | ( |  | ) |

inline virtual

Destructor.

Definition at line 113 of file _flow_graph_node_impl.h.

{
if ( my_queue ) delete my_queue;
}

## Member Function Documentation

## __TBB_STATIC_ASSERT()

template<typename Input, typename Policy, typename A, typename ImplType>

internal::function_input_base< Input, Policy, A, ImplType >::__TBB_STATIC_ASSERT | ( | ! | (internal::has_policy< queueing, Policy >::value) &&(internal::has_policy< rejecting, Policy >::value),
|  | "queueing and rejecting policies can't be specified simultaneously" |
| ) |  |

## apply_body_bypass()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::apply_body_bypass | ( | const input_type & | i | ) |

inline private

Applies the body to the provided input.

Definition at line 373 of file _flow_graph_node_impl.h.

{
return static_cast<ImplType *>(this)->apply_body_impl_bypass(i);
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::try_put_task_impl().

Here is the caller graph for this function:

## create_body_task()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::create_body_task | ( | const input_type & | input | ) |

inline private

allocates a task to apply a body

Definition at line 378 of file _flow_graph_node_impl.h.

{
return (internal::is_graph_active(my_graph_ref)) ?
new( task::allocate_additional_child_of(*(my_graph_ref.root_task())) )
apply_body_task_bypass < class_type, input_type >(
*this, __TBB_FLOW_GRAPH_PRIORITY_ARG1(input, my_priority))
: NULL;
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_try_put_task(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::perform_queued_requests(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::try_put_task_impl().

Here is the caller graph for this function:

## create_forward_task()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::create_forward_task | ( |  | ) |

inline private

Definition at line 402 of file _flow_graph_node_impl.h.

{
return (internal::is_graph_active(my_graph_ref)) ?
new( task::allocate_additional_child_of(*(my_graph_ref.root_task())) )
forward_task_bypass< class_type >( __TBB_FLOW_GRAPH_PRIORITY_ARG1(*this, my_priority) )
: NULL;
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::spawn_forward_task().

Here is the caller graph for this function:

## forward_task()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::forward_task | ( |  | ) |

inline private

This is executed by an enqueued task, the "forwarder".

Definition at line 387 of file _flow_graph_node_impl.h.

{
operation_type op_data(try_fwd);
task* rval = NULL;
do {
op_data.status = WAIT;
my_aggregator.execute(&op_data);
if(op_data.status == SUCCEEDED) {
task* ttask = op_data.bypass_t;
__TBB_ASSERT( ttask && ttask != SUCCESSFULLY_ENQUEUED, NULL );
rval = combine_tasks(my_graph_ref, rval, ttask);
}
} while (op_data.status == SUCCEEDED);
return rval;
}

## graph_reference()

template<typename Input, typename Policy, typename A, typename ImplType>

graph& internal::function_input_base< Input, Policy, A, ImplType >::graph_reference | ( |  | ) | const

inline protected virtual

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

Definition at line 194 of file _flow_graph_node_impl.h.

{
return my_graph_ref;
}

Referenced by internal::function_input< Input, Output, Policy, Allocator >::apply_body_impl_bypass(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::spawn_forward_task().

Here is the caller graph for this function:

## handle_operations()

template<typename Input, typename Policy, typename A, typename ImplType>

void internal::function_input_base< Input, Policy, A, ImplType >::handle_operations | ( | operation_type * | op_list | ) |

inline private

Definition at line 250 of file _flow_graph_node_impl.h.

{
operation_type *tmp;
while (op_list) {
tmp = op_list;
op_list = op_list->next;
switch (tmp->type) {
case reg_pred:
my_predecessors.add(*(tmp->r));
__TBB_store_with_release(tmp->status, SUCCEEDED);
if (!forwarder_busy) {
forwarder_busy = true;
spawn_forward_task();
}
break;
case rem_pred:
my_predecessors.remove(*(tmp->r));
__TBB_store_with_release(tmp->status, SUCCEEDED);
break;
case app_body_bypass: {
tmp->bypass_t = NULL;
__TBB_ASSERT(my_max_concurrency != 0, NULL);
--my_concurrency;
if(my_concurrency<my_max_concurrency)
tmp->bypass_t = perform_queued_requests();
__TBB_store_with_release(tmp->status, SUCCEEDED);
}
break;
case tryput_bypass: internal_try_put_task(tmp); break;
case try_fwd: internal_forward(tmp); break;
case occupy_concurrency:
if (my_concurrency < my_max_concurrency) {
++my_concurrency;
__TBB_store_with_release(tmp->status, SUCCEEDED);
} else {
__TBB_store_with_release(tmp->status, FAILED);
}
break;
#if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
case add_blt_pred: {
my_predecessors.internal_add_built_predecessor(*(tmp->r));
__TBB_store_with_release(tmp->status, SUCCEEDED);
}
break;
case del_blt_pred:
my_predecessors.internal_delete_built_predecessor(*(tmp->r));
__TBB_store_with_release(tmp->status, SUCCEEDED);
break;
case blt_pred_cnt:
tmp->cnt_val = my_predecessors.predecessor_count();
__TBB_store_with_release(tmp->status, SUCCEEDED);
break;
case blt_pred_cpy:
my_predecessors.copy_predecessors( *(tmp->predv) );
__TBB_store_with_release(tmp->status, SUCCEEDED);
break;
#endif /* TBB_DEPRECATED_FLOW_NODE_EXTRACTION */
}
}
}

## internal_forward()

template<typename Input, typename Policy, typename A, typename ImplType>

void internal::function_input_base< Input, Policy, A, ImplType >::internal_forward | ( | operation_type * | op | ) |

inline private

Creates tasks for postponed messages if available and if concurrency allows.

Definition at line 329 of file _flow_graph_node_impl.h.

{
op->bypass_t = NULL;
if (my_concurrency < my_max_concurrency || !my_max_concurrency)
op->bypass_t = perform_queued_requests();
if(op->bypass_t)
__TBB_store_with_release(op->status, SUCCEEDED);
else {
forwarder_busy = false;
__TBB_store_with_release(op->status, FAILED);
}
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations().

Here is the caller graph for this function:

## internal_try_put_bypass()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::internal_try_put_bypass | ( | const input_type & | t | ) |

inline private

Definition at line 341 of file _flow_graph_node_impl.h.

{
operation_type op_data(t, tryput_bypass);
my_aggregator.execute(&op_data);
if( op_data.status == internal::SUCCEEDED ) {
return op_data.bypass_t;
}
return NULL;
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::try_put_task_impl().

Here is the caller graph for this function:

## internal_try_put_task()

template<typename Input, typename Policy, typename A, typename ImplType>

void internal::function_input_base< Input, Policy, A, ImplType >::internal_try_put_task | ( | operation_type * | op | ) |

inline private

Put to the node, but return the task instead of enqueueing it.

Definition at line 312 of file _flow_graph_node_impl.h.

{
__TBB_ASSERT(my_max_concurrency != 0, NULL);
if (my_concurrency < my_max_concurrency) {
++my_concurrency;
task * new_task = create_body_task(*(op->elem));
op->bypass_t = new_task;
__TBB_store_with_release(op->status, SUCCEEDED);
} else if ( my_queue && my_queue->push(*(op->elem)) ) {
op->bypass_t = SUCCESSFULLY_ENQUEUED;
__TBB_store_with_release(op->status, SUCCEEDED);
} else {
op->bypass_t = NULL;
__TBB_store_with_release(op->status, FAILED);
}
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations().

Here is the caller graph for this function:

## perform_queued_requests()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::perform_queued_requests | ( |  | ) |

inline private

Definition at line 231 of file _flow_graph_node_impl.h.

{
task* new_task = NULL;
if(my_queue) {
if(!my_queue->empty()) {
++my_concurrency;
new_task = create_body_task(my_queue->front());
my_queue->pop();
}
}
else {
input_type i;
if(my_predecessors.get_item(i)) {
++my_concurrency;
new_task = create_body_task(i);
}
}
return new_task;
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_forward().

Here is the caller graph for this function:

## register_predecessor()

template<typename Input, typename Policy, typename A, typename ImplType>

bool internal::function_input_base< Input, Policy, A, ImplType >::register_predecessor | ( | predecessor_type & | src | ) |

inline virtual

Adds src to the list of cached predecessors.

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

Definition at line 122 of file _flow_graph_node_impl.h.

{
operation_type op_data(reg_pred);
op_data.r = &src;
my_aggregator.execute(&op_data);
return true;
}

## remove_predecessor()

template<typename Input, typename Policy, typename A, typename ImplType>

bool internal::function_input_base< Input, Policy, A, ImplType >::remove_predecessor | ( | predecessor_type & | src | ) |

inline virtual

Removes src from the list of cached predecessors.

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

Definition at line 130 of file _flow_graph_node_impl.h.

{
operation_type op_data(rem_pred);
op_data.r = &src;
my_aggregator.execute(&op_data);
return true;
}

## reset_function_input_base()

template<typename Input, typename Policy, typename A, typename ImplType>

void internal::function_input_base< Input, Policy, A, ImplType >::reset_function_input_base | ( | reset_flags | f | ) |

inline protected

Definition at line 171 of file _flow_graph_node_impl.h.

{
my_concurrency = 0;
if(my_queue) {
my_queue->reset();
}
reset_receiver(f);
forwarder_busy = false;
}

Referenced by internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator >::reset(), and internal::function_input< Input, Output, Policy, Allocator >::reset_function_input().

Here is the caller graph for this function:

## reset_receiver()

template<typename Input, typename Policy, typename A, typename ImplType>

void internal::function_input_base< Input, Policy, A, ImplType >::reset_receiver | ( | reset_flags | f | ) |

inline protected

Definition at line 187 of file _flow_graph_node_impl.h.

{
if( f & rf_clear_edges) my_predecessors.clear();
else
my_predecessors.reset();
__TBB_ASSERT(!(f & rf_clear_edges) || my_predecessors.empty(), "function_input_base reset failed");
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::reset_function_input_base().

Here is the caller graph for this function:

## spawn_forward_task()

template<typename Input, typename Policy, typename A, typename ImplType>

void internal::function_input_base< Input, Policy, A, ImplType >::spawn_forward_task | ( |  | ) |

inline private

Spawns a task that calls forward()

Definition at line 410 of file _flow_graph_node_impl.h.

{
task* tp = create_forward_task();
if(tp) {
internal::spawn_in_graph_arena(graph_reference(), *tp);
}
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations().

Here is the caller graph for this function:

## try_get_postponed_task()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::try_get_postponed_task | ( | const input_type & | i | ) |

inline protected

Definition at line 198 of file _flow_graph_node_impl.h.

{
operation_type op_data(i, app_body_bypass); // tries to pop an item or get_item
my_aggregator.execute(&op_data);
return op_data.bypass_t;
}

Referenced by internal::function_input< Input, Output, Policy, Allocator >::apply_body_impl_bypass(), and internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator >::apply_body_impl_bypass().

Here is the caller graph for this function:

## try_put_task()

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::try_put_task | ( | const input_type & | t | ) |

inline virtual

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

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

Definition at line 117 of file _flow_graph_node_impl.h.

{
return try_put_task_impl(t, internal::has_policy<lightweight, Policy>());
}

## try_put_task_impl() [1/2]

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::try_put_task_impl | ( | const input_type & | t,
|  | tbb::internal::false_type |
| ) |  |

inline private

Definition at line 363 of file _flow_graph_node_impl.h.

{
if( my_max_concurrency == 0 ) {
return create_body_task(t);
} else {
return internal_try_put_bypass(t);
}
}

## try_put_task_impl() [2/2]

template<typename Input, typename Policy, typename A, typename ImplType>

task* internal::function_input_base< Input, Policy, A, ImplType >::try_put_task_impl | ( | const input_type & | t,
|  | tbb::internal::true_type |
| ) |  |

inline private

Definition at line 350 of file _flow_graph_node_impl.h.

{
if( my_max_concurrency == 0 ) {
return apply_body_bypass(t);
} else {
operation_type check_op(t, occupy_concurrency);
my_aggregator.execute(&check_op);
if( check_op.status == internal::SUCCEEDED ) {
return apply_body_bypass(t);
}
return internal_try_put_bypass(t);
}
}

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::try_put_task().

Here is the caller graph for this function:

## Friends And Related Function Documentation

## apply_body_task_bypass< class_type, input_type >

template<typename Input, typename Policy, typename A, typename ImplType>

friend class apply_body_task_bypass< class_type, input_type >

friend

Definition at line 206 of file _flow_graph_node_impl.h.

## forward_task_bypass< class_type >

template<typename Input, typename Policy, typename A, typename ImplType>

friend class forward_task_bypass< class_type >

friend

Definition at line 207 of file _flow_graph_node_impl.h.

## internal::aggregating_functor< class_type, operation_type >

template<typename Input, typename Policy, typename A, typename ImplType>

friend class internal::aggregating_functor< class_type, operation_type >

friend

Definition at line 228 of file _flow_graph_node_impl.h.

## Member Data Documentation

## forwarder_busy

template<typename Input, typename Policy, typename A, typename ImplType>

bool internal::function_input_base< Input, Policy, A, ImplType >::forwarder_busy

private

Definition at line 226 of file _flow_graph_node_impl.h.

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_forward(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::reset_function_input_base().

## my_aggregator

template<typename Input, typename Policy, typename A, typename ImplType>

aggregator< handler_type, operation_type > internal::function_input_base< Input, Policy, A, ImplType >::my_aggregator

private

Definition at line 229 of file _flow_graph_node_impl.h.

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::forward_task(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::function_input_base(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_try_put_bypass(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::register_predecessor(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::remove_predecessor(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::try_get_postponed_task(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::try_put_task_impl().

## my_concurrency

template<typename Input, typename Policy, typename A, typename ImplType>

size_t internal::function_input_base< Input, Policy, A, ImplType >::my_concurrency

protected

Definition at line 182 of file _flow_graph_node_impl.h.

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_forward(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_try_put_task(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::perform_queued_requests(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::reset_function_input_base().

## my_graph_ref

template<typename Input, typename Policy, typename A, typename ImplType>

graph& internal::function_input_base< Input, Policy, A, ImplType >::my_graph_ref

protected

Definition at line 180 of file _flow_graph_node_impl.h.

Referenced by internal::function_input< Input, Output, Policy, Allocator >::apply_body_impl_bypass(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::create_body_task(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::create_forward_task(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::forward_task(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::graph_reference().

## my_max_concurrency

template<typename Input, typename Policy, typename A, typename ImplType>

const size_t internal::function_input_base< Input, Policy, A, ImplType >::my_max_concurrency

protected

Definition at line 181 of file _flow_graph_node_impl.h.

Referenced by internal::function_input< Input, Output, Policy, Allocator >::apply_body_impl_bypass(), internal::multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator >::apply_body_impl_bypass(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_forward(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_try_put_task(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::try_put_task_impl().

## my_predecessors

template<typename Input, typename Policy, typename A, typename ImplType>

predecessor_cache<input_type, null_mutex > internal::function_input_base< Input, Policy, A, ImplType >::my_predecessors

protected

Definition at line 185 of file _flow_graph_node_impl.h.

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::function_input_base(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::perform_queued_requests(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::reset_receiver().

## my_queue

template<typename Input, typename Policy, typename A, typename ImplType>

input_queue_type* internal::function_input_base< Input, Policy, A, ImplType >::my_queue

protected

Definition at line 184 of file _flow_graph_node_impl.h.

Referenced by internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::internal_try_put_task(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::perform_queued_requests(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::reset_function_input_base(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::~function_input_base().

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

- _flow_graph_node_impl.h

internal::node_cache::add
void add(T &n)
Definition: _flow_graph_cache_impl.h:40
internal::SUCCEEDED
Definition: _flow_graph_types_impl.h:719
internal::function_input_base::forward_task_bypass< class_type >
friend class forward_task_bypass< class_type >
Definition: _flow_graph_node_impl.h:207
tbb::flow::interface11::internal::is_graph_active
bool is_graph_active(tbb::flow::interface10::graph &g)
Definition: _flow_graph_impl.h:494
tbb::flow::interface11::internal::spawn_in_graph_arena
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
Definition: _flow_graph_impl.h:521
internal::function_input_base::my_concurrency
size_t my_concurrency
Definition: _flow_graph_node_impl.h:182
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
internal::function_input_base::tryput_bypass
Definition: _flow_graph_node_impl.h:62
__TBB_FLOW_GRAPH_PRIORITY_ARG1
#define __TBB_FLOW_GRAPH_PRIORITY_ARG1(arg1, priority)
Definition: _flow_graph_impl.h:40
internal::function_input_base::try_fwd
Definition: _flow_graph_node_impl.h:62
internal::function_input_base::reset_receiver
void reset_receiver(reset_flags f) __TBB_override
Definition: _flow_graph_node_impl.h:187
internal::function_input_base::internal_forward
void internal_forward(operation_type *op)
Creates tasks for postponed messages if available and if concurrency allows.
Definition: _flow_graph_node_impl.h:329
tbb::flow::interface11::combine_tasks
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:191
internal::function_input_base::try_put_task_impl
task * try_put_task_impl(const input_type &t, tbb::internal::true_type)
Definition: _flow_graph_node_impl.h:350
internal::function_input_queue::empty
bool empty() const
Definition: _flow_graph_node_impl.h:36
internal::function_input_base::apply_body_task_bypass< class_type, input_type >
friend class apply_body_task_bypass< class_type, input_type >
Definition: _flow_graph_node_impl.h:206
internal::function_input_base::internal_try_put_bypass
task * internal_try_put_bypass(const input_type &t)
Definition: _flow_graph_node_impl.h:341
internal::has_policy
Definition: _flow_graph_body_impl.h:36
internal::function_input_base::spawn_forward_task
void spawn_forward_task()
Spawns a task that calls forward()
Definition: _flow_graph_node_impl.h:410
tbb::flow::internal::SUCCESSFULLY_ENQUEUED
static tbb::task *const SUCCESSFULLY_ENQUEUED
Definition: _flow_graph_impl.h:61
internal::function_input_base::my_queue
input_queue_type * my_queue
Definition: _flow_graph_node_impl.h:184
internal::function_input_base::rem_pred
Definition: _flow_graph_node_impl.h:62
internal::function_input_base::internal_try_put_task
void internal_try_put_task(operation_type *op)
Put to the node, but return the task instead of enqueueing it.
Definition: _flow_graph_node_impl.h:312
internal::item_buffer::reset
void reset()
Definition: _flow_graph_item_buffer_impl.h:240
internal::node_cache::clear
void clear()
Definition: _flow_graph_cache_impl.h:54
internal::function_input_base::create_body_task
task * create_body_task(const input_type &input)
allocates a task to apply a body
Definition: _flow_graph_node_impl.h:378
tbb::internal::__TBB_store_with_release
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:716
internal::predecessor_cache::get_item
bool get_item(output_type &v)
Definition: _flow_graph_cache_impl.h:143
internal::function_input_base::apply_body_bypass
task * apply_body_bypass(const input_type &i)
Applies the body to the provided input.
Definition: _flow_graph_node_impl.h:373
internal::predecessor_cache::reset
void reset()
Definition: _flow_graph_cache_impl.h:173
internal::WAIT
Definition: _flow_graph_types_impl.h:719
internal::node_cache::empty
bool empty()
Definition: _flow_graph_cache_impl.h:35
internal::function_input_base::graph_reference
graph & graph_reference() const __TBB_override
Definition: _flow_graph_node_impl.h:194
tbb::this_task_arena::max_concurrency
int max_concurrency()
Returns the maximal number of threads that can work inside the arena.
Definition: task_arena.h:490
internal::function_input_base::app_body_bypass
Definition: _flow_graph_node_impl.h:62
internal::function_input_base::input_type
Input input_type
The input type of this receiver.
Definition: _flow_graph_node_impl.h:73
internal::function_input_base::my_predecessors
predecessor_cache< input_type, null_mutex > my_predecessors
Definition: _flow_graph_node_impl.h:185
internal::function_input_base::my_graph_ref
graph & my_graph_ref
Definition: _flow_graph_node_impl.h:180
internal::function_input_base::my_max_concurrency
const size_t my_max_concurrency
Definition: _flow_graph_node_impl.h:181
internal::function_input_base::forwarder_busy
bool forwarder_busy
Definition: _flow_graph_node_impl.h:226
internal::function_input_queue::front
const T & front() const
Definition: _flow_graph_node_impl.h:40
tbb::internal::no_assign
Base class for types that should not be assigned.
Definition: tbb_stddef.h:322
task
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
Definition: ittnotify_static.h:119
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::function_input_base::occupy_concurrency
Definition: _flow_graph_node_impl.h:62
internal::function_input_queue::pop
bool pop(T &t)
Definition: _flow_graph_node_impl.h:44
internal::FAILED
Definition: _flow_graph_types_impl.h:719
internal::function_input_base::handler_type
internal::aggregating_functor< class_type, operation_type > handler_type
Definition: _flow_graph_node_impl.h:227
internal::function_input_queue::push
bool push(T &t)
Definition: _flow_graph_node_impl.h:52
internal::function_input_base::create_forward_task
task * create_forward_task()
Definition: _flow_graph_node_impl.h:402
internal::node_cache::remove
void remove(T &n)
Definition: _flow_graph_cache_impl.h:45
internal::function_input_base::my_aggregator
aggregator< handler_type, operation_type > my_aggregator
Definition: _flow_graph_node_impl.h:229
internal::function_input_base::perform_queued_requests
task * perform_queued_requests()
Definition: _flow_graph_node_impl.h:231
internal::function_input_base::reg_pred
Definition: _flow_graph_node_impl.h:62
internal::function_input_base::input_queue_type
function_input_queue< input_type, A > input_queue_type
Definition: _flow_graph_node_impl.h:76

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.