
RWTraceMultiClientFilterRWTraceEventFilter
RWTraceEventClient
None
#include <rw/trace/RWTraceMultiClientFilter.h>
RWTraceMultiClientFilter is a filter that accepts multiple clients and forwards trace events to them.
The following example creates two clients; one displays messages on the screen, and the other saves them to a file. This example can be found in examples/pwrtools/trace/example2.cpp.
#define RW_USER_TRACE_LEVEL 8
#include <rw\trace\trace.h>
#include <fstream.h>
int main()
{
ofstream traceLog("trace.log");
RWTraceOstreamClient myFileTraceClient(traceLog);
RWTraceOstreamClient myCerrTraceClient(cerr);
RWTraceMultiClientFilter myMultiFilter; // 1
// first: connect two clients to multi client filter
myFileTraceClient.connect(myMultiFilter); // 2
myCerrTraceClient.connect(myMultiFilter);
// last: connect filter to singleton manager
myMultiFilter.connectToManager(); // 3
RW_USER_TRACEABLE_FUNCTION("main"); // 4
RW_USER_TRACE_DEBUG("Picked up pencil.");
RW_USER_TRACE_TEST("Visual inspection of pencil complete.");
RW_USER_TRACE_INFO("Doodling!");
...
return 0;
}
The following is a description of each program line:
| //1 | Instantiate the multi-client filter. |
| //2 | First connect the two clients to the filter. |
| //3 | Then connect the filter to the manager to ensure that no trace messages are lost. |
| //4 | Generate some trace messages. |
RWTraceMultiClientFilter(RWStaticCtor);
Constructs a global static handle instance (may be used before being constructed).
RWTraceMultiClientFilter(RWTraceMultiClientFilterImp* bodyP);
Attaches to and increments the reference count on a body.
RWTraceMultiClientFilter(const RWTraceMultiClientFilter& second);
Copy constructor.
RWTraceMultiClientFilter(void);
Constructs an RWTraceMultiClientFilter (handle) and its body.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.