Exceptions
The same group on the Doxygen site.
- group Exceptions
Exceptions defined in LEMON.
This group contains the exceptions defined in LEMON.
Classes
Class |
Description |
|---|---|
Generic exception class. |
|
Input-Output error. |
|
Format error. |
Functions and other members
-
LEMON_ASSERT(exp, msg)
Macro for assertion with customizable message.
The assertions are enabled in the default behaviour. You can disable them with the following code:
or with compilation parameters:#define LEMON_DISABLE_ASSERTSThe checking is also disabled when the standard macrog++ -DLEMON_DISABLE_ASSERTS make CXXFLAGS='-DLEMON_DISABLE_ASSERTS'
NDEBUGis defined.As a default behaviour the failed assertion prints a short log message to the standard error and aborts the execution.
However, the following modes can be used in the assertion system:
LEMON_ASSERT_ABORTThe failed assertion prints a short log message to the standard error and aborts the program. It is the default behaviour.LEMON_ASSERT_CUSTOMThe user can define own assertion handler function.The name of the function should be defined as thevoid custom_assert_handler(const char* file, int line, const char* function, const char* message, const char* assertion);
LEMON_CUSTOM_ASSERT_HANDLERmacro name.Whenever an assertion is occured, the custom assertion handler is called with appropiate parameters.#define LEMON_CUSTOM_ASSERT_HANDLER custom_assert_handler
The assertion mode can also be changed within one compilation unit. If the macros are redefined with other settings and the assert.h file is reincluded, then the behaviour is changed appropiately to the new settings.
- Parameters:
exp – An expression that must be convertible to
bool. If it isfalse, then an assertion is raised. The concrete behaviour depends on the settings of the assertion system.msg – A
const char*parameter, which can be used to provide information about the circumstances of the failed assertion.
-
LEMON_DEBUG(exp, msg)
Macro for internal assertions.
Macro for internal assertions, it is used in the library to check the consistency of results of algorithms, several pre- and postconditions and invariants. The checking is disabled by default, but it can be turned on with the macro
LEMON_ENABLE_DEBUG.or with compilation parameters:#define LEMON_ENABLE_DEBUGg++ -DLEMON_ENABLE_DEBUG make CXXFLAGS='-DLEMON_ENABLE_DEBUG'
This macro works like the
LEMON_ASSERTmacro, therefore the current behaviour depends on the settings ofLEMON_ASSERTmacro.See also