BRE12
Public Types | Public Member Functions | Protected Member Functions | Static Protected Attributes | Friends | List of all members
tbb::filter Class Referenceabstract

A stage in a pipeline. More...

#include <pipeline.h>

Inheritance diagram for tbb::filter:
tbb::thread_bound_filter

Public Types

enum  mode { parallel = current_version | filter_is_out_of_order, serial_in_order = current_version | filter_is_serial, serial_out_of_order = current_version | filter_is_serial | filter_is_out_of_order, serial = serial_in_order }
 

Public Member Functions

bool is_serial () const
 True if filter is serial.
 
bool is_ordered () const
 True if filter must receive stream in order.
 
bool is_bound () const
 True if filter is thread-bound.
 
bool object_may_be_null ()
 true if an input filter can emit null
 
virtual void * operator() (void *item)=0
 Operate on an item from the input stream, and return item for output stream. More...
 
virtual __TBB_EXPORTED_METHOD ~filter ()
 Destroy filter. More...
 
virtual void finalize (void *)
 Destroys item if pipeline was cancelled. More...
 

Protected Member Functions

 filter (bool is_serial_)
 
 filter (mode filter_mode)
 
void __TBB_EXPORTED_METHOD set_end_of_input ()
 

Static Protected Attributes

static const unsigned char filter_is_serial = 0x1
 The lowest bit 0 is for parallel vs. serial.
 
static const unsigned char filter_is_out_of_order = 0x1<<4
 4th bit distinguishes ordered vs unordered filters. More...
 
static const unsigned char filter_is_bound = 0x1<<5
 5th bit distinguishes thread-bound and regular filters.
 
static const unsigned char filter_may_emit_null = 0x1<<6
 6th bit marks input filters emitting small objects
 
static const unsigned char exact_exception_propagation
 7th bit defines exception propagation mode expected by the application. More...
 
static const unsigned char current_version = __TBB_PIPELINE_VERSION(5)
 
static const unsigned char version_mask = 0x7<<1
 

Friends

class internal::stage_task
 
class internal::pipeline_root_task
 
class pipeline
 
class thread_bound_filter
 

Detailed Description

A stage in a pipeline.

Member Enumeration Documentation

§ mode

Enumerator
parallel 

processes multiple items in parallel and in no particular order

serial_in_order 

processes items one at a time; all such filters process items in the same order

serial_out_of_order 

processes items one at a time and in no particular order

serial 
Deprecated:
use serial_in_order instead

Constructor & Destructor Documentation

§ ~filter()

virtual __TBB_EXPORTED_METHOD tbb::filter::~filter ( )
virtual

Destroy filter.

If the filter was added to a pipeline, the pipeline must be destroyed first.

Member Function Documentation

§ finalize()

virtual void tbb::filter::finalize ( void *  )
inlinevirtual

Destroys item if pipeline was cancelled.

Required to prevent memory leaks. Note it can be called concurrently even for serial filters.

§ operator()()

virtual void* tbb::filter::operator() ( void *  item)
pure virtual

Operate on an item from the input stream, and return item for output stream.

Returns NULL if filter is a sink.

Member Data Documentation

§ exact_exception_propagation

const unsigned char tbb::filter::exact_exception_propagation
staticprotected
Initial value:
=
0x0

7th bit defines exception propagation mode expected by the application.

§ filter_is_out_of_order

const unsigned char tbb::filter::filter_is_out_of_order = 0x1<<4
staticprotected

4th bit distinguishes ordered vs unordered filters.

The bit was not set for parallel filters in TBB 2.1 and earlier, but is_ordered() function always treats parallel filters as out of order.


The documentation for this class was generated from the following file: