580 /// \brief Macro for assertions with customizable message |
580 /// \brief Macro for assertions with customizable message |
581 /// |
581 /// |
582 /// Macro for assertions with customizable message. |
582 /// Macro for assertions with customizable message. |
583 /// |
583 /// |
584 /// The assertions are disabled in the default behaviour. You can |
584 /// The assertions are disabled in the default behaviour. You can |
585 /// enable the assertions with the LEMON_ENABLE_ASSERTS macro what |
585 /// enable the assertions with the |
|
586 /// \code |
|
587 /// #define LEMON_ENABLE_ASSERTS |
|
588 /// \endcode |
|
589 /// Then an assert |
586 /// provides a log on the standard error about the assertion and aborts |
590 /// provides a log on the standard error about the assertion and aborts |
587 /// the program. If the LEMON_ASSERT_DO_ABORT macro is setted to false |
591 /// the program if LEMON_ASSERT_DO_ABORT is also defined (otherwise the |
588 /// then the just the log message can be seen on the standard error but |
592 /// program keeps on running). |
589 /// the program is not stopped. With the LEMON_ASSERT_FAILURE and |
593 /// By defining LEMON_ASSERT_FAILURE or |
590 /// LEMON_ASSERT_EXCEPTION macros you can set other behaviour to the |
594 /// LEMON_ASSERT_EXCEPTION, you can set other behaviour to the |
591 /// assertions. The LEMON_ASSERT_FAILURE will always throw an \c |
595 /// assertions. In case LEMON_ASSERT_FAILURE is given, LEMON_ASSERT |
592 /// AssertionFailedError exception with the \c msg error message. The |
596 /// will always throw an \c AssertionFailedError exception with |
593 /// \c LEMON_ASSERT_EXCEPTION can throw a user defined exception. |
597 /// the \c msg error message. By using |
|
598 /// LEMON_ASSERT_EXCEPTION, one can define an arbitrary exception to be thrown. |
594 /// |
599 /// |
595 /// The LEMON_ASSERT macro should be called with the \c exp parameter |
600 /// The LEMON_ASSERT macro should be called with the \c exp parameter |
596 /// which should be an expression convertible to bool. If the given |
601 /// which should be an expression convertible to bool. If the given |
597 /// parameter is false the assertion is raised and one of the assertion |
602 /// parameter is false the assertion is raised and one of the assertion |
598 /// behaviour will be activated. The \c msg should be either a const |
603 /// behaviour will be activated. The \c msg should be either a const |
599 /// char* message or an exception. When the \c msg is an exception the |
604 /// char* message or an exception. When the \c msg is an exception the |
600 /// \ref "Exception::what" what() function is called to retrieve and |
605 /// \ref "Exception::what" what() function is called to retrieve and |
601 /// display the error message. |
606 /// display the error message. |
602 /// |
|
603 /// |
607 /// |
604 /// \todo We should provide some way to reset to the default behaviour, |
608 /// \todo We should provide some way to reset to the default behaviour, |
605 /// shouldn't we? |
609 /// shouldn't we? |
606 /// |
610 /// |
607 /// \todo This whole 'assert' business should be placed in a separate |
611 /// \todo This whole 'assert' business should be placed in a separate |