MeterFilter
Jump to navigation
Jump to search
A MeterFilter counts the number of bytes processed by the filter. The sample below demonstrates use of a Redirector and MeterFilter to count the number of bytes output by the HexEncoder and subsequently input to the StringSink.
byte data[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; string encoded; MeterFilter meter( new StringSink( encoded ) ); ArraySource( data, sizeof( data ), true, new HexEncoder( new Redirector( meter ), true /*UCase*/, 2 /*Group*/, " " /*Separator*/ ) ); cout << "processed " << meter.GetTotalBytes() << " bytes" << endl; cout << encoded << endl;
Output: Processed 23 bytes
00 01 02 03 04 05 06 07