Go to the documentation of this file.
5 #ifndef __pinocchio_macros_hpp__
6 #define __pinocchio_macros_hpp__
14 #if (__cplusplus >= 202002L)
15 #define PINOCCHIO_WITH_CXX20_SUPPORT
18 #if (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703))
19 #define PINOCCHIO_WITH_CXX17_SUPPORT
22 #if (__cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201403))
23 #define PINOCCHIO_WITH_CXX14_SUPPORT
26 #if (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
27 #define PINOCCHIO_WITH_CXX11_SUPPORT
30 #define PINOCCHIO_STRING_LITERAL(string) #string
34 #if defined(__GNUC__) || defined(__clang__)
35 #define PINOCCHIO_PRAGMA(x) _Pragma(#x)
36 #define PINOCCHIO_PRAGMA_MESSAGE(the_message) PINOCCHIO_PRAGMA(GCC message #the_message)
37 #define PINOCCHIO_PRAGMA_WARNING(the_message) PINOCCHIO_PRAGMA(GCC warning #the_message)
38 #define PINOCCHIO_PRAGMA_DEPRECATED(the_message) \
39 PINOCCHIO_PRAGMA_WARNING(Deprecated : #the_message)
40 #define PINOCCHIO_PRAGMA_DEPRECATED_HEADER(old_header, new_header) \
41 PINOCCHIO_PRAGMA_WARNING(Deprecated header file : #old_header has been replaced \
42 by #new_header.\n Please use #new_header instead of #old_header.)
44 #define PINOCCHIO_PRAGMA(x)
45 #define PINOCCHIO_PRAGMA_MESSAGE(the_message)
46 #define PINOCCHIO_PRAGMA_WARNING(the_message)
47 #define PINOCCHIO_PRAGMA_DEPRECATED(the_message)
48 #define PINOCCHIO_PRAGMA_DEPRECATED_HEADER(old_header, new_header)
52 #define PINOCCHIO_NOT_A_MACRO
60 template<
typename T,
typename U>
69 #define PINOCCHIO_MACRO_EMPTY_ARG
72 #define PINOCCHIO_UNUSED_VARIABLE(var) (void)(var)
75 #define PINOCCHIO_ASSERT_MATRIX_SPECIFIC_SIZE(type, M, nrows, ncols) \
76 EIGEN_STATIC_ASSERT( \
77 (type::RowsAtCompileTime == Eigen::Dynamic || type::RowsAtCompileTime == nrows) \
78 && (type::ColsAtCompileTime == Eigen::Dynamic || type::ColsAtCompileTime == ncols), \
79 THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); \
80 assert(M.rows() == nrows && M.cols() == ncols);
85 #define PINOCCHIO_STATIC_ASSERT(condition, msg) \
87 int msg[(condition) ? 1 : -1]; \
95 template<
typename D,
template<
typename>
class TypeAccess>
104 #if defined(__GNUC__) || defined(__clang__)
105 #define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
106 #define PINOCCHIO_COMPILER_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
107 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS \
108 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
109 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_VARIADIC_MACROS \
110 _Pragma("GCC diagnostic ignored \"-Wvariadic-macros\"")
111 #if defined(__clang__)
112 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
113 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_SELF_ASSIGN_OVERLOADED \
114 _Pragma("GCC diagnostic ignored \"-Wself-assign-overloaded\"")
116 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED \
117 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
118 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_SELF_ASSIGN_OVERLOADED
121 #define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH _Pragma("warning(push)")
122 #define PINOCCHIO_COMPILER_DIAGNOSTIC_POP _Pragma("warning(pop)")
123 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS \
124 _Pragma("warning(disable : 4996)")
125 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_VARIADIC_MACROS
126 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_SELF_ASSIGN_OVERLOADED
127 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
129 #define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
130 #define PINOCCHIO_COMPILER_DIAGNOSTIC_POP
131 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
132 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_VARIADIC_MACROS
133 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_SELF_ASSIGN_OVERLOADED
134 #define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
135 #endif // __GNUC__ || __clang__
142 #if defined(__GNUC__)
143 #pragma GCC system_header
150 #define PINOCCHIO_PRETTY_FUNCTION __FUNCSIG__
152 #define PINOCCHIO_PRETTY_FUNCTION __PRETTY_FUNCTION__
157 #if !defined(PINOCCHIO_NO_THROW)
158 #define PINOCCHIO_THROW(condition, exception_type, message) \
161 throw exception_type(message); \
164 #define PINOCCHIO_THROW_PRETTY(exception, message) \
166 std::stringstream ss; \
167 ss << "From file: " << __FILE__ << "\n"; \
168 ss << "in function: " << PINOCCHIO_PRETTY_FUNCTION << "\n"; \
169 ss << "at line: " << __LINE__ << "\n"; \
170 ss << "message: " << message << "\n"; \
171 throw exception(ss.str()); \
174 #define PINOCCHIO_THROW(condition, exception_type, message)
175 #define PINOCCHIO_THROW_PRETTY(exception, message)
178 #define _PINOCCHIO_EXPAND(x) x
179 #define _PINOCCHIO_GET_OVERRIDE_FOR_CHECK_INPUT_ARGUMENT(_1, _2, MACRO_NAME, ...) MACRO_NAME
181 #define _PINOCCHIO_CHECK_INPUT_ARGUMENT_2(condition, message) \
182 PINOCCHIO_THROW(condition, std::invalid_argument, message)
184 #define _PINOCCHIO_CHECK_INPUT_ARGUMENT_1(condition) \
185 _PINOCCHIO_CHECK_INPUT_ARGUMENT_2( \
186 condition, "The following check on the input argument has failed: " #condition)
188 #define _PINOCCHIO_CHECK_INPUT_ARGUMENT_0
192 #define PINOCCHIO_CHECK_INPUT_ARGUMENT(...) \
193 _PINOCCHIO_EXPAND(_PINOCCHIO_EXPAND(_PINOCCHIO_GET_OVERRIDE_FOR_CHECK_INPUT_ARGUMENT( \
194 __VA_ARGS__, _PINOCCHIO_CHECK_INPUT_ARGUMENT_2, _PINOCCHIO_CHECK_INPUT_ARGUMENT_1, \
195 _PINOCCHIO_CHECK_INPUT_ARGUMENT_0))(__VA_ARGS__))
197 #define _PINOCCHIO_GET_OVERRIDE_FOR_CHECK_ARGUMENT_SIZE(_1, _2, _3, MACRO_NAME, ...) MACRO_NAME
199 #define _PINOCCHIO_CHECK_ARGUMENT_SIZE_3(size, expected_size, message) \
200 if (size != expected_size) \
202 std::ostringstream oss; \
203 oss << "wrong argument size: expected " << expected_size << ", got " << size << std::endl; \
204 oss << "hint: " << message << std::endl; \
205 PINOCCHIO_THROW(false, std::invalid_argument, oss.str()); \
208 #define _PINOCCHIO_CHECK_ARGUMENT_SIZE_2(size, expected_size) \
209 _PINOCCHIO_CHECK_ARGUMENT_SIZE_3( \
210 size, expected_size, \
211 PINOCCHIO_STRING_LITERAL(size) " is different from " PINOCCHIO_STRING_LITERAL(expected_size))
213 #define _PINOCCHIO_CHECK_ARGUMENT_SIZE_1
216 #define PINOCCHIO_CHECK_ARGUMENT_SIZE(...) \
217 _PINOCCHIO_EXPAND(_PINOCCHIO_EXPAND(_PINOCCHIO_GET_OVERRIDE_FOR_CHECK_ARGUMENT_SIZE( \
218 __VA_ARGS__, _PINOCCHIO_CHECK_ARGUMENT_SIZE_3, _PINOCCHIO_CHECK_ARGUMENT_SIZE_2, \
219 _PINOCCHIO_CHECK_ARGUMENT_SIZE_1))(__VA_ARGS__))
223 #endif // ifndef __pinocchio_macros_hpp__
#define PINOCCHIO_COMPILER_DIAGNOSTIC_POP
#define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_VARIADIC_MACROS
TypeAccess< typename argument_type< void(D)>::type >::type type
#define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
macros for pragma push/pop/ignore deprecated warnings
Main pinocchio namespace.
pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:11