3 #include <assert.h> /* assert */
5 /* Since the behavior for every 'simply filtered' item is the same, use a macro */
6 #define CASE_FILTER_ACTION(condition,function) \
9 f->function(filter, mode, item, next, nextData); \
11 next(nextData, mode, item); \
15 void SimpleFilter_action(void *filter
, FilterMode mode
, DataItem
*item
, FilterAction_next next
, void *nextData
) {
16 assert(filter
&& next
);
17 SimpleFilter
*f
= (SimpleFilter
*)filter
;
20 CASE_FILTER_ACTION(FILTER_WRITE
, onWrite
)
21 CASE_FILTER_ACTION(FILTER_WRITE_COMPLETE
, onWriteComplete
)
22 CASE_FILTER_ACTION(FILTER_READ
, onRead
)
23 CASE_FILTER_ACTION(FILTER_READ_COMPLETE
, onReadComplete
)
25 /* By default just pass it on no matter what it is*/
26 next(nextData
, mode
, item
);