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-2019 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 
18 
19 */
20 
21 #ifndef __TBB_pipeline_H
22 #define __TBB_pipeline_H
23 
24 #include "atomic.h"
25 #include "task.h"
26 #include "tbb_allocator.h"
27 #include <cstddef>
28 
29 #if __TBB_CPP11_TYPE_PROPERTIES_PRESENT || __TBB_TR1_TYPE_PROPERTIES_IN_STD_PRESENT
30 #include <type_traits>
31 #endif
32 
33 namespace tbb {
34 
35 class pipeline;
36 class filter;
37 
39 namespace internal {
40 
41 // The argument for PIPELINE_VERSION should be an integer between 2 and 9
42 #define __TBB_PIPELINE_VERSION(x) ((unsigned char)(x-2)<<1)
43 
44 typedef unsigned long Token;
45 typedef long tokendiff_t;
46 class stage_task;
47 class input_buffer;
48 class pipeline_root_task;
49 class pipeline_cleaner;
50 
51 } // namespace internal
52 
53 namespace interface6 {
54  template<typename T, typename U> class filter_t;
55 
56  namespace internal {
57  class pipeline_proxy;
58  }
59 }
60 
62 
64 
65 class filter: internal::no_copy {
66 private:
68  static filter* not_in_pipeline() {return reinterpret_cast<filter*>(intptr_t(-1));}
69 protected:
71  static const unsigned char filter_is_serial = 0x1;
72 
74 
76  static const unsigned char filter_is_out_of_order = 0x1<<4;
77 
79  static const unsigned char filter_is_bound = 0x1<<5;
80 
82  static const unsigned char filter_may_emit_null = 0x1<<6;
83 
85  static const unsigned char exact_exception_propagation =
86 #if TBB_USE_CAPTURED_EXCEPTION
87  0x0;
88 #else
89  0x1<<7;
90 #endif /* TBB_USE_CAPTURED_EXCEPTION */
91 
92  static const unsigned char current_version = __TBB_PIPELINE_VERSION(5);
93  static const unsigned char version_mask = 0x7<<1; // bits 1-3 are for version
94 public:
95  enum mode {
104  };
105 protected:
106  explicit filter( bool is_serial_ ) :
108  my_input_buffer(NULL),
109  my_filter_mode(static_cast<unsigned char>((is_serial_ ? serial : parallel) | exact_exception_propagation)),
111  my_pipeline(NULL),
112  next_segment(NULL)
113  {}
114 
115  explicit filter( mode filter_mode ) :
117  my_input_buffer(NULL),
118  my_filter_mode(static_cast<unsigned char>(filter_mode | exact_exception_propagation)),
120  my_pipeline(NULL),
121  next_segment(NULL)
122  {}
123 
124  // signal end-of-input for concrete_filters
126 
127 public:
129  bool is_serial() const {
130  return bool( my_filter_mode & filter_is_serial );
131  }
132 
134  bool is_ordered() const {
136  }
137 
139  bool is_bound() const {
141  }
142 
146  }
147 
149 
150  virtual void* operator()( void* item ) = 0;
151 
153 
154  virtual __TBB_EXPORTED_METHOD ~filter();
155 
156 #if __TBB_TASK_GROUP_CONTEXT
157 
160  virtual void finalize( void* /*item*/ ) {};
161 #endif
162 
163 private:
166 
168  // (pipeline has not yet reached end_of_input or this filter has not yet
169  // seen the last token produced by input_filter)
170  bool has_more_work();
171 
173 
174  internal::input_buffer* my_input_buffer;
175 
176  friend class internal::stage_task;
178  friend class pipeline;
179  friend class thread_bound_filter;
180 
182  const unsigned char my_filter_mode;
183 
186 
189 
191 
193 };
194 
196 
198 public:
199  enum result_type {
200  // item was processed
202  // item is currently not available
204  // there are no more items to process
206  };
207 protected:
208  explicit thread_bound_filter(mode filter_mode):
209  filter(static_cast<mode>(filter_mode | filter::filter_is_bound))
210  {
211  __TBB_ASSERT(filter_mode & filter::filter_is_serial, "thread-bound filters must be serial");
212  }
213 public:
215 
221 
223 
228 
229 private:
231  result_type internal_process_item(bool is_blocking);
232 };
233 
235 
236 class pipeline {
237 public:
240 
244 
246  void __TBB_EXPORTED_METHOD add_filter( filter& filter_ );
247 
249  void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens );
250 
251 #if __TBB_TASK_GROUP_CONTEXT
252  void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens, tbb::task_group_context& context );
254 #endif
255 
258 
259 private:
260  friend class internal::stage_task;
262  friend class filter;
263  friend class thread_bound_filter;
266 
269 
272 
275 
278 
281 
284 
287 
289  void remove_filter( filter& filter_ );
290 
293 
294 #if __TBB_TASK_GROUP_CONTEXT
295  void clear_filters();
297 #endif
298 };
299 
300 //------------------------------------------------------------------------
301 // Support for lambda-friendly parallel_pipeline interface
302 //------------------------------------------------------------------------
303 
304 namespace interface6 {
305 
306 namespace internal {
307  template<typename T, typename U, typename Body> class concrete_filter;
308 }
309 
314  template<typename T, typename U, typename Body> friend class internal::concrete_filter;
315 public:
316  void stop() { is_pipeline_stopped = true; }
317 };
318 
320 namespace internal {
321 
322 template<typename T> struct tbb_large_object {enum { value = sizeof(T) > sizeof(void *) }; };
323 
324 // Obtain type properties in one or another way
325 #if __TBB_CPP11_TYPE_PROPERTIES_PRESENT
326 template<typename T> struct tbb_trivially_copyable { enum { value = std::is_trivially_copyable<T>::value }; };
327 #elif __TBB_TR1_TYPE_PROPERTIES_IN_STD_PRESENT
328 template<typename T> struct tbb_trivially_copyable { enum { value = std::has_trivial_copy_constructor<T>::value }; };
329 #else
330 // Explicitly list the types we wish to be placed as-is in the pipeline input_buffers.
331 template<typename T> struct tbb_trivially_copyable { enum { value = false }; };
332 template<typename T> struct tbb_trivially_copyable <T*> { enum { value = true }; };
333 template<> struct tbb_trivially_copyable <short> { enum { value = true }; };
334 template<> struct tbb_trivially_copyable <unsigned short> { enum { value = true }; };
335 template<> struct tbb_trivially_copyable <int> { enum { value = !tbb_large_object<int>::value }; };
336 template<> struct tbb_trivially_copyable <unsigned int> { enum { value = !tbb_large_object<int>::value }; };
337 template<> struct tbb_trivially_copyable <long> { enum { value = !tbb_large_object<long>::value }; };
338 template<> struct tbb_trivially_copyable <unsigned long> { enum { value = !tbb_large_object<long>::value }; };
339 template<> struct tbb_trivially_copyable <float> { enum { value = !tbb_large_object<float>::value }; };
340 template<> struct tbb_trivially_copyable <double> { enum { value = !tbb_large_object<double>::value }; };
341 #endif // Obtaining type properties
342 
344 
345 template<typename T, bool> class token_helper;
346 
347 // large object helper (uses tbb_allocator)
348 template<typename T>
349 class token_helper<T, true> {
350  public:
352  typedef T* pointer;
353  typedef T value_type;
354  static pointer create_token(const value_type & source) {
355  pointer output_t = allocator().allocate(1);
356  return new (output_t) T(source);
357  }
358  static value_type & token(pointer & t) { return *t;}
359  static void * cast_to_void_ptr(pointer ref) { return (void *) ref; }
360  static pointer cast_from_void_ptr(void * ref) { return (pointer)ref; }
361  static void destroy_token(pointer token) {
362  allocator().destroy(token);
363  allocator().deallocate(token,1);
364  }
365 };
366 
367 // pointer specialization
368 template<typename T>
369 class token_helper<T*, false > {
370  public:
371  typedef T* pointer;
372  typedef T* value_type;
373  static pointer create_token(const value_type & source) { return source; }
374  static value_type & token(pointer & t) { return t;}
375  static void * cast_to_void_ptr(pointer ref) { return (void *)ref; }
376  static pointer cast_from_void_ptr(void * ref) { return (pointer)ref; }
377  static void destroy_token( pointer /*token*/) {}
378 };
379 
380 // small object specialization (converts void* to the correct type, passes objects directly.)
381 template<typename T>
382 class token_helper<T, false> {
383  typedef union {
385  void * void_overlay;
386  } type_to_void_ptr_map;
387  public:
388  typedef T pointer; // not really a pointer in this case.
389  typedef T value_type;
390  static pointer create_token(const value_type & source) {
391  return source; }
392  static value_type & token(pointer & t) { return t;}
393  static void * cast_to_void_ptr(pointer ref) {
394  type_to_void_ptr_map mymap;
395  mymap.void_overlay = NULL;
396  mymap.actual_value = ref;
397  return mymap.void_overlay;
398  }
399  static pointer cast_from_void_ptr(void * ref) {
400  type_to_void_ptr_map mymap;
401  mymap.void_overlay = ref;
402  return mymap.actual_value;
403  }
404  static void destroy_token( pointer /*token*/) {}
405 };
406 
407 template<typename T, typename U, typename Body>
408 class concrete_filter: public tbb::filter {
409  const Body& my_body;
411  typedef typename t_helper::pointer t_pointer;
413  typedef typename u_helper::pointer u_pointer;
414 
415  void* operator()(void* input) __TBB_override {
416  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
417  u_pointer output_u = u_helper::create_token(my_body(t_helper::token(temp_input)));
418  t_helper::destroy_token(temp_input);
419  return u_helper::cast_to_void_ptr(output_u);
420  }
421 
422  void finalize(void * input) __TBB_override {
423  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
424  t_helper::destroy_token(temp_input);
425  }
426 
427 public:
428  concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
429 };
430 
431 // input
432 template<typename U, typename Body>
433 class concrete_filter<void,U,Body>: public filter {
434  const Body& my_body;
436  typedef typename u_helper::pointer u_pointer;
437 
438  void* operator()(void*) __TBB_override {
439  flow_control control;
440  u_pointer output_u = u_helper::create_token(my_body(control));
441  if(control.is_pipeline_stopped) {
442  u_helper::destroy_token(output_u);
444  return NULL;
445  }
446  return u_helper::cast_to_void_ptr(output_u);
447  }
448 
449 public:
450  concrete_filter(tbb::filter::mode filter_mode, const Body& body) :
451  filter(static_cast<tbb::filter::mode>(filter_mode | filter_may_emit_null)),
452  my_body(body)
453  {}
454 };
455 
456 template<typename T, typename Body>
457 class concrete_filter<T,void,Body>: public filter {
458  const Body& my_body;
460  typedef typename t_helper::pointer t_pointer;
461 
462  void* operator()(void* input) __TBB_override {
463  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
464  my_body(t_helper::token(temp_input));
465  t_helper::destroy_token(temp_input);
466  return NULL;
467  }
468  void finalize(void* input) __TBB_override {
469  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
470  t_helper::destroy_token(temp_input);
471  }
472 
473 public:
474  concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
475 };
476 
477 template<typename Body>
478 class concrete_filter<void,void,Body>: public filter {
479  const Body& my_body;
480 
482  void* operator()(void*) __TBB_override {
483  flow_control control;
484  my_body(control);
485  void* output = control.is_pipeline_stopped ? NULL : (void*)(intptr_t)-1;
486  return output;
487  }
488 public:
489  concrete_filter(filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
490 };
491 
493 
496 public:
497  pipeline_proxy( const filter_t<void,void>& filter_chain );
499  while( filter* f = my_pipe.filter_list )
500  delete f; // filter destructor removes it from the pipeline
501  }
503 };
504 
506 
510 protected:
512  ref_count = 0;
513 #ifdef __TBB_TEST_FILTER_NODE_COUNT
514  ++(__TBB_TEST_FILTER_NODE_COUNT);
515 #endif
516  }
517 public:
519  virtual void add_to( pipeline& ) = 0;
521  void add_ref() {++ref_count;}
523  void remove_ref() {
524  __TBB_ASSERT(ref_count>0,"ref_count underflow");
525  if( --ref_count==0 )
526  delete this;
527  }
528  virtual ~filter_node() {
529 #ifdef __TBB_TEST_FILTER_NODE_COUNT
530  --(__TBB_TEST_FILTER_NODE_COUNT);
531 #endif
532  }
533 };
534 
536 template<typename T, typename U, typename Body>
539  const Body body;
542  p.add_filter( *f );
543  }
544 public:
545  filter_node_leaf( tbb::filter::mode m, const Body& b ) : mode(m), body(b) {}
546 };
547 
550  friend class filter_node; // to suppress GCC 3.2 warnings
554  left.remove_ref();
555  right.remove_ref();
556  }
558  left.add_to(p);
559  right.add_to(p);
560  }
561 public:
563  left.add_ref();
564  right.add_ref();
565  }
566 };
567 
568 } // namespace internal
570 
572 template<typename T, typename U, typename Body>
574  return new internal::filter_node_leaf<T,U,Body>(mode, body);
575 }
576 
577 template<typename T, typename V, typename U>
579  __TBB_ASSERT(left.root,"cannot use default-constructed filter_t as left argument of '&'");
580  __TBB_ASSERT(right.root,"cannot use default-constructed filter_t as right argument of '&'");
581  return new internal::filter_node_join(*left.root,*right.root);
582 }
583 
585 template<typename T, typename U>
586 class filter_t {
587  typedef internal::filter_node filter_node;
589  filter_t( filter_node* root_ ) : root(root_) {
590  root->add_ref();
591  }
593  template<typename T_, typename U_, typename Body>
594  friend filter_t<T_,U_> make_filter(tbb::filter::mode, const Body& );
595  template<typename T_, typename V_, typename U_>
597 public:
598  // TODO: add move-constructors, move-assignment, etc. where C++11 is available.
599  filter_t() : root(NULL) {}
600  filter_t( const filter_t<T,U>& rhs ) : root(rhs.root) {
601  if( root ) root->add_ref();
602  }
603  template<typename Body>
604  filter_t( tbb::filter::mode mode, const Body& body ) :
605  root( new internal::filter_node_leaf<T,U,Body>(mode, body) ) {
606  root->add_ref();
607  }
608 
609  void operator=( const filter_t<T,U>& rhs ) {
610  // Order of operations below carefully chosen so that reference counts remain correct
611  // in unlikely event that remove_ref throws exception.
612  filter_node* old = root;
613  root = rhs.root;
614  if( root ) root->add_ref();
615  if( old ) old->remove_ref();
616  }
618  if( root ) root->remove_ref();
619  }
620  void clear() {
621  // Like operator= with filter_t() on right side.
622  if( root ) {
623  filter_node* old = root;
624  root = NULL;
625  old->remove_ref();
626  }
627  }
628 };
629 
630 inline internal::pipeline_proxy::pipeline_proxy( const filter_t<void,void>& filter_chain ) : my_pipe() {
631  __TBB_ASSERT( filter_chain.root, "cannot apply parallel_pipeline to default-constructed filter_t" );
632  filter_chain.root->add_to(my_pipe);
633 }
634 
635 inline void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t<void,void>& filter_chain
637  , tbb::task_group_context& context
638 #endif
639  ) {
640  internal::pipeline_proxy pipe(filter_chain);
641  // tbb::pipeline::run() is called via the proxy
642  pipe->run(max_number_of_live_tokens
644  , context
645 #endif
646  );
647 }
648 
649 #if __TBB_TASK_GROUP_CONTEXT
650 inline void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t<void,void>& filter_chain) {
651  tbb::task_group_context context;
652  parallel_pipeline(max_number_of_live_tokens, filter_chain, context);
653 }
654 #endif // __TBB_TASK_GROUP_CONTEXT
655 
656 } // interface6
657 
658 using interface6::flow_control;
659 using interface6::filter_t;
662 
663 } // tbb
664 
665 #endif /* __TBB_pipeline_H */
__TBB_EXPORTED_METHOD pipeline()
Construct empty pipeline.
Definition: pipeline.cpp:535
unsigned long Token
Definition: pipeline.h:44
bool has_more_work()
has the filter not yet processed all the tokens it will ever see?
Definition: pipeline.cpp:695
#define __TBB_override
Definition: tbb_stddef.h:244
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:359
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:415
A processing pipeline that applies filters to items.
Definition: pipeline.h:236
bool is_serial() const
True if filter is serial.
Definition: pipeline.h:129
friend filter_t< T_, U_ > make_filter(tbb::filter::mode, const Body &)
Create a filter to participate in parallel_pipeline.
Definition: pipeline.h:573
task * end_counter
task who's reference count is used to determine when all stages are done.
Definition: pipeline.h:274
Node in parse tree representing result of make_filter.
Definition: pipeline.h:537
virtual __TBB_EXPORTED_METHOD ~filter()
Destroy filter.
Definition: pipeline.cpp:701
tbb::atomic< intptr_t > ref_count
Definition: pipeline.h:509
Class representing a chain of type-safe pipeline filters.
Definition: pipeline.h:54
void add_ref()
Increment reference count.
Definition: pipeline.h:521
static const unsigned char filter_may_emit_null
6th bit marks input filters emitting small objects
Definition: pipeline.h:82
result_type __TBB_EXPORTED_METHOD try_process_item()
If a data item is available, invoke operator() on that item.
Definition: pipeline.cpp:727
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:474
virtual __TBB_EXPORTED_METHOD ~pipeline()
Definition: pipeline.cpp:546
A buffer of input items for a filter.
Definition: pipeline.cpp:52
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
filter_t< T, U > make_filter(tbb::filter::mode mode, const Body &body)
Create a filter to participate in parallel_pipeline.
Definition: pipeline.h:573
friend filter_t< T_, U_ > operator&(const filter_t< T_, V_ > &, const filter_t< V_, U_ > &)
static filter * not_in_pipeline()
Value used to mark "not in pipeline".
Definition: pipeline.h:68
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:428
const unsigned char my_filter_mode
Storage for filter mode and dynamically checked implementation version.
Definition: pipeline.h:182
input_filter control to signal end-of-input for parallel_pipeline
Definition: pipeline.h:311
Used to form groups of tasks.
Definition: task.h:335
static const unsigned char filter_is_bound
5th bit distinguishes thread-bound and regular filters.
Definition: pipeline.h:79
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:635
A stage in a pipeline served by a user thread.
Definition: pipeline.h:197
static const unsigned char filter_is_out_of_order
4th bit distinguishes ordered vs unordered filters.
Definition: pipeline.h:76
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: tbb_allocator.h:62
Abstract base class that represents a node in a parse tree underlying a filter_t.
Definition: pipeline.h:507
filter * next_filter_in_pipeline
Pointer to next filter in the pipeline.
Definition: pipeline.h:160
filter_t(tbb::filter::mode mode, const Body &body)
Definition: pipeline.h:604
token_helper< T, is_large_object< T >::value > t_helper
Definition: pipeline.h:410
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:360
friend class internal::pipeline_root_task
Definition: pipeline.h:177
filter_node_join(filter_node &x, filter_node &y)
Definition: pipeline.h:562
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:450
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:422
token_helper< T, is_large_object< T >::value > t_helper
Definition: pipeline.h:459
filter * next_segment
Pointer to the next "segment" of filters, or NULL if not required.
Definition: pipeline.h:192
Base class for types that should not be copied or assigned.
Definition: tbb_stddef.h:335
void __TBB_EXPORTED_METHOD run(size_t max_number_of_live_tokens)
Run the pipeline to completion.
Definition: pipeline.cpp:646
filter_node * root
Definition: pipeline.h:588
internal::filter_node filter_node
Definition: pipeline.h:587
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 add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:540
Base class for user-defined tasks.
Definition: task.h:592
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:462
filter * filter_list
Pointer to first filter in the pipeline.
Definition: pipeline.h:268
processes items one at a time; all such filters process items in the same order
Definition: pipeline.h:99
concrete_filter(filter::mode filter_mode, const Body &body)
Definition: pipeline.h:489
void remove_filter(filter &filter_)
Remove filter from pipeline.
Definition: pipeline.cpp:620
static value_type & token(pointer &t)
Definition: pipeline.h:358
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:468
friend class internal::concrete_filter
Definition: pipeline.h:314
void clear_filters()
Does clean up if pipeline is cancelled or exception occurred.
filter(mode filter_mode)
Definition: pipeline.h:115
friend class internal::stage_task
Definition: pipeline.h:176
void const char const char int ITT_FORMAT __itt_group_sync p
filter * filter_end
Pointer to location where address of next filter to be added should be stored.
Definition: pipeline.h:271
bool has_thread_bound_filters
True if the pipeline contains a thread-bound filter; false otherwise.
Definition: pipeline.h:286
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:134
static const unsigned char current_version
Definition: pipeline.h:92
filter_t< T, U > operator&(const filter_t< T, V > &left, const filter_t< V, U > &right)
Definition: pipeline.h:578
void __TBB_EXPORTED_METHOD add_filter(filter &filter_)
Add filter to end of pipeline.
Definition: pipeline.cpp:569
static const unsigned char filter_is_serial
The lowest bit 0 is for parallel vs. serial.
Definition: pipeline.h:71
filter(bool is_serial_)
Definition: pipeline.h:106
filter_t(filter_node *root_)
Definition: pipeline.h:589
virtual void add_to(pipeline &)=0
Add concrete_filter to pipeline.
result_type internal_process_item(bool is_blocking)
Internal routine for item processing.
Definition: pipeline.cpp:731
token_helper< U, is_large_object< U >::value > u_helper
Definition: pipeline.h:435
#define __TBB_EXPORTED_METHOD
Definition: tbb_stddef.h:102
bool object_may_be_null()
true if an input filter can emit null
Definition: pipeline.h:144
static pointer create_token(const value_type &source)
Definition: pipeline.h:390
processes multiple items in parallel and in no particular order
Definition: pipeline.h:97
filter * prev_filter_in_pipeline
Pointer to previous filter in the pipeline.
Definition: pipeline.h:185
result_type __TBB_EXPORTED_METHOD process_item()
Wait until a data item becomes available, and invoke operator() on that item.
Definition: pipeline.cpp:723
static value_type & token(pointer &t)
Definition: pipeline.h:392
pipeline * my_pipeline
Pointer to the pipeline.
Definition: pipeline.h:188
static const unsigned char exact_exception_propagation
7th bit defines exception propagation mode expected by the application.
Definition: pipeline.h:85
void destroy(pointer p)
Destroy value at location pointed to by p.
The graph class.
pipeline_proxy(const filter_t< void, void > &filter_chain)
Definition: pipeline.h:630
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:557
pointer allocate(size_type n, const void *=0)
Allocate space for n objects.
Definition: tbb_allocator.h:89
void remove_ref()
Decrement reference count and delete if it becomes zero.
Definition: pipeline.h:523
#define __TBB_PIPELINE_VERSION(x)
Definition: pipeline.h:42
atomic< internal::Token > input_tokens
Number of idle tokens waiting for input stage.
Definition: pipeline.h:277
filter_node_leaf(tbb::filter::mode m, const Body &b)
Definition: pipeline.h:545
static pointer create_token(const value_type &source)
Definition: pipeline.h:354
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
friend class internal::pipeline_cleaner
Definition: pipeline.h:264
void operator=(const filter_t< T, U > &rhs)
Definition: pipeline.h:609
friend class internal::stage_task
Definition: pipeline.h:260
void deallocate(pointer p, size_type)
Free previously allocated block of memory.
Definition: tbb_allocator.h:94
void __TBB_EXPORTED_METHOD inject_token(task &self)
Not used, but retained to satisfy old export files.
Definition: pipeline.cpp:521
token_helper< U, is_large_object< U >::value > u_helper
Definition: pipeline.h:412
virtual void finalize(void *)
Destroys item if pipeline was cancelled.
Definition: pipeline.h:160
friend class internal::pipeline_proxy
Definition: pipeline.h:592
atomic< internal::Token > token_counter
Global counter of tokens.
Definition: pipeline.h:280
Node in parse tree representing join of two filters.
Definition: pipeline.h:549
A stage in a pipeline.
Definition: pipeline.h:65
The class that represents an object of the pipeline for parallel_pipeline().
Definition: pipeline.h:494
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_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
bool is_bound() const
True if filter is thread-bound.
Definition: pipeline.h:139
void __TBB_EXPORTED_METHOD clear()
Remove all filters from the pipeline.
Definition: pipeline.cpp:550
thread_bound_filter(mode filter_mode)
Definition: pipeline.h:208
processes items one at a time and in no particular order
Definition: pipeline.h:101
void __TBB_EXPORTED_METHOD set_end_of_input()
Definition: pipeline.cpp:712
long tokendiff_t
Definition: pipeline.h:45
filter_t(const filter_t< T, U > &rhs)
Definition: pipeline.h:600
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:438
static const unsigned char version_mask
Definition: pipeline.h:93
internal::input_buffer * my_input_buffer
Buffer for incoming tokens, or NULL if not required.
Definition: pipeline.h:174
static pointer create_token(const value_type &source)
Definition: pipeline.h:373
#define __TBB_TASK_GROUP_CONTEXT
Definition: tbb_config.h:546
friend class internal::pipeline_root_task
Definition: pipeline.h:261
bool end_of_input
False until fetch_input returns NULL.
Definition: pipeline.h:283

Copyright © 2005-2019 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.