# tbb::filter Class Reference
[Algorithms]

A stage in a pipeline. More...

`#include <pipeline.h>`

Inheritance diagram for tbb::filter:

List of all members.

## 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.
virtual __TBB_EXPORTED_METHOD | ~filter ()
| Destroy filter.
virtual void | finalize (void *)
| Destroys item if pipeline was cancelled.

## Protected Member Functions

| x1 ((is_serial_?serial:parallel)|exact_exception_propagation))
| prev_filter_in_pipeline (not_in_pipeline())
| my_pipeline (NULL)
| next_segment (NULL)
| 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.
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.

## Friends

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

## Detailed Description

A stage in a pipeline.

## Constructor & Destructor Documentation

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

virtual void tbb::filter::finalize | ( | void * |  | ) | `[inline, virtual]`

Destroys item if pipeline was cancelled.

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

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

const unsigned char tbb::filter::exact_exception_propagation`[static, protected]`

Initial value:

    #if TBB_USE_CAPTURED_EXCEPTION
                0x0

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

const unsigned char tbb::filter::filter_is_out_of_order = 0x1<<4`[static, protected]`

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:

- pipeline.h

Copyright © 2005-2013 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.