Management of different macros for logs, assertions etc. More...
Namespaces | |
| namespace | Util |
a set of useful element for debugging typically | |
Defines | |
| #define | LIBGEP_XVALTOSTR(msg) #msg |
| Helper for macro LIBGEP_VALTOSTR. | |
| #define | LIBGEP_VALTOSTR(msg) LIBGEP_XVALTOSTR(msg) |
| Macro to convert value to a string. | |
| #define | LIBGEP_LOCINFO __FILE__ "(" LIBGEP_VALTOSTR(__LINE__) ")" |
| Prepend file name and line number. | |
| #define | LIBGEP_OSTREAM_FUNCTION_INFO "[" << LIBGEP_LOCINFO << ":" << __FUNCTION__ << "] " |
| Prepend file name with line number and function name inside brackets on a stream. | |
| #define | LIBGEP_SUFX "\t in " LIBGEP_LOCINFO |
| #define | LIBGEP_SUFX_M(msg) msg LIBGEP_SUFX |
| Append file name and line number to the argument string. | |
| #define | LIBGEP_ASSERT_M(cond, msg) |
| Assertion which display message before throwing Util::RuntimeError() if cond is failed. | |
| #define | LIBGEP_ASSERT(cond) |
| Assertion which throw Util::RuntimeError() if cond is failed. | |
| #define | LIBGEP_DO_ON_DEBUG(expr) |
| execute expr only if the DEBUG macro is activated | |
| #define | LIBGEP_DEBUG(msg) |
| print msg only if the DEBUG macro is activated. msg can be written in "stream" format i.e you can write | |
Functions | |
| std::ostream & | Util::log () |
| std::ostream & | Util::verbose (const short verboselevel) |
| std::ostream & | Util::error () |
Management of different macros for logs, assertions etc.
Copyright (c) 2008 Marek Ostaszewski, Sebastien Varrette (see COPYING)
| #define LIBGEP_ASSERT | ( | cond | ) |
if (!(cond)) { \ Util::error() << LIBGEP_OSTREAM_FUNCTION_INFO << "Assertion (" << LIBGEP_VALTOSTR(cond) << ") failed!\n"; \ throw std::runtime_error(""); \ }
Assertion which throw Util::RuntimeError() if cond is failed.
| #define LIBGEP_ASSERT_M | ( | cond, | |||
| msg | ) |
if (!(cond)) { \ Util::error() << LIBGEP_OSTREAM_FUNCTION_INFO << "Assertion (" << LIBGEP_VALTOSTR(cond) << ") failed! : " << msg << ::std::endl; \ throw std::runtime_error(""); \ }
Assertion which display message before throwing Util::RuntimeError() if cond is failed.
| #define LIBGEP_DEBUG | ( | msg | ) |
print msg only if the DEBUG macro is activated. msg can be written in "stream" format i.e you can write
LIBGEP_DEBUG("an " << object << "is put in a stream");
| #define LIBGEP_DO_ON_DEBUG | ( | expr | ) |
execute expr only if the DEBUG macro is activated
| #define LIBGEP_LOCINFO __FILE__ "(" LIBGEP_VALTOSTR(__LINE__) ")" |
Prepend file name and line number.
| #define LIBGEP_OSTREAM_FUNCTION_INFO "[" << LIBGEP_LOCINFO << ":" << __FUNCTION__ << "] " |
Prepend file name with line number and function name inside brackets on a stream.
| #define LIBGEP_SUFX "\t in " LIBGEP_LOCINFO |
| #define LIBGEP_SUFX_M | ( | msg | ) | msg LIBGEP_SUFX |
Append file name and line number to the argument string.
| #define LIBGEP_VALTOSTR | ( | msg | ) | LIBGEP_XVALTOSTR(msg) |
Macro to convert value to a string.
| #define LIBGEP_XVALTOSTR | ( | msg | ) | #msg |
Helper for macro LIBGEP_VALTOSTR.
1.6.1