SourcePro® API Reference Guide

Product Documentation:
   SourcePro
Documentation Home
List of all members | Public Member Functions
RWTraceMultiClientFilter Class Reference

A handle class for a trace event filter that accepts multiple clients. More...

#include <rw/trace/RWTraceMultiClientFilter.h>

Inheritance diagram for RWTraceMultiClientFilter:
RWTraceEventFilter RWTraceEventClient

Public Member Functions

 RWTraceMultiClientFilter (void)
 
 RWTraceMultiClientFilter (RWTraceMultiClientFilterImp *bodyP)
 
 RWTraceMultiClientFilter (RWStaticCtor)
 
 RWTraceMultiClientFilter (const RWTraceMultiClientFilter &second)
 
 ~RWTraceMultiClientFilter (void)
 
- Public Member Functions inherited from RWTraceEventFilter
 RWTraceEventFilter ()
 
 RWTraceEventFilter (RWTraceEventFilterImp *bodyP)
 
 RWTraceEventFilter (RWStaticCtor)
 
 RWTraceEventFilter (const RWTraceEventFilter &second)
 
 ~RWTraceEventFilter (void)
 
RWTraceEventFilteroperator= (const RWTraceEventFilter &second)
 
- Public Member Functions inherited from RWTraceEventClient
 RWTraceEventClient ()
 
 RWTraceEventClient (RWTraceEventClientImp *bodyP)
 
 RWTraceEventClient (RWStaticCtor)
 
 RWTraceEventClient (const RWTraceEventClient &second)
 
virtual ~RWTraceEventClient (void)
 
void connect (RWTraceEventFilter &filter)
 
void connectToManager (void)
 
void disconnect (void)
 
bool isValid (void) const
 
bool operator!= (const RWTraceEventClient &second) const
 
RWTraceEventClientoperator= (const RWTraceEventClient &second)
 
RWTraceEventClientoperator= (RWTraceEventClientImp *ptr)
 
bool operator== (const RWTraceEventClient &second) const
 
void orphan (void)
 
void trace (const RWTraceEvent &ev)
 
void validate (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from RWTraceEventClient
RWTraceEventClientImpgetBody (void) const
 
void transfer (RWTraceEventClientImp *bodyP=0)
 

Detailed Description

RWTraceMultiClientFilter is a filter that accepts multiple clients to which it forwards trace events.

Example

This 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/trace/MultiClient.cpp.

#define RW_USER_TRACE_LEVEL 8
#include <rw\trace\trace.h>
#include <fstream>
int main(void)
{
// Declare function as traceable with the set name "main"
// this will also generate an entry/exit event
// Create an output file stream.
std::ofstream traceLog("MultiClient.log");
// Create an Ostream client on the file stream.
RWTraceOstreamClient logClient(traceLog);
// Create an Ostream client on cerr.
RWTraceOstreamClient cerrClient(std::cerr);
// Create a multiclient filter that sends messages to
// multiple clients.
RWTraceMultiClientFilter multiClient; //2
// Connect both clients to the multiClient. This must occur
// before the multiClient is connected to the manager to
// prevent loss of data.
logClient.connect(multiClient); //3
cerrClient.connect(multiClient);
// Connect the multiclient to the trace manager.
multiClient.connectToManager(); //4
// Generate some trace messages; these trace events
// will belong to the sets "rw_user" and "main"
RW_USER_TRACE_DEBUG("Debug"); //5
return 0;
}

//1 Declares the function as traceable, so you can use trace event generation macros in this function.

//2 Instantiates the multi-client filter.

//3 First connects the two clients to the filter.

//4 Then connects the filter to the manager to ensure that no trace messages are lost.

//5 Generates some trace messages.

Constructor & Destructor Documentation

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( void  )

Constructs an RWTraceMultiClientFilter (handle) and its body.

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( RWTraceMultiClientFilterImp bodyP)

Attaches to and increments the reference count on bodyP.

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( RWStaticCtor  )

Constructs a global static handle instance (that may be used before being constructed).

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( const RWTraceMultiClientFilter second)

Attaches to and increments the reference count on the body of second.

RWTraceMultiClientFilter::~RWTraceMultiClientFilter ( void  )

Destructor.

Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.