RobWorkProject
23.9.11-
|
#include <rw/core/Exception.hpp>
#include <rw/core/IOUtil.hpp>
#include <rw/core/Log.hpp>
#include <rw/core/Message.hpp>
#include <iostream>
#include <sstream>
Macros | |
#define | RW_THROW(ostreamExpression) |
Throw an exception with message ostreamExpression. More... | |
#define | RW_THROW2(id, ostreamExpression) |
Throw an exception with the specified id and message ostreamExpression. More... | |
#define | RW_WARN(ostreamExpression) |
Emit a warning. More... | |
#define | RW_DEBUG(ostreamExpression) |
Emit debug message. More... | |
#define | RW_ASSERT_IMPL(e, ostreamExpression, file, line) |
For internal use only. More... | |
#define | RW_ASSERT(e) RW_ASSERT_IMPL(e, std::string(#e), __FILE__, __LINE__) |
RobWork assertions. More... | |
#define | RW_ASSERT_MSG(e, msg) RW_ASSERT_IMPL(e, msg, __FILE__, __LINE__) |
RobWork assertions with user-friendly messages. More... | |
#define | RW_LOG(id, ostreamExpression) do { rw::core::Log::log().get(id) << ostreamExpression << std::endl; } while(0) |
Writes ostreamExpression to log with LogIndex id. More... | |
#define | RW_LOG_ERROR(ostreamExpression) RW_LOG(rw::core::Log::Error, ostreamExpression) |
Writes ostreamExpression to error log. More... | |
#define | RW_LOG_WARNING(ostreamExpression) RW_LOG(rw::core::Log::Warning, ostreamExpression) |
Writes ostreamExpression to warning log. More... | |
#define | RW_LOG_DEBUG(ostreamExpression) RW_LOG(rw::core::Log::Debug, ostreamExpression) |
Writes ostreamExpression to debug log. More... | |
#define | RW_LOG_INFO(ostreamExpression) RW_LOG(rw::core::Log::Info, ostreamExpression) |
Writes ostreamExpression to info log. More... | |
#define | RW_MSG(ostreamExpression) (Message(__FILE__, __LINE__) << ostreamExpression) |
Convenient convertion of a string expression into a Message. More... | |
#define | PRINT_HERE std::cout << __FILE__ << ":" << __LINE__ << std::endl << std::flush; |
#define | FALLTHROUGH |
Used to indicate that the fall through of a switch cas to another is intentional and not because you forgot to add break. | |
#define | DEPRECATED(text) |
a way to mark code for deprecation More... | |
#define | USE_ROBWORK_NAMESPACE |
enables the use of a robwork namespace | |
#define DEPRECATED | ( | text | ) |
a way to mark code for deprecation
text | the message to print |
#define RW_ASSERT | ( | e | ) | RW_ASSERT_IMPL(e, std::string(#e), __FILE__, __LINE__) |
RobWork assertions.
RW_ASSERT() is an assertion macro in the style of assert(). RW_ASSERT() can be enabled by compiling with RW_ENABLE_ASSERT defined. Otherwise RW_ASSERT() is enabled if NDBUG is not defined.
You should prefer RW_ASSERT() to assert() everywhere with a possible exception being (unsafe) access of arrays and a few other places where you are sure that a run time sanity check will be a performance issue.
#define RW_ASSERT_IMPL | ( | e, | |
ostreamExpression, | |||
file, | |||
line | |||
) |
For internal use only.
#define RW_ASSERT_MSG | ( | e, | |
msg | |||
) | RW_ASSERT_IMPL(e, msg, __FILE__, __LINE__) |
RobWork assertions with user-friendly messages.
RW_ASSERT_MSG() is an assertion macro similar to RW_ASSERT(). RW_ASSERT_MSG() can be enabled by compiling with RW_ENABLE_ASSERT defined. Otherwise RW_ASSERT_MSG() is enabled if NDBUG is not defined.
RW_ASSERT_MSG() takes one additional argument, allowing printing user-friendly error message if assertion fails.
#define RW_DEBUG | ( | ostreamExpression | ) |
Emit debug message.
ostreamExpression is an expression that is fed to an output stream. Example:
Debug messages can be intercepted via debugLog().
#define RW_LOG | ( | id, | |
ostreamExpression | |||
) | do { rw::core::Log::log().get(id) << ostreamExpression << std::endl; } while(0) |
Writes ostreamExpression to log with LogIndex id.
id be the log level of type rw::core::Log::LogIndex.
ostreamExpression is an expression that is fed to an output stream.
Example:
id | [in] log level to write to. |
ostreamExpression | [in] Stream expression which should be written to the log |
#define RW_LOG_DEBUG | ( | ostreamExpression | ) | RW_LOG(rw::core::Log::Debug, ostreamExpression) |
Writes ostreamExpression to debug log.
ostreamExpression | [in] Stream expression which should be written to the log |
#define RW_LOG_ERROR | ( | ostreamExpression | ) | RW_LOG(rw::core::Log::Error, ostreamExpression) |
Writes ostreamExpression to error log.
ostreamExpression | [in] Stream expression which should be written to the log |
#define RW_LOG_INFO | ( | ostreamExpression | ) | RW_LOG(rw::core::Log::Info, ostreamExpression) |
Writes ostreamExpression to info log.
ostreamExpression | [in] Stream expression which should be written to the log |
#define RW_LOG_WARNING | ( | ostreamExpression | ) | RW_LOG(rw::core::Log::Warning, ostreamExpression) |
Writes ostreamExpression to warning log.
ostreamExpression | [in] Stream expression which should be written to the log |
#define RW_MSG | ( | ostreamExpression | ) | (Message(__FILE__, __LINE__) << ostreamExpression) |
Convenient convertion of a string expression into a Message.
ostreamExpression | [in] stream expression which should be converted to a Message. |
#define RW_THROW | ( | ostreamExpression | ) |
Throw an exception with message ostreamExpression.
ostreamExpression is an expression that is fed to an output stream. Example:
Exception messages can be intercepted via exceptionLog().
#define RW_THROW2 | ( | id, | |
ostreamExpression | |||
) |
Throw an exception with the specified id and message ostreamExpression.
id is the id of the exception and * ostreamExpression is an expression that is fed to an output stream. Example:
Exception data can be intercepted via exceptionLog().
#define RW_WARN | ( | ostreamExpression | ) |
Emit a warning.
ostreamExpression is an expression that is fed to an output stream. Example:
Warning messages can be intercepted via warningLog().