NAME

OTC_TraceSwitch - Switch class for customising trace output.

SYNOPSIS


#include <OTC/debug/trcswtch.hh>

class OTC_TraceSwitch
{
  public:
    inline ~OTC_TraceSwitch();
    inline OTC_TraceSwitch(OTC_Boolean theState=OTCLIB_FALSE);
    inline OTC_TraceSwitch(OTC_TraceSwitch const& theSwitch);
    inline OTC_TraceSwitch& operator=(OTC_Boolean theState);
    inline OTC_TraceSwitch& operator=(
      OTC_TraceSwitch const& theSwitch
    );
    virtual OTC_Boolean enabled() const;
    operator int() const;
    OTC_TraceSwitch operator||(
      OTC_TraceSwitch const& theSwitch
    ) const;
    OTC_TraceSwitch operator&&(
      OTC_TraceSwitch const& theSwitch
    ) const;
    OTC_TraceSwitch operator!() const;
};

CLASS TYPE

Concrete

DESCRIPTION

The OTC_TraceSwitch class provides a basis for creating ways of being selective about what trace information is displayed. By overriding the enabled() member function in a derived class, trace output can be dynamically enabled based on some aspect of the operating environment. If the enabled() function returns OTCLIB_TRUE, trace output is enabled for the statement using the switch. The OTC_TraceSwitch class and its derived classes should be used in conjunction with the OTCLIB_TRACER macro. The macro OTCLIB_TRACESWITCH can be used to create an instance of the class. When the macro is used, the code will be compiled into your code, only when the preprocessor symbol OTCLIB_TRACE is defined. The macro OTCLIB_SETTRACESWITCH can be used set the value of an instance of the OTC_TraceSwitch class created using the OTCLIB_TRACESWITCH macro.

INITIALISATION

inline OTC_TraceSwitch(OTC_Boolean theState=OTCLIB_FALSE);
inline OTC_TraceSwitch(OTC_TraceSwitch const& theSwitch);
inline OTC_TraceSwitch& operator=(OTC_Boolean theState);
inline OTC_TraceSwitch& operator=(OTC_TraceSwitch const& theSwitch);

QUERY

virtual OTC_Boolean enabled() const;
operator int() const;

LOGIC OPERATIONS

OTC_TraceSwitch operator||(OTC_TraceSwitch const& theSwitch) const;
OTC_TraceSwitch operator&&(OTC_TraceSwitch const& theSwitch) const;
OTC_TraceSwitch operator!() const;

SEE ALSO

OTC_Tracer

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1993 TELSTRA CORPORATION LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED