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 
32 namespace tbb {
33 
34 class pipeline;
35 class filter;
36 
38 namespace 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 
43 typedef unsigned long Token;
44 typedef long tokendiff_t;
45 class stage_task;
46 class input_buffer;
47 class pipeline_root_task;
48 class pipeline_cleaner;
49 
50 } // namespace internal
51 
52 namespace interface6 {
53  template<typename T, typename U> class filter_t;
54 
55  namespace internal {
56  class pipeline_proxy;
57  }
58 }
59 
61 
63 
65 private:
67  static filter* not_in_pipeline() { return reinterpret_cast<filter*>(intptr_t(-1)); }
68 protected:
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
93 public:
94  enum mode {
103  };
104 protected:
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 
126 public:
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 
153  virtual __TBB_EXPORTED_METHOD ~filter();
154 
155 #if __TBB_TASK_GROUP_CONTEXT
156 
159  virtual void finalize( void* /*item*/ ) {}
160 #endif
161 
162 private:
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 
175  friend class internal::stage_task;
177  friend class pipeline;
178  friend class thread_bound_filter;
179 
181  const unsigned char my_filter_mode;
182 
185 
188 
190 
192 };
193 
195 
197 public:
198  enum result_type {
199  // item was processed
201  // item is currently not available
203  // there are no more items to process
205  };
206 protected:
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  }
212 public:
214 
220 
222 
227 
228 private:
230  result_type internal_process_item(bool is_blocking);
231 };
232 
234 
235 class __TBB_DEPRECATED_MSG("tbb::pipeline is deprecated, use tbb::parallel_pipeline") pipeline {
236 public:
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
251  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 
258 private:
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
294  void clear_filters();
296 #endif
297 };
298 
299 //------------------------------------------------------------------------
300 // Support for lambda-friendly parallel_pipeline interface
301 //------------------------------------------------------------------------
302 
303 namespace flow {
304 namespace interface11 {
305  template<typename Output> class input_node;
306 }
307 }
308 
309 namespace interface6 {
310 
311 namespace internal {
312  template<typename T, typename U, typename Body> class concrete_filter;
313 }
314 
319  template<typename T, typename U, typename Body> friend class internal::concrete_filter;
320  template<typename Output> friend class flow::interface11::input_node;
321 public:
322  void stop() { is_pipeline_stopped = true; }
323 };
324 
326 namespace internal {
327 
328 // Emulate std::is_trivially_copyable (false positives not allowed, false negatives suboptimal but safe).
329 #if __TBB_CPP11_TYPE_PROPERTIES_PRESENT
330 template<typename T> struct tbb_trivially_copyable { enum { value = std::is_trivially_copyable<T>::value }; };
331 #else
332 template<typename T> struct tbb_trivially_copyable { enum { value = false }; };
333 template<typename T> struct tbb_trivially_copyable < T* > { enum { value = true }; };
334 template<> struct tbb_trivially_copyable < bool > { enum { value = true }; };
335 template<> struct tbb_trivially_copyable < char > { enum { value = true }; };
336 template<> struct tbb_trivially_copyable < signed char > { enum { value = true }; };
337 template<> struct tbb_trivially_copyable <unsigned char > { enum { value = true }; };
338 template<> struct tbb_trivially_copyable < short > { enum { value = true }; };
339 template<> struct tbb_trivially_copyable <unsigned short > { enum { value = true }; };
340 template<> struct tbb_trivially_copyable < int > { enum { value = true }; };
341 template<> struct tbb_trivially_copyable <unsigned int > { enum { value = true }; };
342 template<> struct tbb_trivially_copyable < long > { enum { value = true }; };
343 template<> struct tbb_trivially_copyable <unsigned long > { enum { value = true }; };
344 template<> struct tbb_trivially_copyable < long long> { enum { value = true }; };
345 template<> struct tbb_trivially_copyable <unsigned long long> { enum { value = true }; };
346 template<> struct tbb_trivially_copyable < float > { enum { value = true }; };
347 template<> struct tbb_trivially_copyable < double > { enum { value = true }; };
348 template<> struct tbb_trivially_copyable < long double > { enum { value = true }; };
349 #if !_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED)
350 template<> struct tbb_trivially_copyable < wchar_t > { enum { value = true }; };
351 #endif /* _MSC_VER||!defined(_NATIVE_WCHAR_T_DEFINED) */
352 #endif // tbb_trivially_copyable
353 
354 template<typename T>
356  enum { value = sizeof(T) > sizeof(void *) || !tbb_trivially_copyable<T>::value };
357 };
358 
359 // A helper class to customize how a type is passed between filters.
360 // Usage: token_helper<T, use_allocator<T>::value>
361 template<typename T, bool Allocate> class token_helper;
362 
363 // using tbb_allocator
364 template<typename T>
365 class token_helper<T, true> {
366 public:
368  typedef T* pointer;
369  typedef T value_type;
370 #if __TBB_CPP11_RVALUE_REF_PRESENT
371  static pointer create_token(value_type && source)
372 #else
373  static pointer create_token(const value_type & source)
374 #endif
375  {
376  pointer output_t = allocator().allocate(1);
377  return new (output_t) T(tbb::internal::move(source));
378  }
379  static value_type & token(pointer & t) { return *t; }
380  static void * cast_to_void_ptr(pointer ref) { return (void *) ref; }
381  static pointer cast_from_void_ptr(void * ref) { return (pointer)ref; }
382  static void destroy_token(pointer token) {
383  allocator().destroy(token);
384  allocator().deallocate(token,1);
385  }
386 };
387 
388 // pointer specialization
389 template<typename T>
390 class token_helper<T*, false> {
391 public:
392  typedef T* pointer;
393  typedef T* value_type;
394  static pointer create_token(const value_type & source) { return source; }
395  static value_type & token(pointer & t) { return t; }
396  static void * cast_to_void_ptr(pointer ref) { return (void *)ref; }
397  static pointer cast_from_void_ptr(void * ref) { return (pointer)ref; }
398  static void destroy_token( pointer /*token*/) {}
399 };
400 
401 // converting type to and from void*, passing objects directly
402 template<typename T>
403 class token_helper<T, false> {
404  typedef union {
406  void * void_overlay;
407  } type_to_void_ptr_map;
408 public:
409  typedef T pointer; // not really a pointer in this case.
410  typedef T value_type;
411  static pointer create_token(const value_type & source) { return source; }
412  static value_type & token(pointer & t) { return t; }
413  static void * cast_to_void_ptr(pointer ref) {
414  type_to_void_ptr_map mymap;
415  mymap.void_overlay = NULL;
416  mymap.actual_value = ref;
417  return mymap.void_overlay;
418  }
419  static pointer cast_from_void_ptr(void * ref) {
420  type_to_void_ptr_map mymap;
421  mymap.void_overlay = ref;
422  return mymap.actual_value;
423  }
424  static void destroy_token( pointer /*token*/) {}
425 };
426 
427 // intermediate
428 template<typename T, typename U, typename Body>
430  const Body& my_body;
432  typedef typename t_helper::pointer t_pointer;
434  typedef typename u_helper::pointer u_pointer;
435 
436  void* operator()(void* input) __TBB_override {
437  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
438  u_pointer output_u = u_helper::create_token(my_body(tbb::internal::move(t_helper::token(temp_input))));
439  t_helper::destroy_token(temp_input);
440  return u_helper::cast_to_void_ptr(output_u);
441  }
442 
443  void finalize(void * input) __TBB_override {
444  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
445  t_helper::destroy_token(temp_input);
446  }
447 
448 public:
449  concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
450 };
451 
452 // input
453 template<typename U, typename Body>
454 class concrete_filter<void,U,Body>: public filter {
455  const Body& my_body;
457  typedef typename u_helper::pointer u_pointer;
458 
459  void* operator()(void*) __TBB_override {
460  flow_control control;
461  u_pointer output_u = u_helper::create_token(my_body(control));
462  if(control.is_pipeline_stopped) {
463  u_helper::destroy_token(output_u);
464  set_end_of_input();
465  return NULL;
466  }
467  return u_helper::cast_to_void_ptr(output_u);
468  }
469 
470 public:
471  concrete_filter(tbb::filter::mode filter_mode, const Body& body) :
472  filter(static_cast<tbb::filter::mode>(filter_mode | filter_may_emit_null)),
473  my_body(body)
474  {}
475 };
476 
477 // output
478 template<typename T, typename Body>
479 class concrete_filter<T,void,Body>: public filter {
480  const Body& my_body;
482  typedef typename t_helper::pointer t_pointer;
483 
484  void* operator()(void* input) __TBB_override {
485  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
486  my_body(tbb::internal::move(t_helper::token(temp_input)));
487  t_helper::destroy_token(temp_input);
488  return NULL;
489  }
490  void finalize(void* input) __TBB_override {
491  t_pointer temp_input = t_helper::cast_from_void_ptr(input);
492  t_helper::destroy_token(temp_input);
493  }
494 
495 public:
496  concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
497 };
498 
499 template<typename Body>
500 class concrete_filter<void,void,Body>: public filter {
501  const Body& my_body;
502 
503  void* operator()(void*) __TBB_override {
504  flow_control control;
505  my_body(control);
506  void* output = control.is_pipeline_stopped ? NULL : (void*)(intptr_t)-1;
507  return output;
508  }
509 public:
510  concrete_filter(filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
511 };
512 
514 
516  tbb::pipeline my_pipe;
517 public:
518  pipeline_proxy( const filter_t<void,void>& filter_chain );
520  while( filter* f = my_pipe.filter_list )
521  delete f; // filter destructor removes it from the pipeline
522  }
523  tbb::pipeline* operator->() { return &my_pipe; }
524 };
525 
527 
530  tbb::atomic<intptr_t> ref_count;
531 protected:
533  ref_count = 0;
534 #ifdef __TBB_TEST_FILTER_NODE_COUNT
535  ++(__TBB_TEST_FILTER_NODE_COUNT);
536 #endif
537  }
538 public:
540  virtual void add_to( pipeline& ) = 0;
542  void add_ref() { ++ref_count; }
544  void remove_ref() {
545  __TBB_ASSERT(ref_count>0,"ref_count underflow");
546  if( --ref_count==0 )
547  delete this;
548  }
549  virtual ~filter_node() {
550 #ifdef __TBB_TEST_FILTER_NODE_COUNT
551  --(__TBB_TEST_FILTER_NODE_COUNT);
552 #endif
553  }
554 };
555 
557 template<typename T, typename U, typename Body>
560  const Body body;
561  void add_to( pipeline& p ) __TBB_override {
563  p.add_filter( *f );
564  }
565 public:
566  filter_node_leaf( tbb::filter::mode m, const Body& b ) : mode(m), body(b) {}
567 };
568 
571  friend class filter_node; // to suppress GCC 3.2 warnings
575  left.remove_ref();
576  right.remove_ref();
577  }
578  void add_to( pipeline& p ) __TBB_override {
579  left.add_to(p);
580  right.add_to(p);
581  }
582 public:
584  left.add_ref();
585  right.add_ref();
586  }
587 };
588 
589 } // namespace internal
591 
593 template<typename T, typename U, typename Body>
595  return new internal::filter_node_leaf<T,U,Body>(mode, body);
596 }
597 
598 template<typename T, typename V, typename U>
600  __TBB_ASSERT(left.root,"cannot use default-constructed filter_t as left argument of '&'");
601  __TBB_ASSERT(right.root,"cannot use default-constructed filter_t as right argument of '&'");
602  return new internal::filter_node_join(*left.root,*right.root);
603 }
604 
606 template<typename T, typename U>
607 class filter_t {
610  filter_t( filter_node* root_ ) : root(root_) {
611  root->add_ref();
612  }
614  template<typename T_, typename U_, typename Body>
615  friend filter_t<T_,U_> make_filter(tbb::filter::mode, const Body& );
616  template<typename T_, typename V_, typename U_>
618 public:
619  // TODO: add move-constructors, move-assignment, etc. where C++11 is available.
620  filter_t() : root(NULL) {}
621  filter_t( const filter_t<T,U>& rhs ) : root(rhs.root) {
622  if( root ) root->add_ref();
623  }
624  template<typename Body>
625  filter_t( tbb::filter::mode mode, const Body& body ) :
626  root( new internal::filter_node_leaf<T,U,Body>(mode, body) ) {
627  root->add_ref();
628  }
629 
630  void operator=( const filter_t<T,U>& rhs ) {
631  // Order of operations below carefully chosen so that reference counts remain correct
632  // in unlikely event that remove_ref throws exception.
633  filter_node* old = root;
634  root = rhs.root;
635  if( root ) root->add_ref();
636  if( old ) old->remove_ref();
637  }
639  if( root ) root->remove_ref();
640  }
641  void clear() {
642  // Like operator= with filter_t() on right side.
643  if( root ) {
644  filter_node* old = root;
645  root = NULL;
646  old->remove_ref();
647  }
648  }
649 };
650 
651 inline internal::pipeline_proxy::pipeline_proxy( const filter_t<void,void>& filter_chain ) : my_pipe() {
652  __TBB_ASSERT( filter_chain.root, "cannot apply parallel_pipeline to default-constructed filter_t" );
653  filter_chain.root->add_to(my_pipe);
654 }
655 
656 inline void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t<void,void>& filter_chain
658  , tbb::task_group_context& context
659 #endif
660  ) {
661  internal::pipeline_proxy pipe(filter_chain);
662  // tbb::pipeline::run() is called via the proxy
663  pipe->run(max_number_of_live_tokens
665  , context
666 #endif
667  );
668 }
669 
670 #if __TBB_TASK_GROUP_CONTEXT
671 inline void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t<void,void>& filter_chain) {
672  tbb::task_group_context context;
673  parallel_pipeline(max_number_of_live_tokens, filter_chain, context);
674 }
675 #endif // __TBB_TASK_GROUP_CONTEXT
676 
677 } // interface6
678 
679 using interface6::flow_control;
680 using interface6::filter_t;
683 
684 } // tbb
685 
687 #undef __TBB_pipeline_H_include_area
688 
689 #endif /* __TBB_pipeline_H */
tbb::tbb_allocator::deallocate
void deallocate(pointer p, size_type)
Free previously allocated block of memory.
Definition: tbb_allocator.h:90
tbb::thread_bound_filter::item_not_available
@ item_not_available
Definition: pipeline.h:202
tbb::thread_bound_filter::result_type
result_type
Definition: pipeline.h:198
tbb::interface6::make_filter
filter_t< T, U > make_filter(tbb::filter::mode mode, const Body &body)
Create a filter to participate in parallel_pipeline.
Definition: pipeline.h:594
tbb::interface6::internal::filter_node_join::add_to
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:578
tbb::interface6::internal::token_helper< T, false >::type_to_void_ptr_map::void_overlay
void * void_overlay
Definition: pipeline.h:406
internal
Definition: _flow_graph_async_msg_impl.h:24
tbb::interface6::flow_control::is_pipeline_stopped
bool is_pipeline_stopped
Definition: pipeline.h:317
void
void
Definition: ittnotify_static.h:91
tbb::interface6::internal::filter_node_leaf::body
const Body body
Definition: pipeline.h:560
tbb::filter::exact_exception_propagation
static const unsigned char exact_exception_propagation
7th bit defines exception propagation mode expected by the application.
Definition: pipeline.h:84
tbb::interface6::filter_t::filter_t
filter_t(filter_node *root_)
Definition: pipeline.h:610
tbb::thread_bound_filter::try_process_item
result_type __TBB_EXPORTED_METHOD try_process_item()
If a data item is available, invoke operator() on that item.
Definition: pipeline.cpp:723
tbb::interface6::parallel_pipeline
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:656
tbb::interface6::internal::filter_node_leaf::filter_node_leaf
filter_node_leaf(tbb::filter::mode m, const Body &b)
Definition: pipeline.h:566
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::filter::serial
@ serial
Definition: pipeline.h:102
tbb::interface6::internal::token_helper< T *, false >::create_token
static pointer create_token(const value_type &source)
Definition: pipeline.h:394
tbb::interface6::internal::pipeline_proxy
The class that represents an object of the pipeline for parallel_pipeline().
Definition: pipeline.h:515
tbb::interface6::internal::token_helper< T, true >::value_type
T value_type
Definition: pipeline.h:369
tbb::filter::filter_is_out_of_order
static const unsigned char filter_is_out_of_order
4th bit distinguishes ordered vs unordered filters.
Definition: pipeline.h:75
tbb::filter::my_pipeline
pipeline * my_pipeline
Pointer to the pipeline.
Definition: pipeline.h:187
tbb::interface6::internal::concrete_filter< void, void, Body >::operator()
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:503
tbb::filter::~filter
virtual __TBB_EXPORTED_METHOD ~filter()
Destroy filter.
Definition: pipeline.cpp:697
tbb::interface6::flow_control
input_filter control to signal end-of-input for parallel_pipeline
Definition: pipeline.h:316
tbb::filter::set_end_of_input
void __TBB_EXPORTED_METHOD set_end_of_input()
Definition: pipeline.cpp:708
tbb::interface6::internal::token_helper< T, false >::value_type
T value_type
Definition: pipeline.h:410
__TBB_TASK_GROUP_CONTEXT
#define __TBB_TASK_GROUP_CONTEXT
Definition: tbb_config.h:541
tbb::interface6::internal::token_helper< T *, false >::destroy_token
static void destroy_token(pointer)
Definition: pipeline.h:398
tbb::filter::my_input_buffer
internal::input_buffer * my_input_buffer
Buffer for incoming tokens, or NULL if not required.
Definition: pipeline.h:173
tbb::filter::current_version
static const unsigned char current_version
Definition: pipeline.h:91
tbb
The graph class.
Definition: serial/tbb/parallel_for.h:46
tbb::interface6::internal::concrete_filter< T, void, Body >::t_helper
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:481
tbb::thread_bound_filter
A stage in a pipeline served by a user thread.
Definition: pipeline.h:196
tbb::interface6::internal::token_helper< T, true >::allocator
tbb::tbb_allocator< T > allocator
Definition: pipeline.h:367
tbb::interface6::internal::token_helper< T, false >::cast_to_void_ptr
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:413
__TBB_PIPELINE_VERSION
#define __TBB_PIPELINE_VERSION(x)
Definition: pipeline.h:41
tbb::interface6::internal::filter_node_join
Node in parse tree representing join of two filters.
Definition: pipeline.h:570
tbb::interface6::internal::filter_node::add_to
virtual void add_to(pipeline &)=0
Add concrete_filter to pipeline.
tbb::thread_bound_filter::process_item
result_type __TBB_EXPORTED_METHOD process_item()
Wait until a data item becomes available, and invoke operator() on that item.
Definition: pipeline.cpp:719
tbb::tbb_allocator::allocate
pointer allocate(size_type n, const void *=0)
Allocate space for n objects.
Definition: tbb_allocator.h:85
tbb::interface6::internal::token_helper
Definition: pipeline.h:361
tbb::internal::Token
unsigned long Token
Definition: pipeline.h:43
tbb::filter::filter_may_emit_null
static const unsigned char filter_may_emit_null
6th bit marks input filters emitting small objects
Definition: pipeline.h:81
tbb::filter::pipeline
friend class pipeline
Definition: pipeline.h:177
tbb::interface6::internal::concrete_filter< void, U, Body >::u_helper
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:456
tbb::internal::pipeline_cleaner
Definition: pipeline.cpp:500
tbb::interface6::internal::concrete_filter::t_helper
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:431
tbb::interface6::internal::token_helper< T *, false >::value_type
T * value_type
Definition: pipeline.h:393
tbb::__TBB_DEPRECATED_MSG
class __TBB_DEPRECATED_MSG("tbb::tbb_hash is deprecated, use std::hash") tbb_hash
Definition: _tbb_hash_compare_impl.h:86
tbb::interface6::internal::token_helper< T, false >::type_to_void_ptr_map::actual_value
T actual_value
Definition: pipeline.h:405
tbb::filter::is_serial
bool is_serial() const
True if filter is serial.
Definition: pipeline.h:128
tbb::interface6::filter_t::filter_t
filter_t()
Definition: pipeline.h:620
tbb::interface6::internal::token_helper< T, false >::create_token
static pointer create_token(const value_type &source)
Definition: pipeline.h:411
tbb::filter::finalize
virtual void finalize(void *)
Destroys item if pipeline was cancelled.
Definition: pipeline.h:159
tbb::interface6::internal::token_helper< T *, false >::cast_from_void_ptr
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:397
tbb::interface6::internal::concrete_filter< T, void, Body >::t_pointer
t_helper::pointer t_pointer
Definition: pipeline.h:482
tbb::interface6::internal::filter_node::ref_count
tbb::atomic< intptr_t > ref_count
Definition: pipeline.h:530
tbb::filter::mode
mode
Definition: pipeline.h:94
tbb::internal::stage_task
Definition: pipeline.cpp:249
tbb::interface6::internal::filter_node_join::right
filter_node & right
Definition: pipeline.h:573
tbb::interface6::filter_t::root
filter_node * root
Definition: pipeline.h:609
tbb::interface6::internal::concrete_filter::u_pointer
u_helper::pointer u_pointer
Definition: pipeline.h:434
tbb::interface6::internal::concrete_filter< T, void, Body >::operator()
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:484
tbb::filter::next_filter_in_pipeline
filter * next_filter_in_pipeline
Pointer to next filter in the pipeline.
Definition: pipeline.h:164
tbb::filter::my_filter_mode
const unsigned char my_filter_mode
Storage for filter mode and dynamically checked implementation version.
Definition: pipeline.h:181
mode
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
Definition: ittnotify_static.h:109
tbb::interface6::internal::concrete_filter::concrete_filter
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:449
tbb::interface6::internal::filter_node_leaf::add_to
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:561
tbb::interface6::internal::token_helper< T, false >::pointer
T pointer
Definition: pipeline.h:409
tbb::interface6::internal::filter_node::~filter_node
virtual ~filter_node()
Definition: pipeline.h:549
tbb::interface6::internal::filter_node::filter_node
filter_node()
Definition: pipeline.h:532
tbb::interface6::internal::concrete_filter< T, void, Body >::finalize
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:490
tbb::filter::next_segment
filter * next_segment
Pointer to the next "segment" of filters, or NULL if not required.
Definition: pipeline.h:191
tbb::thread_bound_filter::thread_bound_filter
thread_bound_filter(mode filter_mode)
Definition: pipeline.h:207
tbb::task_group_context
Used to form groups of tasks.
Definition: task.h:358
tbb::filter::parallel
@ parallel
processes multiple items in parallel and in no particular order
Definition: pipeline.h:96
task.h
tbb::filter::version_mask
static const unsigned char version_mask
Definition: pipeline.h:92
tbb::interface6::internal::filter_node::add_ref
void add_ref()
Increment reference count.
Definition: pipeline.h:542
tbb::filter::operator()
virtual void * operator()(void *item)=0
Operate on an item from the input stream, and return item for output stream.
tbb::interface6::internal::token_helper< T, false >::destroy_token
static void destroy_token(pointer)
Definition: pipeline.h:424
tbb::interface6::internal::concrete_filter< void, void, Body >::concrete_filter
concrete_filter(filter::mode filter_mode, const Body &body)
Definition: pipeline.h:510
tbb::filter::filter
filter(mode filter_mode)
Definition: pipeline.h:114
tbb::interface6::filter_t::clear
void clear()
Definition: pipeline.h:641
tbb::filter::filter_is_serial
static const unsigned char filter_is_serial
The lowest bit 0 is for parallel vs. serial.
Definition: pipeline.h:70
tbb::interface6::internal::concrete_filter::my_body
const Body & my_body
Definition: pipeline.h:430
tbb::interface6::internal::pipeline_proxy::~pipeline_proxy
~pipeline_proxy()
Definition: pipeline.h:519
int
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
Definition: ittnotify_static.h:217
tbb::filter::is_bound
bool is_bound() const
True if filter is thread-bound.
Definition: pipeline.h:138
tbb::move
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
tbb::filter
A stage in a pipeline.
Definition: pipeline.h:64
tbb::interface6::parallel_pipeline
void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t< void, void > &filter_chain)
Definition: pipeline.h:671
tbb::interface6::internal::filter_node
Abstract base class that represents a node in a parse tree underlying a filter_t.
Definition: pipeline.h:528
tbb::filter::is_ordered
bool is_ordered() const
True if filter must receive stream in order.
Definition: pipeline.h:133
tbb::interface6::internal::concrete_filter< void, void, Body >::my_body
const Body & my_body
Definition: pipeline.h:501
tbb::interface6::internal::token_helper< T, true >::destroy_token
static void destroy_token(pointer token)
Definition: pipeline.h:382
tbb::filter::object_may_be_null
bool object_may_be_null()
true if an input filter can emit null
Definition: pipeline.h:143
tbb::interface6::internal::filter_node_leaf::mode
const tbb::filter::mode mode
Definition: pipeline.h:559
tbb::interface6::internal::token_helper< T, true >::pointer
T * pointer
Definition: pipeline.h:368
tbb::interface6::internal::concrete_filter::operator()
void * operator()(void *input) __TBB_override
Definition: pipeline.h:436
tbb::interface6::internal::tbb_trivially_copyable
Definition: pipeline.h:332
atomic.h
tbb::filter::prev_filter_in_pipeline
filter * prev_filter_in_pipeline
Pointer to previous filter in the pipeline.
Definition: pipeline.h:184
tbb::interface6::internal::concrete_filter::u_helper
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:433
tbb::interface6::internal::concrete_filter< void, U, Body >::u_pointer
u_helper::pointer u_pointer
Definition: pipeline.h:457
tbb::flow::interface11::input_node
An executable node that acts as a source, i.e. it has no predecessors.
Definition: flow_graph.h:904
tbb::thread_bound_filter::end_of_stream
@ end_of_stream
Definition: pipeline.h:204
tbb::interface6::internal::filter_node_join::left
filter_node & left
Definition: pipeline.h:572
tbb::interface6::internal::concrete_filter
Definition: pipeline.h:429
tbb::tbb_allocator
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: tbb_allocator.h:58
_warning_suppress_disable_notice.h
tbb::interface6::internal::token_helper< T, false >::cast_from_void_ptr
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:419
tbb::interface6::filter_t::operator&
friend filter_t< T_, U_ > operator&(const filter_t< T_, V_ > &, const filter_t< V_, U_ > &)
__TBB_override
#define __TBB_override
Definition: tbb_stddef.h:240
tbb::interface6::filter_t
Class representing a chain of type-safe pipeline filters.
Definition: pipeline.h:607
tbb::interface6::internal::concrete_filter< void, U, Body >::concrete_filter
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:471
tbb::interface6::filter_t::filter_t
filter_t(tbb::filter::mode mode, const Body &body)
Definition: pipeline.h:625
tbb::interface6::internal::token_helper< T *, false >::token
static value_type & token(pointer &t)
Definition: pipeline.h:395
tbb::interface6::internal::pipeline_proxy::pipeline_proxy
pipeline_proxy(const filter_t< void, void > &filter_chain)
Definition: pipeline.h:651
tbb::interface6::internal::concrete_filter< T, void, Body >::my_body
const Body & my_body
Definition: pipeline.h:480
tbb::interface6::filter_t::make_filter
friend filter_t< T_, U_ > make_filter(tbb::filter::mode, const Body &)
Create a filter to participate in parallel_pipeline.
Definition: pipeline.h:594
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
tbb::filter::has_more_work
bool has_more_work()
has the filter not yet processed all the tokens it will ever see?
Definition: pipeline.cpp:691
tbb::interface6::internal::token_helper< T, true >::create_token
static pointer create_token(value_type &&source)
Definition: pipeline.h:371
tbb::interface6::internal::token_helper< T, false >::token
static value_type & token(pointer &t)
Definition: pipeline.h:412
tbb::interface6::internal::tbb_trivially_copyable::value
@ value
Definition: pipeline.h:332
tbb::interface6::internal::use_allocator
Definition: pipeline.h:355
tbb::interface6::internal::token_helper< T, true >::token
static value_type & token(pointer &t)
Definition: pipeline.h:379
tbb::internal::no_copy
Base class for types that should not be copied or assigned.
Definition: tbb_stddef.h:330
tbb::interface6::internal::filter_node_join::~filter_node_join
~filter_node_join()
Definition: pipeline.h:574
tbb::interface6::internal::token_helper< T *, false >::pointer
T * pointer
Definition: pipeline.h:392
tbb::internal::pipeline_root_task
Definition: pipeline.cpp:400
tbb::thread_bound_filter::internal_process_item
result_type internal_process_item(bool is_blocking)
Internal routine for item processing.
Definition: pipeline.cpp:727
tbb::tbb_allocator::destroy
void destroy(pointer p)
Destroy value at location pointed to by p.
Definition: tbb_allocator.h:113
tbb::interface6::filter_t::filter_t
filter_t(const filter_t< T, U > &rhs)
Definition: pipeline.h:621
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 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
Definition: ittnotify_static.h:192
tbb::interface6::filter_t::~filter_t
~filter_t()
Definition: pipeline.h:638
tbb::interface6::internal::pipeline_proxy::my_pipe
tbb::pipeline my_pipe
Definition: pipeline.h:516
tbb::interface6::internal::token_helper< T, true >::cast_to_void_ptr
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:380
tbb::interface6::flow_control::flow_control
flow_control()
Definition: pipeline.h:318
tbb::interface6::internal::filter_node_leaf
Node in parse tree representing result of make_filter.
Definition: pipeline.h:558
tbb::interface6::internal::token_helper< T *, false >::cast_to_void_ptr
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:396
tbb::interface6::internal::filter_node::remove_ref
void remove_ref()
Decrement reference count and delete if it becomes zero.
Definition: pipeline.h:544
tbb::internal::tokendiff_t
long tokendiff_t
Definition: pipeline.h:44
_warning_suppress_enable_notice.h
tbb::interface6::flow_control::stop
void stop()
Definition: pipeline.h:322
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb::filter::serial_out_of_order
@ serial_out_of_order
processes items one at a time and in no particular order
Definition: pipeline.h:100
__TBB_EXPORTED_METHOD
#define __TBB_EXPORTED_METHOD
Definition: tbb_stddef.h:98
tbb::filter::filter
filter(bool is_serial_)
Definition: pipeline.h:105
tbb::interface6::operator&
filter_t< T, U > operator&(const filter_t< T, V > &left, const filter_t< V, U > &right)
Definition: pipeline.h:599
tbb::interface6::internal::pipeline_proxy::operator->
tbb::pipeline * operator->()
Definition: pipeline.h:523
tbb::interface6::filter_t::filter_node
internal::filter_node filter_node
Definition: pipeline.h:608
tbb::interface6::internal::concrete_filter::t_pointer
t_helper::pointer t_pointer
Definition: pipeline.h:432
tbb::interface6::internal::concrete_filter< void, U, Body >::my_body
const Body & my_body
Definition: pipeline.h:455
tbb::interface6::internal::token_helper< T, true >::cast_from_void_ptr
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:381
tbb_allocator.h
tbb::filter::serial_in_order
@ serial_in_order
processes items one at a time; all such filters process items in the same order
Definition: pipeline.h:98
tbb::internal::input_buffer
A buffer of input items for a filter.
Definition: pipeline.cpp:48
tbb::interface6::filter_t::operator=
void operator=(const filter_t< T, U > &rhs)
Definition: pipeline.h:630
tbb::interface6::internal::concrete_filter< void, U, Body >::operator()
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:459
tbb::interface6::internal::concrete_filter< T, void, Body >::concrete_filter
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:496
tbb::thread_bound_filter::success
@ success
Definition: pipeline.h:200
tbb::interface6::internal::filter_node_join::filter_node_join
filter_node_join(filter_node &x, filter_node &y)
Definition: pipeline.h:583
tbb::interface6::internal::concrete_filter::finalize
void finalize(void *input) __TBB_override
Definition: pipeline.h:443
tbb::filter::not_in_pipeline
static filter * not_in_pipeline()
Value used to mark "not in pipeline".
Definition: pipeline.h:67
tbb::filter::filter_is_bound
static const unsigned char filter_is_bound
5th bit distinguishes thread-bound and regular filters.
Definition: pipeline.h:78

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.