NAME

OTC_TraceTag - A named trace switch.

SYNOPSIS


#include <OTC/debug/tracetag.hh>

class OTC_TraceTag : public OTC_TraceSwitch
{
  public:
    inline ~OTC_TraceTag();
    OTC_TraceTag(char const* theName);
    OTC_Boolean enabled() const;
    inline int level() const;
    inline char const* name() const;
    static int set(char const* theName, int theLevel=0);
    inline static OTC_TagInfo* switches();
    OTC_TraceSwitch operator==(int theLevel) const;
    OTC_TraceSwitch operator!=(int theLevel) const;
    OTC_TraceSwitch operator<(int theLevel) const;
    OTC_TraceSwitch operator<=(int theLevel) const;
    OTC_TraceSwitch operator>(int theLevel) const;
    OTC_TraceSwitch operator>=(int theLevel) const;
};

CLASS TYPE

Concrete

DESCRIPTION

The class OTC_TraceTag is a named version of a trace switch. The name allows the status of the switch to be set through either an environment variable, or program control. In addition, a trace level may be associated with the named switch, when used in conjunction with the comparison and logic operators, the trace level allows expressions to be used to determine if trace output should be generated for a particular statement. For example: The status of a named switch can be set using the environment variable OTCLIB_TRACETAGS. When set, the environment variable should contain a list of the named switches which should be enabled. You may optionally include an assignment in the list to set the trace level of a switch to a defined value. If you do not set the trace level of a switch, it will default to 0. If multiple trace tag names are listed they should be separated by a single space. Macros are provided to allow you to create named switches. Code for these macros will be compiled into your code, only if the preprocessor symbol OTCLIB_TRACE is defined. These macros are OTCLIB_TRACETAG, OTCLIB_STATIC_TRACETAG and OTCLIB_SETRACETAG. The macro OTCLIB_STATIC_TRACEPATTERN creates an instance of the class which has static extent. OTCLIB_SETTRACETAG is provided to allow you to set the trace level of a switch in your program. Setting the trace level of a switch, will result in all switches of that name in your program being updated.

INITIALISATION

OTC_TraceTag(char const* theName);

QUERY/CHANGE

OTC_Boolean enabled() const;
inline int level() const;
inline char const* name() const;
static int set(char const* theName, int theLevel=0);
inline static OTC_TagInfo* switches();

COMPARISON OPERATORS

OTC_TraceSwitch operator==(int theLevel) const;
OTC_TraceSwitch operator!=(int theLevel) const;
OTC_TraceSwitch operator<(int theLevel) const;
OTC_TraceSwitch operator<=(int theLevel) const;
OTC_TraceSwitch operator>(int theLevel) const;
OTC_TraceSwitch operator>=(int theLevel) const;

SEE ALSO

OTC_TraceSwitch, OTC_TagInfo

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

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