Trace System. More...

#include <rtrace.h>

Collaboration diagram for RTrace:
[legend]

Public Member Functions

 RTrace (const RString &msg)
 
int Compare (const RTrace &msg) const
 
int Compare (const RString &msg) const
 
bool operator== (const RTrace &msg) const
 
bool operator== (const RString &msg) const
 
 ~RTrace (void)
 

Static Public Member Functions

static RTraceLookMsg (const RString &msg)
 
static RTraceInsertMsg (const RString &msg)
 
static void DeleteMsg (RTrace *msg)
 

Private Attributes

RString Msg
 

Detailed Description

Trace System.

The RTrace class provides a representation for a message that can be leave by some objects and that can be retrieve by others. This system can be used for debugging purposes to handle inter-dependency problems.

// Library A
#include <rtrace.h>
using namespace R;
void SomeWhereInTheCode(int money)
{
...
if(!money)
RTrace::InsertMsg("Special situation : No money");
...
}
// Library B
#include <rtrace.h>
using namespace R;
void SomeWhereElseInTheCode(void)
{
...
RTrace* msg=RTrace::LookMsg("Special situation : No money");
if(msg)
{
cout<<"Put here a breakpoint"<<endl;
RTrace::DeleteMsg(msg); // Situation handled
}
...
}

Constructor & Destructor Documentation

RTrace ( const RString msg)

Construct the tracing of a message.

Parameters
msgContain.
~RTrace ( void  )

Destruct the message.

Member Function Documentation

int Compare ( const RTrace msg) const

Compare two messages by comparing their content.

See also
R::RContainer
Parameters
msgMessage.
Returns
int
int Compare ( const RString msg) const

Compare a message with a given string.

See also
R::RContainer
Parameters
msgRString.
Returns
int
bool operator== ( const RTrace msg) const

Equal operator between messages.

Parameters
msgMessage.
Returns
true if equal, false else.
bool operator== ( const RString msg) const

Equal operator between a message and a string.

Parameters
msgRString.
Returns
true if equal, false else.
static RTrace* LookMsg ( const RString msg)
static

Look after a specific message.

Parameters
msgString.
Returns
Pointer to the specific message, or 0 if not found.
static RTrace* InsertMsg ( const RString msg)
static

Insert a new message.

Parameters
msgString representing the message.
Returns
Pointer to the message inserted.
static void DeleteMsg ( RTrace msg)
static

Delete a message.

Parameters
msgMessage.

Field Documentation

RString Msg
private

The message to trace.