#include <iostream>
#include <sstream>
#include <string>
#include "rcutils/snprintf.h"
#include "rmw/allocators.h"
#include "rmw/error_handling.h"
#include "rmw/impl/config.h"
#include "rmw/impl/cpp/demangle.hpp"
Go to the source code of this file.
|
#define | RMW_TRY_PLACEMENT_NEW(Destination, BufferForNew, FailureAction, Type, ...) |
|
#define | RMW_TRY_DESTRUCTOR(Statement, Type, FailureAction) |
|
#define | RMW_TRY_DESTRUCTOR_FROM_WITHIN_FAILURE(Statement, Type) |
|
#define | RMW_CHECK_TYPE_IDENTIFIERS_MATCH(ElementName, ElementTypeID, ExpectedTypeID, OnFailure) |
|
◆ RMW_TRY_PLACEMENT_NEW
#define RMW_TRY_PLACEMENT_NEW |
( |
|
Destination, |
|
|
|
BufferForNew, |
|
|
|
FailureAction, |
|
|
|
Type, |
|
|
|
... |
|
) |
| |
Value: try { \
Destination = new(BufferForNew) Type(__VA_ARGS__); \
RMW_SET_ERROR_MSG( \
( \
" constructing " #Type
": " + exception.
what() \
).c_str()); \
FailureAction; \
} catch (...) { \
RMW_SET_ERROR_MSG("caught unknown C++ exception constructing " #Type); \
FailureAction; \
}
◆ RMW_TRY_DESTRUCTOR
#define RMW_TRY_DESTRUCTOR |
( |
|
Statement, |
|
|
|
Type, |
|
|
|
FailureAction |
|
) |
| |
Value: try { \
Statement; \
RMW_SET_ERROR_MSG( \
( \
std::string(
"caught C++ exception in destructor of " #Type
": ") + \
).c_str()); \
FailureAction; \
} catch (...) { \
RMW_SET_ERROR_MSG("caught unknown C++ exception in destructor of " #Type); \
FailureAction; \
}
◆ RMW_TRY_DESTRUCTOR_FROM_WITHIN_FAILURE
#define RMW_TRY_DESTRUCTOR_FROM_WITHIN_FAILURE |
( |
|
Statement, |
|
|
|
Type |
|
) |
| |
Value: try { \
Statement; \
std::stringstream ss; \
ss << "caught C++ exception in destructor of " #Type " while handling a failure: " \
<< ", at: " << __FILE__ << ":" << __LINE__ << '\n'; \
} catch (...) { \
std::stringstream ss; \
ss << "caught unknown C++ exception in destructor of " #Type << \
" while handling a failure at: " << __FILE__ << ":" << __LINE__ << '\n'; \
}
◆ RMW_CHECK_TYPE_IDENTIFIERS_MATCH
#define RMW_CHECK_TYPE_IDENTIFIERS_MATCH |
( |
|
ElementName, |
|
|
|
ElementTypeID, |
|
|
|
ExpectedTypeID, |
|
|
|
OnFailure |
|
) |
| |
std::string demangle(const T &instance)
Return the demangle name of the instance of type T.
Definition: demangle.hpp:39