5 #ifndef __pinocchio_check_hpp__
6 #define __pinocchio_check_hpp__
8 #include "pinocchio/multibody/model.hpp"
9 #include "pinocchio/multibody/data.hpp"
10 #include <boost/fusion/container/list.hpp>
11 #include <boost/fusion/container/generation/make_list.hpp>
13 #ifndef PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE
14 #define PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE 5
21 template<
typename AlgorithmCheckerDerived>
24 inline AlgorithmCheckerDerived & derived()
26 return *
static_cast<AlgorithmCheckerDerived *
>(
this);
29 inline const AlgorithmCheckerDerived & derived()
const
31 return *
static_cast<const AlgorithmCheckerDerived *
>(
this);
34 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
37 return derived().checkModel_impl(model);
41 #define PINOCCHIO_DEFINE_ALGO_CHECKER(NAME) \
42 struct NAME##Checker : public AlgorithmCheckerBase<NAME##Checker> \
44 template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl> \
45 inline bool checkModel_impl(const ModelTpl<Scalar, Options, JointCollectionTpl> &) const; \
49 PINOCCHIO_DEFINE_ALGO_CHECKER(Parent);
51 #if !defined(BOOST_FUSION_HAS_VARIADIC_LIST)
53 template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
54 PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE,
class D, boost::fusion::void_)>
57 AlgorithmCheckerList<BOOST_PP_ENUM_PARAMS(PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE, D)>>
59 typedef typename boost::fusion::list<BOOST_PP_ENUM_PARAMS(
60 PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE, D)>
64 : checkerList(checkerList)
70 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
73 const ArgType & checkerList;
76 #define MAKE_ALGO_CHECKER_LIST(z, n, _) \
78 template<BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), class D)> \
79 AlgorithmCheckerList<BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), D)> makeAlgoCheckerList( \
80 BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n), D, const & arg)) \
82 return AlgorithmCheckerList<BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), D)>( \
83 boost::fusion::make_list(BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), arg))); \
86 BOOST_PP_REPEAT(PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE, MAKE_ALGO_CHECKER_LIST, BOOST_PP_EMPTY)
91 typedef typename boost::fusion::list<D...> ArgType;
94 : checkerList(checkerList)
100 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
101 bool checkModel_impl(
const ModelTpl<Scalar, Options, JointCollectionTpl> & model)
const;
103 const ArgType & checkerList;
107 AlgorithmCheckerList<T...> makeAlgoCheckerList(
const T &... args)
109 return AlgorithmCheckerList<T...>(boost::fusion::make_list(args...));
120 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
128 #include "pinocchio/algorithm/check.hxx"
Main pinocchio namespace.
bool checkData(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data)
CRTP class describing the API of the checkers.
Checker having a list of Checker as input argument.