OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
checks.h File Reference

Diagnostic macros for assertions and tracing. More...

#include <owl/private/defs.h>
#include <owl/exbase.h>
#include <owl/private/except.h>
#include <owl/private/strmdefs.h>
#include <owl/preclass.h>
#include <owl/posclass.h>

Go to the source code of this file.

Classes

struct  owl::TDiagBaseHook
 
class  owl::TDiagBase
 
class  owl::TDiagFunction
 
class  owl::TDiagException
 
class  owl::TPreconditionFailure
 
class  owl::TCheckFailure
 

Namespaces

namespace  owl
 Object Windows Library (OWLNext Core)
 

Macros

#define SERVICES_CHECKS_H
 
#define __DEBUG   0
 
#define IFDBG(a)
 
#define IFNDBG(a)   a
 
#define NDEBUG
 
#define VALIDPTR(p)   ((p) != 0)
 
#define VALIDORNULLPTR(p)   (!(p) || VALIDPTR(p))
 
#define PRECONDITION(condition)   PRECONDITIONX(condition, ::owl::TDiagException::ToString(#condition))
 
#define PRECONDITIONX(condition, message)   ((void)0)
 
#define CHECK(condition)   CHECKX(condition, ::owl::TDiagException::ToString(#condition))
 
#define CHECKX(condition, message)   ((void)0)
 
#define VERIFY(condition)   ((void)(condition))
 
#define VERIFYX(condition, message)   ((void)(condition))
 
#define TRACE(message)   TRACEX(Def, 0, message)
 
#define TRACE_FUNCTION(function)   TRACE_FUNCTIONX(Def, 0, function)
 
#define TRACE_FUNCTIONP(function, condition)   TRACE_FUNCTIONXP(Def, 0, function, condition)
 
#define TRACEX(group, level, message)   ((void)0)
 
#define TRACE_FUNCTIONX(group, level, function)   ((void)0)
 
#define TRACE_FUNCTIONXP(group, level, function, condition)   ((void)0)
 
#define WARN(condition, message)   WARNX(Def, condition, 0, message)
 
#define WARNX(group, condition, level, message)   ((void)0)
 
#define TRACEX_IF(condition, group, level, message)   WARNX(group, condition, level, message)
 
#define TRACE_IF(condition, message)   WARNX(Def, condition, 0, message)
 
#define DIAG_ASSERT_IMPL(assertion, condition, message)
 
#define DIAG_TRACE_IMPL(operation, group, condition, level, message)
 
#define DIAG_DECLARE_GROUP(group)
 
#define DIAG_DECLARE_EXPORTGROUP(group)
 
#define DIAG_DECLARE_IMPORTTGROUP(group)
 
#define DIAG_DEFINE_GROUP(group, enable, level)
 
#define OWL_DIAG_DEFINE_GROUP(group, enable, level)
 
#define DIAG_DEFINE_EXPORTGROUP(group, enable, level)
 
#define DIAG_ENABLE(group, s)   ((void)0)
 
#define DIAG_ISENABLED(group)   ((void)0)
 
#define DIAG_SETLEVEL(group, level)   ((void)0)
 
#define DIAG_GETLEVEL(group)   ((void)0)
 
#define DIAG_REDIRECT(group, s)   ((void)0)
 
#define IFDIAG(a)
 
#define IFNDIAG(a)   a
 
#define OWL_DIAG_DEFINE_GROUP_INIT(f, g, e, l)    OWL_DIAG_DEFINE_GROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));
 
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)    DIAG_DEFINE_GROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));
 
#define OWL_DIAG_DEFINE_EXPORTGROUP_INIT(f, g, e, l)    OWL_DIAG_DEFINE_EXPORTGROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));
 
#define DIAG_DEFINE_EXPORTGROUP_INIT(f, g, e, l)    DIAG_DEFINE_EXPORTGROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));
 

Typedefs

typedef tostringstream owl::diag_stream
 
typedef tstring owl::diag_string
 

