Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBTracer



Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/db/tracer.h>
#include <fstream.h>

ofstream strm("trace.trc");
RWDBTracer& tracer = myDbase.tracer();
tracer.setOn(RWDBTracer::SQL);
tracer.stream(strm);

Description

Class RWDBTracer provides a runtime trace facility for DBTools.h++ applications. RWDBTracers can be turned on or off, and they can be told what to trace. The default output for an RWDBTracer is the stream clog. The output from an RWDBTracer can be redirected to an ostream.

A DBTools.h++ database object contains an RWDBTracer. Consequently, enabling tracing on an RWDBDatabase, for example, produces trace output for all objects produced by that RWDBDatabase.

It is the application's responsibility to insure that the associated ostream referenced by the RWDBTracer remains in scope while the RWDBTracer is set on.

Example

Here is how to obtain a trace of all SQL sent through the RWDBDatabase myDbase, sending the output to the file "trace.out."

Notice the declaration RWDBTracer& tracer. It would be ineffective to declare tracer as an RWDBTracer, rather than as an RWDBTracer reference. Doing so would result in a local copy of myDbase's tracer: the setOn() and stream() calls would have no effect on the database that we wished to trace.

Related Classes

RWDBDatabase instances provide access to their RWDBTracers.

Public Enum

enum TraceFlag { ZERO = 0, SQL = 1 };

Public Constructors

RWDBTracer();
RWDBTracer(const RWDBTracer& tracer);

Public Member Operators

RWDBTracer& 
operator=(const RWDBTracer& tracer);
RWDBTracer& 
operator<< (char value); 
RWDBTracer& 
operator<< (unsigned char value);
RWDBTracer& 
operator<< (short value); 
RWDBTracer& 
operator<< (unsigned short value);
RWDBTracer& 
operator<< (int value);
RWDBTracer& 
operator<< (unsigned int value);
RWDBTracer& 
operator<< (long value);
RWDBTracer& 
operator<< (unsigned long value);
RWDBTracer& 
operator<< (float value);
RWDBTracer& 
operator<< (double value);
RWDBTracer& 
operator<< (const char* string);
RWDBTracer& 
operator<< (void* value);
RWDBTracer& 
operator<< (ostream& (_f)(ostream  & ));

Public Member Functions

void
acquire() const;
TraceFlag
flag();
RWBoolean 
isOn(TraceFlag flag);
RWBoolean
isValid() const;
void
release() const;
ostream&
stream();
RWDBTracer&
stream(ostream& strm);
TraceFlag
setOff(flags);
TraceFlag
setOn(flags);


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.