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 #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 {
96  parallel = current_version | filter_is_out_of_order,
98  serial_in_order = current_version | filter_is_serial,
100  serial_out_of_order = current_version | filter_is_serial | filter_is_out_of_order,
102  serial = serial_in_order
103  };
104 protected:
105  explicit filter( bool is_serial_ ) :
106  next_filter_in_pipeline(not_in_pipeline()),
107  my_input_buffer(NULL),
108  my_filter_mode(static_cast<unsigned char>((is_serial_ ? serial : parallel) | exact_exception_propagation)),
109  prev_filter_in_pipeline(not_in_pipeline()),
110  my_pipeline(NULL),
111  next_segment(NULL)
112  {}
113 
114  explicit filter( mode filter_mode ) :
115  next_filter_in_pipeline(not_in_pipeline()),
116  my_input_buffer(NULL),
117  my_filter_mode(static_cast<unsigned char>(filter_mode | exact_exception_propagation)),
118  prev_filter_in_pipeline(not_in_pipeline()),
119  my_pipeline(NULL),
120  next_segment(NULL)
121  {}
122 
123  // signal end-of-input for concrete_filters
124  void __TBB_EXPORTED_METHOD set_end_of_input();
125 
126 public:
128  bool is_serial() const {
129  return bool( my_filter_mode & filter_is_serial );
130  }
131 
133  bool is_ordered() const {
134  return (my_filter_mode & (filter_is_out_of_order|filter_is_serial))==filter_is_serial;
135  }
136 
138  bool is_bound() const {
139  return ( my_filter_mode & filter_is_bound )==filter_is_bound;
140  }
141 
144  return ( my_filter_mode & filter_may_emit_null ) == filter_may_emit_null;
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 
187  pipeline* my_pipeline;
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
204  end_of_stream
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 
219  result_type __TBB_EXPORTED_METHOD try_process_item();
220 
222 
226  result_type __TBB_EXPORTED_METHOD process_item();
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 
312  flow_control() { is_pipeline_stopped = false; }
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:
576  filter_node_join( filter_node& x, filter_node& y ) : left(x), right(y) {
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 {
602  filter_node* root;
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
657 #if __TBB_TASK_GROUP_CONTEXT
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 
676 
677 } // tbb
678 
680 #undef __TBB_pipeline_H_include_area
681 
682 #endif /* __TBB_pipeline_H */
static pointer cast_from_void_ptr(void *ref)
Definition: pipeline.h:374
filter_node * root
Definition: pipeline.h:602
Node in parse tree representing join of two filters.
Definition: pipeline.h:563
void add_ref()
Increment reference count.
Definition: pipeline.h:535
The class that represents an object of the pipeline for parallel_pipeline().
Definition: pipeline.h:508
static pointer create_token(value_type &&source)
Definition: pipeline.h:364
tbb::atomic< intptr_t > ref_count
Definition: pipeline.h:523
#define __TBB_TASK_GROUP_CONTEXT
Definition: tbb_config.h:542
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:496
filter_node_leaf(tbb::filter::mode m, const Body &b)
Definition: pipeline.h:559
internal::filter_node filter_node
Definition: pipeline.h:601
filter_t(tbb::filter::mode mode, const Body &body)
Definition: pipeline.h:618
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
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:489
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:571
bool is_ordered() const
True if filter must receive stream in order.
Definition: pipeline.h:133
void parallel_pipeline(size_t max_number_of_live_tokens, const filter_t< void, void > &filter_chain)
Definition: pipeline.h:664
#define __TBB_PIPELINE_VERSION(x)
Definition: pipeline.h:41
filter_t(filter_node *root_)
Definition: pipeline.h:603
virtual void finalize(void *)
Destroys item if pipeline was cancelled.
Definition: pipeline.h:159
Base class for types that should not be copied or assigned.
Definition: tbb_stddef.h:330
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
The graph class.
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 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
filter_node_join(filter_node &x, filter_node &y)
Definition: pipeline.h:576
static value_type & token(pointer &t)
Definition: pipeline.h:372
filter_t(const filter_t< T, U > &rhs)
Definition: pipeline.h:614
long tokendiff_t
Definition: pipeline.h:44
static void * cast_to_void_ptr(pointer ref)
Definition: pipeline.h:373
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:449
void add_to(pipeline &p) __TBB_override
Add concrete_filter to pipeline.
Definition: pipeline.h:554
class __TBB_DEPRECATED_MSG("tbb::tbb_hash is deprecated, use std::hash") tbb_hash
bool is_serial() const
True if filter is serial.
Definition: pipeline.h:128
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:436
static pointer create_token(const value_type &source)
Definition: pipeline.h:404
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:424
void operator=(const filter_t< T, U > &rhs)
Definition: pipeline.h:623
bool object_may_be_null()
true if an input filter can emit null
Definition: pipeline.h:143
internal::input_buffer * my_input_buffer
Buffer for incoming tokens, or NULL if not required.
Definition: pipeline.h:173
filter * prev_filter_in_pipeline
Pointer to previous filter in the pipeline.
Definition: pipeline.h:184
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:442
static filter * not_in_pipeline()
Value used to mark "not in pipeline".
Definition: pipeline.h:67
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
bool is_bound() const
True if filter is thread-bound.
Definition: pipeline.h:138
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
input_filter control to signal end-of-input for parallel_pipeline
Definition: pipeline.h:310
token_helper< U, use_allocator< U >::value > u_helper
Definition: pipeline.h:426
token_helper< T, use_allocator< T >::value > t_helper
Definition: pipeline.h:474
static pointer create_token(const value_type &source)
Definition: pipeline.h:387
Node in parse tree representing result of make_filter.
Definition: pipeline.h:551
concrete_filter(tbb::filter::mode filter_mode, const Body &body)
Definition: pipeline.h:464
filter(mode filter_mode)
Definition: pipeline.h:114
A stage in a pipeline.
Definition: pipeline.h:64
filter * next_filter_in_pipeline
Pointer to next filter in the pipeline.
Definition: pipeline.h:164
#define __TBB_override
Definition: tbb_stddef.h:240
A buffer of input items for a filter.
Definition: pipeline.cpp:48
filter * next_segment
Pointer to the next "segment" of filters, or NULL if not required.
Definition: pipeline.h:191
filter(bool is_serial_)
Definition: pipeline.h:105
void finalize(void *input) __TBB_override
Destroys item if pipeline was cancelled.
Definition: pipeline.h:483
#define __TBB_EXPORTED_METHOD
Definition: tbb_stddef.h:98
unsigned long Token
Definition: pipeline.h:43
Used to form groups of tasks.
Definition: task.h:347
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: tbb_allocator.h:58
pipeline * my_pipeline
Pointer to the pipeline.
Definition: pipeline.h:187
Class representing a chain of type-safe pipeline filters.
Definition: pipeline.h:53
virtual void add_to(pipeline &)=0
Add concrete_filter to pipeline.
const unsigned char my_filter_mode
Storage for filter mode and dynamically checked implementation version.
Definition: pipeline.h:181
filter_t< T, U > operator &(const filter_t< T, V > &left, const filter_t< V, U > &right)
Definition: pipeline.h:592
static value_type & token(pointer &t)
Definition: pipeline.h:405
void const char const char int ITT_FORMAT __itt_group_sync p
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:477
thread_bound_filter(mode filter_mode)
Definition: pipeline.h:207
void * operator()(void *input) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:429
concrete_filter(filter::mode filter_mode, const Body &body)
Definition: pipeline.h:503
Base class for user-defined tasks.
Definition: task.h:604
Abstract base class that represents a node in a parse tree underlying a filter_t. ...
Definition: pipeline.h:521
static const unsigned char filter_is_serial
The lowest bit 0 is for parallel vs. serial.
Definition: pipeline.h:70
void * operator()(void *) __TBB_override
Operate on an item from the input stream, and return item for output stream.
Definition: pipeline.h:452
A stage in a pipeline served by a user thread.
Definition: pipeline.h:196
void remove_ref()
Decrement reference count and delete if it becomes zero.
Definition: pipeline.h:537

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.