error.h File Reference


Detailed Description

#include <exception>
#include <string>
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <memory>


Classes

class  ExceptionMember< _Type >
 Exception safe wrapper class. More...
class  ErrorMessage
 Exception-safe convenient "error message" class. More...
class  Exception
 Generic exception class. More...
class  LogicError
 One of the two main subclasses of Exception. More...
class  UninitializedParameter
 Exception for uninitialized parameters. More...
class  RuntimeError
 One of the two main subclasses of Exception. More...
class  RangeError
  More...
class  IoError
  More...
class  DataFormatError
  More...
class  FileOpenError
  More...
class  AssertionFailedError
  More...

Namespaces

namespace  lemon
 The namespace of LEMON.

Defines

#define LEMON_ASSERT(exp, msg)
 Macro for assertions with customizable message.
#define LEMON_FIXME(msg)
 Macro for mark not yet implemented features.

Define Documentation

#define LEMON_ASSERT ( exp,
msg   ) 

Value:

(static_cast<void> (!!(exp) ? 0 : (         \
       LEMON_ASSERT_HANDLER(__FILE__, __LINE__,  \
                            __PRETTY_FUNCTION__, \
                            msg, #exp, LEMON_ASSERT_DO_ABORT), 0)))
Macro for assertions with customizable message.

The assertions are disabled in the default behaviour. You can enable the assertions with the

 #define LEMON_ENABLE_ASSERTS
Then an assert provides a log on the standard error about the assertion and aborts the program if LEMON_ASSERT_DO_ABORT is also defined (otherwise the program keeps on running). By defining LEMON_ASSERT_FAILURE or LEMON_ASSERT_EXCEPTION, you can set other behaviour to the assertions. In case LEMON_ASSERT_FAILURE is given, LEMON_ASSERT will always throw an AssertionFailedError exception with the msg error message. By using LEMON_ASSERT_EXCEPTION, one can define an arbitrary exception to be thrown.

The LEMON_ASSERT macro should be called with the exp parameter which should be an expression convertible to bool. If the given parameter is false the assertion is raised and one of the assertion behaviour will be activated. The msg should be either a const char* message or an exception. When the msg is an exception the what() function is called to retrieve and display the error message.

Todo:
We should provide some way to reset to the default behaviour, shouldn't we?
Todo:
This whole 'assert' business should be placed in a separate include file. The boost assert is not guarded by header sentries which may help to change the behaviour of the assertions in the files.
Todo:
__PRETTY_FUNCTION__ should be replaced by something compiler-independent, like BOOST_CURRENT_FUNCTION

#define LEMON_FIXME ( msg   ) 

Value:

(LEMON_ASSERT_HANDLER(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
                          "FIXME: " msg))
Todo:
Is this the right place for this? It should be used only in modules under development.
Todo:
__PRETTY_FUNCTION__ should be replaced by something compiler-independent, like BOOST_CURRENT_FUNCTION


Generated on Thu Jun 4 04:03:10 2009 for LEMON by  doxygen 1.5.9