5 #ifndef __pinocchio_macros_hpp__ 6 #define __pinocchio_macros_hpp__ 11 #if (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703)) 12 #define PINOCCHIO_WITH_CXX17_SUPPORT 15 #if (__cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201403)) 16 #define PINOCCHIO_WITH_CXX14_SUPPORT 19 #if (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) 20 #define PINOCCHIO_WITH_CXX11_SUPPORT 23 #define PINOCCHIO_STRING_LITERAL(string) #string 26 #if defined(__GNUC__) || defined(__clang__) 27 #define PINOCCHIO_PRAGMA(x) _Pragma(#x) 28 #define PINOCCHIO_PRAGMA_MESSAGE(the_message) PINOCCHIO_PRAGMA(GCC message #the_message) 29 #define PINOCCHIO_PRAGMA_WARNING(the_message) PINOCCHIO_PRAGMA(GCC warning #the_message) 30 #define PINOCCHIO_PRAGMA_DEPRECATED(the_message) PINOCCHIO_PRAGMA_WARNING(Deprecated: #the_message) 31 #define PINOCCHIO_PRAGMA_DEPRECATED_HEADER(old_header,new_header) \ 32 PINOCCHIO_PRAGMA_WARNING(Deprecated header file: #old_header has been replaced by #new_header.\n Please use #new_header instead of #old_header.) 36 #define PINOCCHIO_NOT_A_MACRO 48 #define PINOCCHIO_MACRO_EMPTY_ARG 51 #define PINOCCHIO_UNUSED_VARIABLE(var) (void)(var) 54 #define PINOCCHIO_ASSERT_MATRIX_SPECIFIC_SIZE(type,M,nrows,ncols) \ 55 EIGEN_STATIC_ASSERT( (type::RowsAtCompileTime == Eigen::Dynamic || type::RowsAtCompileTime == nrows) \ 56 && (type::ColsAtCompileTime == Eigen::Dynamic || type::ColsAtCompileTime == ncols),\ 57 THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); \ 58 assert(M.rows()==nrows && M.cols()==ncols); 63 #define PINOCCHIO_STATIC_ASSERT(condition,msg) \ 64 { int msg[(condition) ? 1 : -1]; (void) msg; } 70 template<
typename D,
template<
typename>
class TypeAccess>
79 #if defined(__GNUC__) || defined(__clang__) 80 # define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") 81 # define PINOCCHIO_COMPILER_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") 82 # define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 84 # define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH _Pragma("warning(push)") 85 # define PINOCCHIO_COMPILER_DIAGNOSTIC_POP _Pragma("warning(pop)") 86 # define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS _Pragma("warning(disable : 4996)") 88 # define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH 89 # define PINOCCHIO_COMPILER_DIAGNOSTIC_POP 90 # define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS 98 #pragma GCC system_header 101 #if defined(__GNUC__) || defined(__clang__) 102 #pragma GCC diagnostic push 103 #pragma GCC diagnostic ignored "-Wvariadic-macros" 107 #if !defined(PINOCCHIO_NO_THROW) 108 #define PINOCCHIO_THROW(condition,exception_type,message) \ 109 if (!(condition)) { throw exception_type(message); } 111 #define PINOCCHIO_THROW(condition,exception_type,message) 114 #define _PINOCCHIO_EXPAND(x) x 115 #define _PINOCCHIO_GET_OVERRIDE_FOR_CHECK_INPUT_ARGUMENT(_1, _2, MACRO_NAME, ...) MACRO_NAME 117 #define _PINOCCHIO_CHECK_INPUT_ARGUMENT_2(condition, message) \ 118 PINOCCHIO_THROW(condition,std::invalid_argument,message) 120 #define _PINOCCHIO_CHECK_INPUT_ARGUMENT_1(condition) \ 121 _PINOCCHIO_CHECK_INPUT_ARGUMENT_2(condition,\ 122 "The following check on the input argument has failed: "#condition) 124 #define _PINOCCHIO_CHECK_INPUT_ARGUMENT_0 127 #define PINOCCHIO_CHECK_INPUT_ARGUMENT(...) \ 128 _PINOCCHIO_EXPAND(_PINOCCHIO_EXPAND(_PINOCCHIO_GET_OVERRIDE_FOR_CHECK_INPUT_ARGUMENT(__VA_ARGS__,_PINOCCHIO_CHECK_INPUT_ARGUMENT_2,\ 129 _PINOCCHIO_CHECK_INPUT_ARGUMENT_1,_PINOCCHIO_CHECK_INPUT_ARGUMENT_0))(__VA_ARGS__)) 131 #define _PINOCCHIO_GET_OVERRIDE_FOR_CHECK_ARGUMENT_SIZE(_1, _2, _3, MACRO_NAME, ...) MACRO_NAME 133 #define _PINOCCHIO_CHECK_ARGUMENT_SIZE_3(size, expected_size, message) \ 134 if (size != expected_size) { \ 135 std::ostringstream oss; \ 136 oss << "wrong argument size: expected " << expected_size << ", got " << size << std::endl; \ 137 oss << "hint: " << message << std::endl; \ 138 PINOCCHIO_THROW(false, std::invalid_argument, oss.str()); \ 141 #define _PINOCCHIO_CHECK_ARGUMENT_SIZE_2(size, expected_size) \ 142 _PINOCCHIO_CHECK_ARGUMENT_SIZE_3(size, expected_size, PINOCCHIO_STRING_LITERAL(size) " is different from " PINOCCHIO_STRING_LITERAL(expected_size)) 144 #define _PINOCCHIO_CHECK_ARGUMENT_SIZE_1 147 #define PINOCCHIO_CHECK_ARGUMENT_SIZE(...) \ 148 _PINOCCHIO_EXPAND(_PINOCCHIO_EXPAND(_PINOCCHIO_GET_OVERRIDE_FOR_CHECK_ARGUMENT_SIZE(__VA_ARGS__,_PINOCCHIO_CHECK_ARGUMENT_SIZE_3, \ 149 _PINOCCHIO_CHECK_ARGUMENT_SIZE_2, _PINOCCHIO_CHECK_ARGUMENT_SIZE_1))(__VA_ARGS__)) 151 #if defined(__GNUC__) || defined(__clang__) 152 #pragma GCC diagnostic pop 155 #endif // ifndef __pinocchio_macros_hpp__
TypeAccess< typename argument_type< void(D)>::type >::type type
Main pinocchio namespace.