RWAuditStreamBuffer
The class RWAuditStreamBuffer can be inserted into any stream as a way to monitor the activity of the steam. The class counts each byte as it passes through the steam. The current byte count can be obtained simply by referencing the RWAuditStreamBuffer instance. The result can also be sent to a specified object for storage through a parameter in the constructor. There is also a constructor option to specify a function to be called on each byte that passes through the buffer. For more information on the available interface, see the class description in the SourcePro API Reference Guide.
Here is a simple example of the use of this class:
 
#include <rw/bstream.h>
#include <rw/auditbuf.h>
#include <rw/cstring.h>
 
int main ()
{
RWCString greeting = “Salutations! said Charlotte.\n”;
RWAuditStreamBuffer bcounter;
 
RWbostream bcount(&bcounter); // ctor takes audit streambuf pointer
 
bcount << greeting;
std::cout << "Output byte count: " << bcounter;