Functions

bool owl::GetDiagEnabled (LPCSTR filename, LPCSTR diagGroup, bool defEnabled)
 Retrieves a diagnostic group's enabled flag from a private ini-file.
 
int owl::GetDiagLevel (LPCSTR filename, LPCSTR diagGroup, int defLevel)
 Retrieves a diagnostic group's level setting from a private ini-file.
 

Detailed Description

Diagnostic macros for assertions and tracing.

Note
The macros are controlled by the following switches:

__DEBUG = 0 PRECONDITION and CHECK are nops __DEBUG = 1 PRECONDITION is active __DEBUG = 2 PRECONDITION and CHECK are active __TRACE When defined enables TRACE __WARN When defined enables WARN

Definition in file checks.h.

Macro Definition Documentation

◆ __DEBUG

#define __DEBUG   0

Definition at line 204 of file checks.h.

◆ CHECK

Definition at line 239 of file checks.h.

◆ CHECKX

#define CHECKX ( condition,
message )   ((void)0)

Definition at line 245 of file checks.h.

◆ DIAG_ASSERT_IMPL

#define DIAG_ASSERT_IMPL ( assertion,
condition,
message )
Value:
if (!(condition)) {\
else if (retval == IDABORT)\
{throw ::owl::T##assertion##Failure(message, __FILE__, __LINE__);}\
}
#define OWL_BREAK
Definition borlandc.h:49
static int BreakMessage(LPCSTR type, const tstring &msg, LPCSTR file, int line)
Definition checks.cpp:373

Definition at line 289 of file checks.h.

◆ DIAG_DECLARE_EXPORTGROUP

#define DIAG_DECLARE_EXPORTGROUP ( group)

Definition at line 405 of file checks.h.

◆ DIAG_DECLARE_GROUP

#define DIAG_DECLARE_GROUP ( group)

Definition at line 404 of file checks.h.

◆ DIAG_DECLARE_IMPORTTGROUP

#define DIAG_DECLARE_IMPORTTGROUP ( group)

Definition at line 406 of file checks.h.

◆ DIAG_DEFINE_EXPORTGROUP

#define DIAG_DEFINE_EXPORTGROUP ( group,
enable,
level )

Definition at line 410 of file checks.h.

◆ DIAG_DEFINE_EXPORTGROUP_INIT

#define DIAG_DEFINE_EXPORTGROUP_INIT ( f,
g,
e,
l )    DIAG_DEFINE_EXPORTGROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));

Definition at line 435 of file checks.h.

◆ DIAG_DEFINE_GROUP

#define DIAG_DEFINE_GROUP ( group,
enable,
level )

Definition at line 408 of file checks.h.

◆ DIAG_DEFINE_GROUP_INIT

#define DIAG_DEFINE_GROUP_INIT ( f,
g,
e,
l )    DIAG_DEFINE_GROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));

Definition at line 429 of file checks.h.

◆ DIAG_ENABLE

#define DIAG_ENABLE ( group,
s )   ((void)0)

Definition at line 412 of file checks.h.

◆ DIAG_GETLEVEL

#define DIAG_GETLEVEL ( group)    ((void)0)

Definition at line 415 of file checks.h.

◆ DIAG_ISENABLED

#define DIAG_ISENABLED ( group)    ((void)0)

Definition at line 413 of file checks.h.

◆ DIAG_REDIRECT

#define DIAG_REDIRECT ( group,
s )   ((void)0)

Definition at line 416 of file checks.h.

◆ DIAG_SETLEVEL

#define DIAG_SETLEVEL ( group,
level )   ((void)0)

Definition at line 414 of file checks.h.

◆ DIAG_TRACE_IMPL

#define DIAG_TRACE_IMPL ( operation,
group,
condition,
level,
message )
Value:
do {\
using namespace ::owl;\
if (__OwlDiagGroup##group.IsEnabled() && level <= __OwlDiagGroup##group.GetLevel() && (condition)) {\
tostringstream out; out << message;\
__OwlDiagGroup##group.operation(out.str(), level, __FILE__, __LINE__);\
}\
} while (false)
Object Windows Library (OWLNext Core)
Definition animctrl.h:22

