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 interface6 {
304 
305 namespace 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;
314 public:
315  void stop() { is_pipeline_stopped = true; }
316 };
317 
319 namespace internal {
320 
321 // Emulate std::is_trivially_copyable (false positives not allowed, false negatives suboptimal but safe).
322 #if __TBB_CPP11_TYPE_PROPERTIES_PRESENT
323 template<typename T> struct tbb_trivially_copyable { enum { value = std::is_trivially_copyable<T>::value }; };
324 #else
325 template<typename T> struct tbb_trivially_copyable { enum { value = false }; };
326 template<typename T> struct tbb_trivially_copyable < T* > { enum { value = true }; };
327 template<> struct tbb_trivially_copyable < bool > { enum { value = true }; };
328 template<> struct tbb_trivially_copyable < char > { enum { value = true }; };
329 template<> struct tbb_trivially_copyable < signed char > { enum { value = true }; };
330 template<> struct tbb_trivially_copyable <unsigned char > { enum { value = true }; };
331 template<> struct tbb_trivially_copyable < short > { enum { value = true }; };
332 template<> struct tbb_trivially_copyable <unsigned short > { enum { value = true }; };
333 template<> struct tbb_trivially_copyable < int > { enum { value = true }; };
334 template<> struct tbb_trivially_copyable <unsigned int > { enum { value = true }; };
335 template<> struct tbb_trivially_copyable < long > { enum { value = true }; };
336 template<> struct tbb_trivially_copyable <unsigned long > { enum { value = true }; };
337 template<> struct tbb_trivially_copyable < long long> { enum { value = true }; };
338 template<> struct tbb_trivially_copyable <unsigned long long> { enum { value = true }; };
339 template<> struct tbb_trivially_copyable < float > { enum { value = true }; };
340 template<> struct tbb_trivially_copyable < double > { enum { value = true }; };
341 template<> struct tbb_trivially_copyable < long double > { enum { value = true }; };
342 #if !_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED)
343 template<> struct tbb_trivially_copyable < wchar_t > { enum { value = true }; };
344 #endif /* _MSC_VER||!defined(_NATIVE_WCHAR_T_DEFINED) */
345 #endif // tbb_trivially_copyable
346 
347 template<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>
354 template<typename T, bool Allocate> class token_helper;
355 
356 // using tbb_allocator
357 template<typename T>
358 class token_helper<T, true> {
359 public:
361  typedef T* pointer;
362  typedef T value_type;
363 #if __TBB_CPP11_RVALUE_REF_PRESENT
364  static pointer create_token(value_type && source)
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
382 template<typename T>
383 class token_helper<T*, false> {
384 public:
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
395 template<typename T>
396 class token_helper<T, false> {
397  typedef union {
399  void * void_overlay;
400  } type_to_void_ptr_map;
401 public:
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
421 template<typename T, typename U, typename Body>
422 class concrete_filter: public tbb::filter {
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 
441 public:
442  concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
443 };
444 
445 // input
446 template<typename U, typename Body>
447 class concrete_filter<void,U,Body>: public filter {
448  const Body& my_body;
450  typedef typename u_helper::pointer u_pointer;
451 
452  void* operator()(void*) __TBB_override {
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);
457  set_end_of_input();
458  return NULL;
459  }
460  return u_helper::cast_to_void_ptr(output_u);
461  }
462 
463 public:
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
471 template<typename T, typename Body>
472 class 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 
488 public:
489  concrete_filter(tbb::filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
490 };
491 
492 template<typename Body>
493 class concrete_filter<void,void,Body>: public filter {
494  const Body& my_body;
495 
496  void* operator()(void*) __TBB_override {
497  flow_control control;
498  my_body(control);
499  void* output = control.is_pipeline_stopped ? NULL : (void*)(intptr_t)-1;
500  return output;
501  }
502 public:
503  concrete_filter(filter::mode filter_mode, const Body& body) : filter(filter_mode), my_body(body) {}
504 };
505 
507 
509  tbb::pipeline my_pipe;
510 public:
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;
524 protected:
526  ref_count = 0;
527 #ifdef __TBB_TEST_FILTER_NODE_COUNT
528  ++(__TBB_TEST_FILTER_NODE_COUNT);
529 #endif
530  }
531 public:
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 
550 template<typename T, typename U, typename Body>
553  const Body body;
554  void add_to( pipeline& p ) __TBB_override {
556  p.add_filter( *f );
557  }
558 public:
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
568  left.remove_ref();
569  right.remove_ref();
570  }
571  void add_to( pipeline& p ) __TBB_override {
572  left.add_to(p);
573  right.add_to(p);
574  }
575 public:
577  left.add_ref();
578  right.add_ref();
579  }
580 };
581 
582 } // namespace internal
584 
586 template<typename T, typename U, typename Body>
588  return new internal::filter_node_leaf<T,U,Body>(mode, body);
589 }
590 
591 template<typename T, typename V, typename U>
593  __TBB_ASSERT(left.root,"cannot use default-constructed filter_t as left argument of '&'");
594  __TBB_ASSERT(right.root,"cannot use default-constructed filter_t as right argument of '&'");
595  return new internal::filter_node_join(*left.root,*right.root);
596 }
597 
599 template<typename T, typename U>
600 class 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_>
611 public:
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 
644 inline 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 
649 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 #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
664 inline void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t<void,void>& filter_chain) {
665  tbb::task_group_context context;
666  parallel_pipeline(max_number_of_live_tokens, filter_chain, context);
667 }
668 #endif // __TBB_TASK_GROUP_CONTEXT
669 
670 } // interface6
671 
672 using interface6::flow_control;
673 using interface6::filter_t;
676 
677 } // tbb
678 
680 #undef __TBB_pipeline_H_include_area
681 
682 #endif /* __TBB_pipeline_H */
tbb::interface6::filter_t::filter_t
filter_t(const filter_t< T, U > &rhs)
Definition: pipeline.h:614
tbb::interface6::filter_t::operator&
friend filter_t< T_, U_ > operator&(const filter_t< T_, V_ > &, const filter_t< V_, U_ > &)
tbb::thread_bound_filter::thread_bound_filter
thread_bound_filter(mode filter_mode)
Definition: pipeline.h:207
tbb::interface6::internal::token_helper< T, true >::value_type
T value_type
Definition: pipeline.h:362
tbb::filter::next_segment
filter * next_segment
Pointer to the next "segment" of filters, or NULL if not required.
Definition: pipeline.h:191
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:587
internal
Definition: _flow_graph_async_msg_impl.h:24
void
void
Definition: ittnotify_static.h:91
tbb::interface6::internal::filter_node::ref_count
tbb::atomic< intptr_t > ref_count
Definition: pipeline.h:523
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::version_mask
static const unsigned char version_mask
Definition: pipeline.h:92
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::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:649
tbb::task_group_context
Used to form groups of tasks.
Definition: task.h:358
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
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::thread_bound_filter
A stage in a pipeline served by a user thread.
Definition: pipeline.h:196
tbb::interface6::internal::concrete_filter< T, void, Body >::t_pointer
t_helper::pointer t_pointer
Definition: pipeline.h:475
tbb::interface6::internal::filter_node_join
Node in parse tree representing join of two filters.
Definition: pipeline.h:563
tbb::interface6::internal::token_helper< T *, false >::cast_to_void_ptr
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:389
tbb::tbb_allocator::deallocate
void deallocate(pointer p, size_type)
Free previously allocated block of memory.
Definition: tbb_allocator.h:90
tbb::interface6::internal::token_helper
Definition: pipeline.h:354
tbb::filter::my_filter_mode
const unsigned char my_filter_mode
Storage for filter mode and dynamically checked implementation version.
Definition: pipeline.h:181
tbb::thread_bound_filter::item_not_available
@ item_not_available
Definition: pipeline.h:202
tbb::interface6::internal::token_helper< T *, false >::value_type
T * value_type
Definition: pipeline.h:386
tbb::filter::object_may_be_null
bool object_may_be_null()
true if an input filter can emit null
Definition: pipeline.h:143
__TBB_TASK_GROUP_CONTEXT
#define __TBB_TASK_GROUP_CONTEXT
Definition: tbb_config.h:541
tbb::filter::next_filter_in_pipeline
filter * next_filter_in_pipeline
Pointer to next filter in the pipeline.
Definition: pipeline.h:164
tbb::internal::stage_task
Definition: pipeline.cpp:249
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::filter::serial
@ serial
Definition: pipeline.h:102
tbb::filter::my_pipeline
pipeline * my_pipeline
Pointer to the pipeline.
Definition: pipeline.h:187
tbb
The graph class.
Definition: serial/tbb/parallel_for.h:46
tbb::interface6::internal::pipeline_proxy::pipeline_proxy
pipeline_proxy(const filter_t< void, void > &filter_chain)
Definition: pipeline.h:644
tbb::interface6::internal::concrete_filter< void, void, Body >::my_body
const Body & my_body
Definition: pipeline.h:494
tbb::task
Base class for user-defined tasks.
Definition: task.h:615
tbb::interface6::internal::filter_node
Abstract base class that represents a node in a parse tree underlying a filter_t.
Definition: pipeline.h:521
tbb::interface6::internal::token_helper< T, true >::cast_from_void_ptr
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:374
__TBB_PIPELINE_VERSION
#define __TBB_PIPELINE_VERSION(x)
Definition: pipeline.h:41
tbb::interface6::flow_control::stop
void stop()
Definition: pipeline.h:315
tbb::interface6::internal::tbb_trivially_copyable
Definition: pipeline.h:325
tbb::interface6::internal::filter_node_leaf::mode
const tbb::filter::mode mode
Definition: pipeline.h:552
tbb::internal::Token
unsigned long Token
Definition: pipeline.h:43
tbb::tbb_allocator::destroy
void destroy(pointer p)
Destroy value at location pointed to by p.
Definition: tbb_allocator.h:113
tbb::filter::current_version
static const unsigned char current_version
Definition: pipeline.h:91
tbb::interface6::internal::filter_node_join::filter_node_join
filter_node_join(filter_node &x, filter_node &y)
Definition: pipeline.h:576
tbb::interface6::internal::token_helper< T, false >::pointer
T pointer
Definition: pipeline.h:402
tbb::interface6::internal::concrete_filter::t_pointer
t_helper::pointer t_pointer
Definition: pipeline.h:425
tbb::interface6::flow_control::flow_control
flow_control()
Definition: pipeline.h:312
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::concrete_filter::finalize
void finalize(void *input) __TBB_override
Definition: pipeline.h:436
tbb::filter::is_bound
bool is_bound() const
True if filter is thread-bound.
Definition: pipeline.h:138
tbb::interface6::filter_t::filter_t
filter_t(tbb::filter::mode mode, const Body &body)
Definition: pipeline.h:618
tbb::interface6::internal::filter_node_join::left
filter_node & left
Definition: pipeline.h:565
tbb::interface6::internal::concrete_filter::my_body
const Body & my_body
Definition: pipeline.h:423
tbb::interface6::internal::concrete_filter< void, U, Body >::concrete_filter
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:464
tbb::interface6::internal::token_helper< T, false >::cast_from_void_ptr
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:412
tbb::filter::parallel
@ parallel
processes multiple items in parallel and in no particular order
Definition: pipeline.h:96
tbb::interface6::internal::concrete_filter< T, void, Body >::concrete_filter
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:489
tbb::interface6::internal::token_helper< T, false >::cast_to_void_ptr
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:406
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::interface6::internal::concrete_filter::concrete_filter
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:442
tbb::interface6::filter_t::clear
void clear()
Definition: pipeline.h:634
tbb::interface6::internal::filter_node_join::add_to
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:571
tbb::filter::~filter
virtual __TBB_EXPORTED_METHOD ~filter()
Destroy filter.
Definition: pipeline.cpp:697
tbb::filter::set_end_of_input
void __TBB_EXPORTED_METHOD set_end_of_input()
Definition: pipeline.cpp:708
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::tbb_allocator::allocate
pointer allocate(size_type n, const void *=0)
Allocate space for n objects.
Definition: tbb_allocator.h:85
tbb::interface6::internal::concrete_filter::operator()
void * operator()(void *input) __TBB_override
Definition: pipeline.h:429
tbb::interface6::internal::concrete_filter::t_helper
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:424
tbb::interface6::internal::token_helper< T, false >::token
static value_type & token(pointer &t)
Definition: pipeline.h:405
tbb::interface6::internal::token_helper< T, false >::type_to_void_ptr_map::actual_value
T actual_value
Definition: pipeline.h:398
tbb::filter
A stage in a pipeline.
Definition: pipeline.h:64
tbb::interface6::internal::token_helper< T, false >::create_token
static pointer create_token(const value_type &source)
Definition: pipeline.h:404
task.h
tbb::internal::pipeline_cleaner
Definition: pipeline.cpp:500
tbb::filter::filter_is_bound
static const unsigned char filter_is_bound
5th bit distinguishes thread-bound and regular filters.
Definition: pipeline.h:78
tbb::interface6::filter_t::filter_t
filter_t(filter_node *root_)
Definition: pipeline.h:603
tbb::interface6::internal::concrete_filter< T, void, Body >::my_body
const Body & my_body
Definition: pipeline.h:473
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
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::move
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
tbb::filter::filter
filter(bool is_serial_)
Definition: pipeline.h:105
tbb::interface6::internal::token_helper< T *, false >::destroy_token
static void destroy_token(pointer)
Definition: pipeline.h:391
tbb::filter::pipeline
friend class pipeline
Definition: pipeline.h:177
tbb::filter::not_in_pipeline
static filter * not_in_pipeline()
Value used to mark "not in pipeline".
Definition: pipeline.h:67
tbb::interface6::parallel_pipeline
void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t< void, void > &filter_chain)
Definition: pipeline.h:664
tbb::tbb_allocator
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: tbb_allocator.h:58
tbb::interface6::internal::concrete_filter
Definition: pipeline.h:306
tbb::thread_bound_filter::end_of_stream
@ end_of_stream
Definition: pipeline.h:204
tbb::filter::is_serial
bool is_serial() const
True if filter is serial.
Definition: pipeline.h:128
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:452
tbb::interface6::filter_t
Class representing a chain of type-safe pipeline filters.
Definition: pipeline.h:53
atomic.h
tbb::interface6::internal::concrete_filter< void, U, Body >::my_body
const Body & my_body
Definition: pipeline.h:448
tbb::interface6::internal::token_helper< T, false >::destroy_token
static void destroy_token(pointer)
Definition: pipeline.h:417
tbb::internal::pipeline_root_task
Definition: pipeline.cpp:400
tbb::interface6::internal::filter_node_leaf::filter_node_leaf
filter_node_leaf(tbb::filter::mode m, const Body &b)
Definition: pipeline.h:559
tbb::interface6::internal::pipeline_proxy::~pipeline_proxy
~pipeline_proxy()
Definition: pipeline.h:512
tbb::interface6::internal::filter_node_leaf::body
const Body body
Definition: pipeline.h:553
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::internal::token_helper< T *, false >::create_token
static pointer create_token(const value_type &source)
Definition: pipeline.h:387
tbb::interface6::internal::token_helper< T *, false >::pointer
T * pointer
Definition: pipeline.h:385
tbb::interface6::internal::token_helper< T, true >::create_token
static pointer create_token(value_type &&source)
Definition: pipeline.h:364
tbb::interface6::internal::token_helper< T, true >::pointer
T * pointer
Definition: pipeline.h:361
tbb::interface6::internal::use_allocator
Definition: pipeline.h:348
tbb::internal::no_copy
Base class for types that should not be copied or assigned.
Definition: tbb_stddef.h:330
_warning_suppress_disable_notice.h
__TBB_override
#define __TBB_override
Definition: tbb_stddef.h:240
tbb::interface6::internal::token_helper< T, true >::token
static value_type & token(pointer &t)
Definition: pipeline.h:372
tbb::internal::input_buffer
A buffer of input items for a filter.
Definition: pipeline.cpp:48
tbb::interface6::flow_control::is_pipeline_stopped
bool is_pipeline_stopped
Definition: pipeline.h:311
tbb::interface6::filter_t::filter_node
internal::filter_node filter_node
Definition: pipeline.h:601
tbb::interface6::internal::token_helper< T, true >::destroy_token
static void destroy_token(pointer token)
Definition: pipeline.h:375
tbb::interface6::internal::tbb_trivially_copyable::value
@ value
Definition: pipeline.h:325
tbb::interface6::internal::filter_node_leaf::add_to
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:554
tbb::interface6::internal::filter_node::~filter_node
virtual ~filter_node()
Definition: pipeline.h:542
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::internal::token_helper< T, true >::cast_to_void_ptr
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:373
tbb::filter::mode
mode
Definition: pipeline.h:94
tbb::interface6::internal::filter_node::filter_node
filter_node()
Definition: pipeline.h:525
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::interface6::internal::pipeline_proxy::my_pipe
tbb::pipeline my_pipe
Definition: pipeline.h:509
tbb::interface6::internal::filter_node_leaf
Node in parse tree representing result of make_filter.
Definition: pipeline.h:551
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::interface6::internal::token_helper< T, true >::allocator
tbb::tbb_allocator< T > allocator
Definition: pipeline.h:360
tbb::interface6::filter_t::~filter_t
~filter_t()
Definition: pipeline.h:631
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< T, void, Body >::t_helper
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:474
tbb::interface6::internal::filter_node::add_to
virtual void add_to(pipeline &)=0
Add concrete_filter to pipeline.
tbb::interface6::internal::concrete_filter::u_helper
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:426
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::internal::token_helper< T *, false >::token
static value_type & token(pointer &t)
Definition: pipeline.h:388
tbb::filter::is_ordered
bool is_ordered() const
True if filter must receive stream in order.
Definition: pipeline.h:133
tbb::interface6::filter_t::root
filter_node * root
Definition: pipeline.h:602
tbb::interface6::internal::pipeline_proxy
The class that represents an object of the pipeline for parallel_pipeline().
Definition: pipeline.h:508
tbb::interface6::internal::concrete_filter::u_pointer
u_helper::pointer u_pointer
Definition: pipeline.h:427
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:496
tbb::filter::filter
filter(mode filter_mode)
Definition: pipeline.h:114
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:587
tbb::interface6::flow_control
input_filter control to signal end-of-input for parallel_pipeline
Definition: pipeline.h:310
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:477
tbb::interface6::internal::token_helper< T *, false >::cast_from_void_ptr
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:390
tbb::interface6::internal::filter_node_join::~filter_node_join
~filter_node_join()
Definition: pipeline.h:567
tbb::internal::tokendiff_t
long tokendiff_t
Definition: pipeline.h:44
_warning_suppress_enable_notice.h
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb::interface6::internal::token_helper< T, false >::value_type
T value_type
Definition: pipeline.h:403
__TBB_EXPORTED_METHOD
#define __TBB_EXPORTED_METHOD
Definition: tbb_stddef.h:98
tbb::interface6::internal::filter_node_join::right
filter_node & right
Definition: pipeline.h:566
tbb::interface6::operator&
filter_t< T, U > operator&(const filter_t< T, V > &left, const filter_t< V, U > &right)
Definition: pipeline.h:592
tbb::interface6::filter_t::operator=
void operator=(const filter_t< T, U > &rhs)
Definition: pipeline.h:623
tbb::interface6::filter_t::filter_t
filter_t()
Definition: pipeline.h:613
tbb::thread_bound_filter::success
@ success
Definition: pipeline.h:200
tbb_allocator.h
tbb::interface6::internal::filter_node::remove_ref
void remove_ref()
Decrement reference count and delete if it becomes zero.
Definition: pipeline.h:537
tbb::interface6::internal::filter_node::add_ref
void add_ref()
Increment reference count.
Definition: pipeline.h:535
tbb::thread_bound_filter::result_type
result_type
Definition: pipeline.h:198
tbb::interface6::internal::concrete_filter< T, void, Body >::finalize
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:483
tbb::interface6::internal::token_helper< T, false >::type_to_void_ptr_map::void_overlay
void * void_overlay
Definition: pipeline.h:399
tbb::interface6::internal::concrete_filter< void, U, Body >::u_helper
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:449
tbb::interface6::internal::concrete_filter< void, U, Body >::u_pointer
u_helper::pointer u_pointer
Definition: pipeline.h:450
tbb::interface6::internal::concrete_filter< void, void, Body >::concrete_filter
concrete_filter(filter::mode filter_mode, const Body &body)
Definition: pipeline.h:503
tbb::interface6::internal::pipeline_proxy::operator->
tbb::pipeline * operator->()
Definition: pipeline.h:516
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::filter::finalize
virtual void finalize(void *)
Destroys item if pipeline was cancelled.
Definition: pipeline.h:159
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

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.