#include <CNCL/CNCL.h>
None
None
CNObject
None
The CNCL
class contains only static members and functions for the
class library's parameters and error handling. All classes in the CNCL
hierarchy can directly access the static member functions, other code
can call them via CNCL::
func()
.
The class CNCL
provides common functionality for error handling.
This is used by all classes to issue an error message or warning and
terminate the program, if desired. The CNCL library also installs a
matherr()
handler using CNCL::error()
for displaying
an appropiate error message.
enum ErrorType { err_fatal, err_abort, err_warning, err_ignore, err_default, err_info };
The setting of the CNCL error handling:
err_abort
err_fatal
set_exit_handler()
.)
err_abort
is like err_fatal
but calls abort()
for
termination resulting in a core dump.
err_warning
err_ignore
err_ignore
err_default
err_fatal
(may be set with set_error()
).
The following member functions of CNCL
can be used to manipulate
the error handling.
static ErrorType get_error();
static ErrorType set_error(ErrorType err);
err
and returns the previous
value.
static void set_exit_handler(void (*func)());
exit()
(err_fatal
) or abort()
(err_abort
).
static void default_exit_handler()
The following member function can be used to output error messages
and/or terminate the program. Each of the functions accepts up to six
const char *
arguments, if the first one of these is NIL
,
then the default string ("CNCL error: "
, "CNCL warning: "
,
"CNCL: "
for err_error
/err_abort
,
err_warning
, err_info
, respectively) is prepended to the
output.
static void error(const char *msg1 = NIL, ...)
char *msg
`s can be added.
void error(ErrorType err, const char *msg1 = NIL, ...)
err
.Up to 6
different char *msg
`s can be added.
static void fatal(const char *msg1 = NIL, ...)
char *msg
`s can be added.
static void warning(const char *msg1 = NIL, ...)
char *msg
`s can be added.
static void info(const char *msg1 = NIL, ...)
char *msg
`s can be added.
static ostream& msg()
error()
, fatal()
, warning()
,
info()
message. This is actually a strstream
with a
maximum capacity of CNCL::STR_BUF_SIZE
.
Outside the CNCL
class the following constants and types are
defined:
NIL
0
.
TRUE
1
.
FALSE
0
.
bool
typedef int bool
.
Go to the first, previous, next, last section, table of contents.