July 2007
Intermediate to advanced
332 pages
10h 4m
English
The filter class output_packet (Example 11-45) writes each packet from a packet structure to the output file.
Example 11-45. Filter to output a packet
class output_packet : public tbb::filter {
ostream& out_file;
public:
output_packet (ofstream& file) : out_file (file), filter (true) {}
void* operator() (void* item) {
packet_trace* packet = static_cast<packet_trace*> (item);
out_file << *packet;
delete packet;
return NULL;
}
};