Intel(R) Threading Building Blocks Doxygen Documentation version 4.2.3
pipeline.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2005-2020 Intel Corporation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef __TBB_pipeline_H
18#define __TBB_pipeline_H
19
20#define __TBB_pipeline_H_include_area
22
23#include "atomic.h"
24#include "task.h"
25#include "tbb_allocator.h"
26#include <cstddef>
27
28#if __TBB_CPP11_TYPE_PROPERTIES_PRESENT
29#include <type_traits>
30#endif
31
32namespace tbb {
33
34class pipeline;
35class filter;
36
38namespace internal {
39
40// The argument for PIPELINE_VERSION should be an integer between 2 and 9
41#define __TBB_PIPELINE_VERSION(x) ((unsigned char)(x-2)<<1)
42
43typedef unsigned long Token;
44typedef long tokendiff_t;
45class stage_task;
46class input_buffer;
49
50} // namespace internal
51
52namespace interface6 {
53 template<typename T, typename U> class filter_t;
54
55 namespace internal {
56 class pipeline_proxy;
57 }
58}
59
61
63
65private:
67 static filter* not_in_pipeline() { return reinterpret_cast<filter*>(intptr_t(-1)); }
68protected:
70 static const unsigned char filter_is_serial = 0x1;
71
73
75 static const unsigned char filter_is_out_of_order = 0x1<<4;
76
78 static const unsigned char filter_is_bound = 0x1<<5;
79
81 static const unsigned char filter_may_emit_null = 0x1<<6;
82
84 static const unsigned char exact_exception_propagation =
85#if TBB_USE_CAPTURED_EXCEPTION
86 0x0;
87#else
88 0x1<<7;
89#endif /* TBB_USE_CAPTURED_EXCEPTION */
90
91 static const unsigned char current_version = __TBB_PIPELINE_VERSION(5);
92 static const unsigned char version_mask = 0x7<<1; // bits 1-3 are for version
93public:
94 enum mode {
103 };
104protected:
105 explicit filter( bool is_serial_ ) :
107 my_input_buffer(NULL),
108 my_filter_mode(static_cast<unsigned char>((is_serial_ ? serial : parallel) | exact_exception_propagation)),
110 my_pipeline(NULL),
111 next_segment(NULL)
112 {}
113
114 explicit filter( mode filter_mode ) :
116 my_input_buffer(NULL),
117 my_filter_mode(static_cast<unsigned char>(filter_mode | exact_exception_propagation)),
119 my_pipeline(NULL),
120 next_segment(NULL)
121 {}
122
123 // signal end-of-input for concrete_filters
125
126public:
128 bool is_serial() const {
129 return bool( my_filter_mode & filter_is_serial );
130 }
131
133 bool is_ordered() const {
135 }
136
138 bool is_bound() const {
140 }
141
145 }
146
148
149 virtual void* operator()( void* item ) = 0;
150
152
154
155#if __TBB_TASK_GROUP_CONTEXT
157
159 virtual void finalize( void* /*item*/ ) {}
160#endif
161
162private:
165
167 // (pipeline has not yet reached end_of_input or this filter has not yet
168 // seen the last token produced by input_filter)
169 bool has_more_work();
170
172
174
177 friend class pipeline;
179
181 const unsigned char my_filter_mode;
182
185
188
190
192};
193
195
197public:
199 // item was processed
201 // item is currently not available
203 // there are no more items to process
205 };
206protected:
207 explicit thread_bound_filter(mode filter_mode):
208 filter(static_cast<mode>(filter_mode | filter::filter_is_bound))
209 {
210 __TBB_ASSERT(filter_mode & filter::filter_is_serial, "thread-bound filters must be serial");
211 }
212public:
214
220
222
227
228private:
230 result_type internal_process_item(bool is_blocking);
231};
232
234
235class __TBB_DEPRECATED_MSG("tbb::pipeline is deprecated, use tbb::parallel_pipeline") pipeline {
236public:
238 __TBB_EXPORTED_METHOD pipeline();
239
242 virtual __TBB_EXPORTED_METHOD ~pipeline();
243
245 void __TBB_EXPORTED_METHOD add_filter( filter& filter_ );
246
248 void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens );
249
250#if __TBB_TASK_GROUP_CONTEXT
252 void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens, tbb::task_group_context& context );
253#endif
254
256 void __TBB_EXPORTED_METHOD clear();
257
258private:
259 friend class internal::stage_task;
260 friend class internal::pipeline_root_task;
261 friend class filter;
262 friend class thread_bound_filter;
263 friend class internal::pipeline_cleaner;
265
267 filter* filter_list;
268
270 filter* filter_end;
271
273 task* end_counter;
274
276 atomic<internal::Token> input_tokens;
277
279 atomic<internal::Token> token_counter;
280
282 bool end_of_input;
283
285 bool has_thread_bound_filters;
286
288 void remove_filter( filter& filter_ );
289
291 void __TBB_EXPORTED_METHOD inject_token( task& self );
292
293#if __TBB_TASK_GROUP_CONTEXT
295 void clear_filters();
296#endif
297};
298
299//------------------------------------------------------------------------
300// Support for lambda-friendly parallel_pipeline interface
301//------------------------------------------------------------------------
302
303namespace interface6 {
304
305namespace internal {
306 template<typename T, typename U, typename Body> class concrete_filter;
307}
308
313 template<typename T, typename U, typename Body> friend class internal::concrete_filter;
314public:
315 void stop() { is_pipeline_stopped = true; }
316};
317
319namespace internal {
320
321// Emulate std::is_trivially_copyable (false positives not allowed, false negatives suboptimal but safe).
322#if __TBB_CPP11_TYPE_PROPERTIES_PRESENT
323template<typename T> struct tbb_trivially_copyable { enum { value = std::is_trivially_copyable<T>::value }; };
324#else
325template<typename T> struct tbb_trivially_copyable { enum { value = false }; };
326template<typename T> struct tbb_trivially_copyable < T* > { enum { value = true }; };
327template<> struct tbb_trivially_copyable < bool > { enum { value = true }; };
328template<> struct tbb_trivially_copyable < char > { enum { value = true }; };
329template<> struct tbb_trivially_copyable < signed char > { enum { value = true }; };
330template<> struct tbb_trivially_copyable <unsigned char > { enum { value = true }; };
331template<> struct tbb_trivially_copyable < short > { enum { value = true }; };
332template<> struct tbb_trivially_copyable <unsigned short > { enum { value = true }; };
333template<> struct tbb_trivially_copyable < int > { enum { value = true }; };
334template<> struct tbb_trivially_copyable <unsigned int > { enum { value = true }; };
335template<> struct tbb_trivially_copyable < long > { enum { value = true }; };
336template<> struct tbb_trivially_copyable <unsigned long > { enum { value = true }; };
337template<> struct tbb_trivially_copyable < long long> { enum { value = true }; };
338template<> struct tbb_trivially_copyable <unsigned long long> { enum { value = true }; };
339template<> struct tbb_trivially_copyable < float > { enum { value = true }; };
340template<> struct tbb_trivially_copyable < double > { enum { value = true }; };
341template<> struct tbb_trivially_copyable < long double > { enum { value = true }; };
342#if !_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED)
343template<> struct tbb_trivially_copyable < wchar_t > { enum { value = true }; };
344#endif /* _MSC_VER||!defined(_NATIVE_WCHAR_T_DEFINED) */
345#endif // tbb_trivially_copyable
346
347template<typename T>
349 enum { value = sizeof(T) > sizeof(void *) || !tbb_trivially_copyable<T>::value };
350};
351
352// A helper class to customize how a type is passed between filters.
353// Usage: token_helper<T, use_allocator<T>::value>
354template<typename T, bool Allocate> class token_helper;
355
356// using tbb_allocator
357template<typename T>
358class token_helper<T, true> {
359public:
361 typedef T* pointer;
362 typedef T value_type;
363#if __TBB_CPP11_RVALUE_REF_PRESENT
365#else
366 static pointer create_token(const value_type & source)
367#endif
368 {
369 pointer output_t = allocator().allocate(1);
370 return new (output_t) T(tbb::internal::move(source));
371 }
372 static value_type & token(pointer & t) { return *t; }
373 static void * cast_to_void_ptr(pointer ref) { return (void *) ref; }
374 static pointer cast_from_void_ptr(void * ref) { return (pointer)ref; }
375 static void destroy_token(pointer token) {
376 allocator().destroy(token);
377 allocator().deallocate(token,1);
378 }
379};
380
381// pointer specialization
382template<typename T>
383class token_helper<T*, false> {
384public:
385 typedef T* pointer;
386 typedef T* value_type;
387 static pointer create_token(const value_type & source) { return source; }
388 static value_type & token(pointer & t) { return t; }
389 static void * cast_to_void_ptr(pointer ref) { return (void *)ref; }
390 static pointer cast_from_void_ptr(void * ref) { return (pointer)ref; }
391 static void destroy_token( pointer /*token*/) {}
392};
393
394// converting type to and from void*, passing objects directly
395template<typename T>
396class token_helper<T, false> {
397 typedef union {
400 } type_to_void_ptr_map;
401public:
402 typedef T pointer; // not really a pointer in this case.
403 typedef T value_type;
404 static pointer create_token(const value_type & source) { return source; }
405 static value_type & token(pointer & t) { return t; }
406 static void * cast_to_void_ptr(pointer ref) {
407 type_to_void_ptr_map mymap;
408 mymap.void_overlay = NULL;
409 mymap.actual_value = ref;
410 return mymap.void_overlay;
411 }
412 static pointer cast_from_void_ptr(void * ref) {
413 type_to_void_ptr_map mymap;
414 mymap.void_overlay = ref;
415 return mymap.actual_value;
416 }
417 static void destroy_token( pointer /*token*/) {}
418};
419
420// intermediate
421template<typename T, typename U, typename Body>
423 const Body& my_body;
425 typedef typename t_helper::pointer t_pointer;
427 typedef typename u_helper::pointer u_pointer;
428
429 void* operator()(void* input) __TBB_override {
430 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
431 u_pointer output_u = u_helper::create_token(my_body(tbb::internal::move(t_helper::token(temp_input))));
432 t_helper::destroy_token(temp_input);
433 return u_helper::cast_to_void_ptr(output_u);
434 }
435
436 void finalize(void * input) __TBB_override {
437 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
438 t_helper::destroy_token(temp_input);
439 }
440
441public:
442 concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
443};
444
445// input
446template<typename U, typename Body>
447class concrete_filter<void,U,Body>: public filter {
448 const Body& my_body;
450 typedef typename u_helper::pointer u_pointer;
451
453 flow_control control;
454 u_pointer output_u = u_helper::create_token(my_body(control));
455 if(control.is_pipeline_stopped) {
456 u_helper::destroy_token(output_u);
458 return NULL;
459 }
460 return u_helper::cast_to_void_ptr(output_u);
461 }
462
463public:
464 concrete_filter(tbb::filter::mode filter_mode, const Body& body) :
465 filter(static_cast<tbb::filter::mode>(filter_mode | filter_may_emit_null)),
466 my_body(body)
467 {}
468};
469
470// output
471template<typename T, typename Body>
472class concrete_filter<T,void,Body>: public filter {
473 const Body& my_body;
475 typedef typename t_helper::pointer t_pointer;
476
477 void* operator()(void* input) __TBB_override {
478 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
479 my_body(tbb::internal::move(t_helper::token(temp_input)));
480 t_helper::destroy_token(temp_input);
481 return NULL;
482 }
483 void finalize(void* input) __TBB_override {
484 t_pointer temp_input = t_helper::cast_from_void_ptr(input);
485 t_helper::destroy_token(temp_input);
486 }
487
488public:
489 concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
490};
491
492template<typename Body>
493class concrete_filter<void,void,Body>: public filter {
494 const Body& my_body;
495
497 flow_control control;
498 my_body(control);
499 void* output = control.is_pipeline_stopped ? NULL : (void*)(intptr_t)-1;
500 return output;
501 }
502public:
503 concrete_filter(filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
504};
505
507
509 tbb::pipeline my_pipe;
510public:
511 pipeline_proxy( const filter_t<void,void>& filter_chain );
513 while( filter* f = my_pipe.filter_list )
514 delete f; // filter destructor removes it from the pipeline
515 }
516 tbb::pipeline* operator->() { return &my_pipe; }
517};
518
520
523 tbb::atomic<intptr_t> ref_count;
524protected:
526 ref_count = 0;
527#ifdef __TBB_TEST_FILTER_NODE_COUNT
528 ++(__TBB_TEST_FILTER_NODE_COUNT);
529#endif
530 }
531public:
533 virtual void add_to( pipeline& ) = 0;
535 void add_ref() { ++ref_count; }
537 void remove_ref() {
538 __TBB_ASSERT(ref_count>0,"ref_count underflow");
539 if( --ref_count==0 )
540 delete this;
541 }
542 virtual ~filter_node() {
543#ifdef __TBB_TEST_FILTER_NODE_COUNT
544 --(__TBB_TEST_FILTER_NODE_COUNT);
545#endif
546 }
547};
548
550template<typename T, typename U, typename Body>
553 const Body body;
554 void add_to( pipeline& p ) __TBB_override {
556 p.add_filter( *f );
557 }
558public:
559 filter_node_leaf( tbb::filter::mode m, const Body& b ) : mode(m), body(b) {}
560};
561
564 friend class filter_node; // to suppress GCC 3.2 warnings
570 }
571 void add_to( pipeline& p ) __TBB_override {
572 left.add_to(p);
573 right.add_to(p);
574 }
575public:
577 left.add_ref();
578 right.add_ref();
579 }
580};
581
582} // namespace internal
584
586template<typename T, typename U, typename Body>
589}
590
591template<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 '&'");
595 return new internal::filter_node_join(*left.root,*right.root);
596}
597
599template<typename T, typename U>
600class filter_t {
603 filter_t( filter_node* root_ ) : root(root_) {
604 root->add_ref();
605 }
607 template<typename T_, typename U_, typename Body>
608 friend filter_t<T_,U_> make_filter(tbb::filter::mode, const Body& );
609 template<typename T_, typename V_, typename U_>
611public:
612 // TODO: add move-constructors, move-assignment, etc. where C++11 is available.
613 filter_t() : root(NULL) {}
614 filter_t( const filter_t<T,U>& rhs ) : root(rhs.root) {
615 if( root ) root->add_ref();
616 }
617 template<typename Body>
618 filter_t( tbb::filter::mode mode, const Body& body ) :
619 root( new internal::filter_node_leaf<T,U,Body>(mode, body) ) {
620 root->add_ref();
621 }
622
623 void operator=( const filter_t<T,U>& rhs ) {
624 // Order of operations below carefully chosen so that reference counts remain correct
625 // in unlikely event that remove_ref throws exception.
626 filter_node* old = root;
627 root = rhs.root;
628 if( root ) root->add_ref();
629 if( old ) old->remove_ref();
630 }
632 if( root ) root->remove_ref();
633 }
634 void clear() {
635 // Like operator= with filter_t() on right side.
636 if( root ) {
637 filter_node* old = root;
638 root = NULL;
639 old->remove_ref();
640 }
641 }
642};
643
644inline internal::pipeline_proxy::pipeline_proxy( const filter_t<void,void>& filter_chain ) : my_pipe() {
645 __TBB_ASSERT( filter_chain.root, "cannot apply parallel_pipeline to default-constructed filter_t" );
646 filter_chain.root->add_to(my_pipe);
647}
648
649inline void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t<void,void>& filter_chain
651 , tbb::task_group_context& context
652#endif
653 ) {
654 internal::pipeline_proxy pipe(filter_chain);
655 // tbb::pipeline::run() is called via the proxy
656 pipe->run(max_number_of_live_tokens
658 , context
659#endif
660 );
661}
662
663#if __TBB_TASK_GROUP_CONTEXT
664inline void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t<void,void>& filter_chain) {
666 parallel_pipeline(max_number_of_live_tokens, filter_chain, context);
667}
668#endif // __TBB_TASK_GROUP_CONTEXT
669
670} // interface6
671
672using interface6::flow_control;
673using interface6::filter_t;
676
677} // tbb
678
680#undef __TBB_pipeline_H_include_area
681
682#endif /* __TBB_pipeline_H */
#define __TBB_PIPELINE_VERSION(x)
Definition: pipeline.h:41
#define __TBB_TASK_GROUP_CONTEXT
Definition: tbb_config.h:541
#define __TBB_EXPORTED_METHOD
Definition: tbb_stddef.h:98
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
#define __TBB_override
Definition: tbb_stddef.h:240
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
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
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
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 __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
The graph class.
class __TBB_DEPRECATED_MSG("tbb::tbb_hash is deprecated, use std::hash") tbb_hash
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
filter_t< T, U > make_filter(tbb::filter::mode mode, const Body &body)
Create a filter to participate in parallel_pipeline.
Definition: pipeline.h:587
void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t< void, void > &filter_chain, tbb::task_group_context &context)
Definition: pipeline.h:649
void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t< void, void > &filter_chain)
Definition: pipeline.h:664
filter_t< T, U > operator&(const filter_t< T, V > &left, const filter_t< V, U > &right)
Definition: pipeline.h:592
long tokendiff_t
Definition: pipeline.h:44
unsigned long Token
Definition: pipeline.h:43
Class representing a chain of type-safe pipeline filters.
Definition: pipeline.h:600
filter_t(const filter_t< T, U > &rhs)
Definition: pipeline.h:614
friend filter_t< T_, U_ > operator&(const filter_t< T_, V_ > &, const filter_t< V_, U_ > &)
filter_t(filter_node *root_)
Definition: pipeline.h:603
filter_t(tbb::filter::mode mode, const Body &body)
Definition: pipeline.h:618
filter_node * root
Definition: pipeline.h:602
internal::filter_node filter_node
Definition: pipeline.h:601
friend filter_t< T_, U_ > make_filter(tbb::filter::mode, const Body &)
Create a filter to participate in parallel_pipeline.
Definition: pipeline.h:587
void operator=(const filter_t< T, U > &rhs)
Definition: pipeline.h:623
A stage in a pipeline.
Definition: pipeline.h:64
static const unsigned char filter_is_out_of_order
4th bit distinguishes ordered vs unordered filters.
Definition: pipeline.h:75
static const unsigned char filter_is_bound
5th bit distinguishes thread-bound and regular filters.
Definition: pipeline.h:78
filter(mode filter_mode)
Definition: pipeline.h:114
virtual void * operator()(void *item)=0
Operate on an item from the input stream, and return item for output stream.
bool is_ordered() const
True if filter must receive stream in order.
Definition: pipeline.h:133
internal::input_buffer * my_input_buffer
Buffer for incoming tokens, or NULL if not required.
Definition: pipeline.h:173
static const unsigned char current_version
Definition: pipeline.h:91
bool has_more_work()
has the filter not yet processed all the tokens it will ever see?
Definition: pipeline.cpp:691
static const unsigned char filter_may_emit_null
6th bit marks input filters emitting small objects
Definition: pipeline.h:81
friend class pipeline
Definition: pipeline.h:177
virtual void finalize(void *)
Destroys item if pipeline was cancelled.
Definition: pipeline.h:159
@ parallel
processes multiple items in parallel and in no particular order
Definition: pipeline.h:96
@ serial_in_order
processes items one at a time; all such filters process items in the same order
Definition: pipeline.h:98
@ serial_out_of_order
processes items one at a time and in no particular order
Definition: pipeline.h:100
static filter * not_in_pipeline()
Value used to mark "not in pipeline".
Definition: pipeline.h:67
static const unsigned char version_mask
Definition: pipeline.h:92
filter * next_filter_in_pipeline
Pointer to next filter in the pipeline.
Definition: pipeline.h:164
bool is_bound() const
True if filter is thread-bound.
Definition: pipeline.h:138
static const unsigned char exact_exception_propagation
7th bit defines exception propagation mode expected by the application.
Definition: pipeline.h:84
filter * next_segment
Pointer to the next "segment" of filters, or NULL if not required.
Definition: pipeline.h:191
const unsigned char my_filter_mode
Storage for filter mode and dynamically checked implementation version.
Definition: pipeline.h:181
filter(bool is_serial_)
Definition: pipeline.h:105
static const unsigned char filter_is_serial
The lowest bit 0 is for parallel vs. serial.
Definition: pipeline.h:70
bool object_may_be_null()
true if an input filter can emit null
Definition: pipeline.h:143
filter * prev_filter_in_pipeline
Pointer to previous filter in the pipeline.
Definition: pipeline.h:184
void __TBB_EXPORTED_METHOD set_end_of_input()
Definition: pipeline.cpp:708
pipeline * my_pipeline
Pointer to the pipeline.
Definition: pipeline.h:187
bool is_serial() const
True if filter is serial.
Definition: pipeline.h:128
virtual __TBB_EXPORTED_METHOD ~filter()
Destroy filter.
Definition: pipeline.cpp:697
A stage in a pipeline served by a user thread.
Definition: pipeline.h:196
result_type __TBB_EXPORTED_METHOD try_process_item()
If a data item is available, invoke operator() on that item.
Definition: pipeline.cpp:723
thread_bound_filter(mode filter_mode)
Definition: pipeline.h:207
result_type internal_process_item(bool is_blocking)
Internal routine for item processing.
Definition: pipeline.cpp:727
result_type __TBB_EXPORTED_METHOD process_item()
Wait until a data item becomes available, and invoke operator() on that item.
Definition: pipeline.cpp:719
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:436
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:424
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:442
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:426
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:429
input_filter control to signal end-of-input for parallel_pipeline
Definition: pipeline.h:310
static value_type & token(pointer &t)
Definition: pipeline.h:372
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:373
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:374
static pointer create_token(value_type &&source)
Definition: pipeline.h:364
static pointer create_token(const value_type &source)
Definition: pipeline.h:387
static pointer create_token(const value_type &source)
Definition: pipeline.h:404
static value_type & token(pointer &t)
Definition: pipeline.h:405
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:464
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:449
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:452
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:477
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:483
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:474
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:489
concrete_filter(filter::mode filter_mode, const Body &body)
Definition: pipeline.h:503
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:496
The class that represents an object of the pipeline for parallel_pipeline().
Definition: pipeline.h:508
pipeline_proxy(const filter_t< void, void > &filter_chain)
Definition: pipeline.h:644
Abstract base class that represents a node in a parse tree underlying a filter_t.
Definition: pipeline.h:521
void add_ref()
Increment reference count.
Definition: pipeline.h:535
tbb::atomic< intptr_t > ref_count
Definition: pipeline.h:523
void remove_ref()
Decrement reference count and delete if it becomes zero.
Definition: pipeline.h:537
virtual void add_to(pipeline &)=0
Add concrete_filter to pipeline.
Node in parse tree representing result of make_filter.
Definition: pipeline.h:551
filter_node_leaf(tbb::filter::mode m, const Body &b)
Definition: pipeline.h:559
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:554
Node in parse tree representing join of two filters.
Definition: pipeline.h:563
filter_node_join(filter_node &x, filter_node &y)
Definition: pipeline.h:576
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:571
Used to form groups of tasks.
Definition: task.h:358
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: tbb_allocator.h:58
void deallocate(pointer p, size_type)
Free previously allocated block of memory.
Definition: tbb_allocator.h:90
void destroy(pointer p)
Destroy value at location pointed to by p.
pointer allocate(size_type n, const void *=0)
Allocate space for n objects.
Definition: tbb_allocator.h:85
Base class for types that should not be copied or assigned.
Definition: tbb_stddef.h:330
A buffer of input items for a filter.
Definition: pipeline.cpp:48

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.