31.4. Building a composite filter

A special filter is provided that allows users to stack primitive filters together into a composite filter. This composite filter, CCompositeFilter, maintains a list of registered filters and will call their respective handlers in the order in which they were registered to it. The output of the first filter is fed as an input to the second filter and so on. For this reason, each subsequent filter must know how to parse the data outputted from the previous filter. If a primitive filter returns 0, the composite filter will stop iterating through its filters and return 0.

Earlier it was mentioned that the user registers primitive filters to the framework. To be more explicit, the framework maintains a composite filter that the user registers his/her primitive filters to. Even though this is the most basic and ubiquitous usage of the composite filter, one can actually register composite filters to the filter framework as well. This is possible because in the end, the composite filter is just another filter. So have fun and don?t fear building composite filters to use in the filter framework if it makes sense.