SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 (const RWTraceMultiClientFilter &second)
 
 RWTraceMultiClientFilter (RWStaticCtor)
 
 RWTraceMultiClientFilter (RWTraceMultiClientFilterImp *bodyP)
 
 RWTraceMultiClientFilter (void)
 
 ~RWTraceMultiClientFilter (void)
 
- Public Member Functions inherited from RWTraceEventFilter
 RWTraceEventFilter ()
 
 RWTraceEventFilter (const RWTraceEventFilter &second)
 
 RWTraceEventFilter (RWStaticCtor)
 
 RWTraceEventFilter (RWTraceEventFilterImp *bodyP)
 
 ~RWTraceEventFilter (void)
 
RWTraceEventFilteroperator= (const RWTraceEventFilter &second)
 
- Public Member Functions inherited from RWTraceEventClient
 RWTraceEventClient ()
 
 RWTraceEventClient (const RWTraceEventClient &second)
 
 RWTraceEventClient (RWStaticCtor)
 
 RWTraceEventClient (RWTraceEventClientImp *bodyP)
 
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;
}
void connect(RWTraceEventFilter &filter)
void connectToManager(void)
A handle class for a trace event filter that accepts multiple clients.
Definition RWTraceMultiClientFilter.h:98
A handle class for a trace event client that sends all events to an std::ostream.
Definition RWTraceOstreamClient.h:49
#define RW_USER_TRACE_TEST(msg)
Definition userdefs.h:315
#define RW_USER_TRACE_WARNING(msg)
Definition userdefs.h:283
#define RW_USER_TRACE_ERROR(msg)
Definition userdefs.h:267
#define RW_USER_TRACE_DEBUG(msg)
Definition userdefs.h:331
#define RW_USER_TRACEABLE_FUNCTION(functionTag)
Definition userdefs.h:158
#define RW_USER_TRACE_FATAL(msg)
Definition userdefs.h:251
#define RW_USER_TRACE_INFO(msg)
Definition userdefs.h:299

//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() [1/4]

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( void )

Constructs an RWTraceMultiClientFilter (handle) and its body.

◆ RWTraceMultiClientFilter() [2/4]

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( RWTraceMultiClientFilterImp * bodyP)

Attaches to and increments the reference count on bodyP.

◆ RWTraceMultiClientFilter() [3/4]

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( RWStaticCtor )

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

◆ RWTraceMultiClientFilter() [4/4]

RWTraceMultiClientFilter::RWTraceMultiClientFilter ( const RWTraceMultiClientFilter & second)

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

◆ ~RWTraceMultiClientFilter()

RWTraceMultiClientFilter::~RWTraceMultiClientFilter ( void )

Destructor.

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