Error reporting, Exceptions and Asserted invariants.
There are several macros which you can use for checking invariants
in your program, much like 'assert(...)' in 'C'. They are
defined in 'Ravl/Assert.hh'.
#include "Ravl/Assert.hh"
The two main macros are :
RavlAssert(..condition..);
which will stop the program if 'condition' is false. The is also
RavlAssertMsg(..condition..,..msg..);
which allows an extra message to the assertion to help developers track
down problems in their code. Asserts are NOT checked in optimised code they
are re-defined to empty statements. If you want to assert a condition in
all compile modes use the RavlAlwaysAssert and RavlAlwaysAssertMsg macro's
shown below.
RavlAlwaysAssert(..condition..);
RavlAlwaysAssertMsg(..condition..,..msg..);
Normal classes:
Normal functions:
AssertThrowException(void) | Test if an exception on an assertion failure. |
SetAssertThrowException(bool) | Throw an exception on an assertion failure. |
AssertFailed(char *,int) | Called if assertion failed. |
AssertFailed(char *,int,char *) | Called if assertion failed, with message. |
IssueError(char *,int,char *,...) | Call when program encounters an error. |
IssueWarning(char *,int,char *,...) | Call when program encounters an a unexpected occurance. |