Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
17 #ifndef __TBB_pipeline_H
18 #define __TBB_pipeline_H
20 #define __TBB_pipeline_H_include_area
28 #if __TBB_CPP11_TYPE_PROPERTIES_PRESENT
29 #include <type_traits>
41 #define __TBB_PIPELINE_VERSION(x) ((unsigned char)(x-2)<<1)
52 namespace interface6 {
53 template<
typename T,
typename U>
class filter_t;
85 #if TBB_USE_CAPTURED_EXCEPTION
155 #if __TBB_TASK_GROUP_CONTEXT
250 #if __TBB_TASK_GROUP_CONTEXT
276 atomic<internal::Token> input_tokens;
279 atomic<internal::Token> token_counter;
285 bool has_thread_bound_filters;
288 void remove_filter(
filter& filter_ );
293 #if __TBB_TASK_GROUP_CONTEXT
294 void clear_filters();
303 namespace interface6 {
322 #if __TBB_CPP11_TYPE_PROPERTIES_PRESENT
342 #if !_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED)
345 #endif // tbb_trivially_copyable
363 #if __TBB_CPP11_RVALUE_REF_PRESENT
400 } type_to_void_ptr_map;
407 type_to_void_ptr_map mymap;
408 mymap.void_overlay = NULL;
409 mymap.actual_value = ref;
410 return mymap.void_overlay;
413 type_to_void_ptr_map mymap;
414 mymap.void_overlay = ref;
415 return mymap.actual_value;
421 template<
typename T,
typename U,
typename Body>
430 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
432 t_helper::destroy_token(temp_input);
433 return u_helper::cast_to_void_ptr(output_u);
437 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
438 t_helper::destroy_token(temp_input);
446 template<
typename U,
typename Body>
456 u_helper::destroy_token(output_u);
460 return u_helper::cast_to_void_ptr(output_u);
471 template<
typename T,
typename Body>
478 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
480 t_helper::destroy_token(temp_input);
484 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
485 t_helper::destroy_token(temp_input);
492 template<
typename Body>
527 #ifdef __TBB_TEST_FILTER_NODE_COUNT
528 ++(__TBB_TEST_FILTER_NODE_COUNT);
533 virtual void add_to( pipeline& ) = 0;
543 #ifdef __TBB_TEST_FILTER_NODE_COUNT
544 --(__TBB_TEST_FILTER_NODE_COUNT);
550 template<
typename T,
typename U,
typename Body>
586 template<
typename T,
typename U,
typename Body>
591 template<
typename T,
typename V,
typename U>
593 __TBB_ASSERT(left.
root,
"cannot use default-constructed filter_t as left argument of '&'");
594 __TBB_ASSERT(right.
root,
"cannot use default-constructed filter_t as right argument of '&'");
599 template<
typename T,
typename U>
607 template<
typename T_,
typename U_,
typename Body>
609 template<
typename T_,
typename V_,
typename U_>
617 template<
typename Body>
645 __TBB_ASSERT( filter_chain.
root,
"cannot apply parallel_pipeline to default-constructed filter_t" );
656 pipe->run(max_number_of_live_tokens
663 #if __TBB_TASK_GROUP_CONTEXT
668 #endif // __TBB_TASK_GROUP_CONTEXT
672 using interface6::flow_control;
673 using interface6::filter_t;
680 #undef __TBB_pipeline_H_include_area
tbb::atomic< intptr_t > ref_count
bool is_ordered() const
True if filter must receive stream in order.
pointer allocate(size_type n, const void *=0)
Allocate space for n objects.
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
filter_t< T, U > make_filter(tbb::filter::mode mode, const Body &body)
Create a filter to participate in parallel_pipeline.
internal::filter_node filter_node
static filter * not_in_pipeline()
Value used to mark "not in pipeline".
u_helper::pointer u_pointer
friend filter_t< T_, U_ > make_filter(tbb::filter::mode, const Body &)
Create a filter to participate in parallel_pipeline.
bool is_bound() const
True if filter is thread-bound.
The class that represents an object of the pipeline for parallel_pipeline().
void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t< void, void > &filter_chain, tbb::task_group_context &context)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
static value_type & token(pointer &t)
void operator=(const filter_t< T, U > &rhs)
Base class for types that should not be copied or assigned.
static void destroy_token(pointer)
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Class representing a chain of type-safe pipeline filters.
thread_bound_filter(mode filter_mode)
#define __TBB_TASK_GROUP_CONTEXT
static pointer cast_from_void_ptr(void *ref)
Node in parse tree representing result of make_filter.
bool is_serial() const
True if filter is serial.
#define __TBB_PIPELINE_VERSION(x)
Used to form groups of tasks.
A buffer of input items for a filter.
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
tbb::pipeline * operator->()
filter_t(filter_node *root_)
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
class __TBB_DEPRECATED_MSG("tbb::tbb_hash is deprecated, use std::hash") tbb_hash
static const unsigned char version_mask
void __TBB_EXPORTED_METHOD set_end_of_input()
bool has_more_work()
has the filter not yet processed all the tokens it will ever see?
static void destroy_token(pointer)
static void * cast_to_void_ptr(pointer ref)
token_helper< U, use_allocator< U >::value > u_helper
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
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 mode
filter_node_join(filter_node &x, filter_node &y)
t_helper::pointer t_pointer
static const unsigned char exact_exception_propagation
7th bit defines exception propagation mode expected by the application.
tbb::tbb_allocator< T > allocator
pipeline * my_pipeline
Pointer to the pipeline.
A stage in a pipeline served by a user thread.
static pointer create_token(value_type &&source)
virtual void finalize(void *)
Destroys item if pipeline was cancelled.
static value_type & token(pointer &t)
static value_type & token(pointer &t)
token_helper< T, use_allocator< T >::value > t_helper
static pointer cast_from_void_ptr(void *ref)
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
filter_t(const filter_t< T, U > &rhs)
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
void deallocate(pointer p, size_type)
Free previously allocated block of memory.
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 size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d int
void move(tbb_thread &t1, tbb_thread &t2)
static pointer create_token(const value_type &source)
processes items one at a time and in no particular order
input_filter control to signal end-of-input for parallel_pipeline
void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t< void, void > &filter_chain)
token_helper< T, use_allocator< T >::value > t_helper
u_helper::pointer u_pointer
virtual __TBB_EXPORTED_METHOD ~filter()
Destroy filter.
virtual void * operator()(void *item)=0
Operate on an item from the input stream, and return item for output stream.
concrete_filter(filter::mode filter_mode, const Body &body)
void destroy(pointer p)
Destroy value at location pointed to by p.
processes items one at a time; all such filters process items in the same order
friend filter_t< T_, U_ > operator&(const filter_t< T_, V_ > &, const filter_t< V_, U_ > &)
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
result_type __TBB_EXPORTED_METHOD try_process_item()
If a data item is available, invoke operator() on that item.
virtual void add_to(pipeline &)=0
Add concrete_filter to pipeline.
const tbb::filter::mode mode
processes multiple items in parallel and in no particular order
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
token_helper< U, use_allocator< U >::value > u_helper
void remove_ref()
Decrement reference count and delete if it becomes zero.
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Node in parse tree representing join of two filters.
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
static void destroy_token(pointer token)
static const unsigned char current_version
internal::input_buffer * my_input_buffer
Buffer for incoming tokens, or NULL if not required.
static void * cast_to_void_ptr(pointer ref)
static void * cast_to_void_ptr(pointer ref)
result_type internal_process_item(bool is_blocking)
Internal routine for item processing.
Abstract base class that represents a node in a parse tree underlying a filter_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 __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 value
t_helper::pointer t_pointer
Base class for user-defined tasks.
filter_t(tbb::filter::mode mode, const Body &body)
bool object_may_be_null()
true if an input filter can emit null
filter * next_filter_in_pipeline
Pointer to next filter in the pipeline.
static const unsigned char filter_is_serial
The lowest bit 0 is for parallel vs. serial.
filter_node_leaf(tbb::filter::mode m, const Body &b)
void const char const char int ITT_FORMAT __itt_group_sync p
#define __TBB_EXPORTED_METHOD
filter_t< T, U > operator&(const filter_t< T, V > &left, const filter_t< V, U > &right)
static const unsigned char filter_is_out_of_order
4th bit distinguishes ordered vs unordered filters.
static pointer cast_from_void_ptr(void *ref)
static const unsigned char filter_may_emit_null
6th bit marks input filters emitting small objects
pipeline_proxy(const filter_t< void, void > &filter_chain)
const unsigned char my_filter_mode
Storage for filter mode and dynamically checked implementation version.
filter * next_segment
Pointer to the next "segment" of filters, or NULL if not required.
filter * prev_filter_in_pipeline
Pointer to previous filter in the pipeline.
static const unsigned char filter_is_bound
5th bit distinguishes thread-bound and regular filters.
void add_ref()
Increment reference count.
result_type __TBB_EXPORTED_METHOD process_item()
Wait until a data item becomes available, and invoke operator() on that item.
static pointer create_token(const value_type &source)
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.