Definition at line 301 of file checks.h.

◆ IFDBG

#define IFDBG ( a)

Definition at line 208 of file checks.h.

◆ IFDIAG

#define IFDIAG ( a)

Definition at line 418 of file checks.h.

◆ IFNDBG

#define IFNDBG ( a)    a

Definition at line 209 of file checks.h.

◆ IFNDIAG

#define IFNDIAG ( a)    a

Definition at line 419 of file checks.h.

◆ NDEBUG

#define NDEBUG

Definition at line 211 of file checks.h.

◆ OWL_DIAG_DEFINE_EXPORTGROUP_INIT

#define OWL_DIAG_DEFINE_EXPORTGROUP_INIT ( f,
g,
e,
l )    OWL_DIAG_DEFINE_EXPORTGROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));

Definition at line 432 of file checks.h.

◆ OWL_DIAG_DEFINE_GROUP

#define OWL_DIAG_DEFINE_GROUP ( group,
enable,
level )

Definition at line 409 of file checks.h.

◆ OWL_DIAG_DEFINE_GROUP_INIT

#define OWL_DIAG_DEFINE_GROUP_INIT ( f,
g,
e,
l )    OWL_DIAG_DEFINE_GROUP(g, ::owl::GetDiagEnabled(f,#g,e), ::owl::GetDiagLevel(f,#g,l));

Definition at line 426 of file checks.h.

◆ PRECONDITION

Definition at line 227 of file checks.h.

◆ PRECONDITIONX

#define PRECONDITIONX ( condition,
message )   ((void)0)

Definition at line 231 of file checks.h.

◆ SERVICES_CHECKS_H

#define SERVICES_CHECKS_H

Definition at line 19 of file checks.h.

◆ TRACE

#define TRACE ( message)    TRACEX(Def, 0, message)

Definition at line 255 of file checks.h.

◆ TRACE_FUNCTION

#define TRACE_FUNCTION ( function)    TRACE_FUNCTIONX(Def, 0, function)

Definition at line 256 of file checks.h.

◆ TRACE_FUNCTIONP

#define TRACE_FUNCTIONP ( function,
condition )   TRACE_FUNCTIONXP(Def, 0, function, condition)

Definition at line 257 of file checks.h.

◆ TRACE_FUNCTIONX

#define TRACE_FUNCTIONX ( group,
level,
function )   ((void)0)

Definition at line 264 of file checks.h.

◆ TRACE_FUNCTIONXP

#define TRACE_FUNCTIONXP ( group,
level,
function,
condition )   ((void)0)

Definition at line 265 of file checks.h.

◆ TRACE_IF

#define TRACE_IF ( condition,
message )   WARNX(Def, condition, 0, message)

Definition at line 284 of file checks.h.

◆ TRACEX

#define TRACEX ( group,
level,
message )   ((void)0)

Definition at line 263 of file checks.h.

◆ TRACEX_IF

Definition at line 283 of file checks.h.

◆ VALIDORNULLPTR

#define VALIDORNULLPTR ( p)    (!(p) || VALIDPTR(p))

Definition at line 220 of file checks.h.

◆ VALIDPTR

#define VALIDPTR ( p)    ((p) != 0)

Definition at line 213 of file checks.h.

◆ VERIFY

#define VERIFY ( condition)    ((void)(condition))

Definition at line 246 of file checks.h.

◆ VERIFYX

#define VERIFYX ( condition,
message )   ((void)(condition))

Definition at line 247 of file checks.h.

◆ WARN

#define WARN ( condition,
message )   WARNX(Def, condition, 0, message)

Definition at line 273 of file checks.h.

◆ WARNX

#define WARNX ( group,
condition,
level,
message )   ((void)0)

Definition at line 277 of file checks.h.