algorithm/check.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2018 CNRS
3 //
4 
5 #ifndef __pinocchio_check_hpp__
6 #define __pinocchio_check_hpp__
7 
10 #include <boost/fusion/container/list.hpp>
11 #include <boost/fusion/container/generation/make_list.hpp>
12 
13 #ifndef PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE
14  #define PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE 5
15 #endif
16 
17 namespace pinocchio
18 {
19 
21  template<typename AlgorithmCheckerDerived>
23  {
24  inline AlgorithmCheckerDerived & derived()
25  {
26  return *static_cast<AlgorithmCheckerDerived *>(this);
27  }
28 
29  inline const AlgorithmCheckerDerived & derived() const
30  {
31  return *static_cast<const AlgorithmCheckerDerived *>(this);
32  }
33 
34  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
36  {
37  return derived().checkModel_impl(model);
38  }
39  };
40 
41 #define PINOCCHIO_DEFINE_ALGO_CHECKER(NAME) \
42  struct NAME##Checker : public AlgorithmCheckerBase<NAME##Checker> \
43  { \
44  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl> \
45  inline bool checkModel_impl(const ModelTpl<Scalar, Options, JointCollectionTpl> &) const; \
46  }
47 
50 
51 #if !defined(BOOST_FUSION_HAS_VARIADIC_LIST)
52  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)>>
58  {
59  typedef typename boost::fusion::list<BOOST_PP_ENUM_PARAMS(
62 
65  {
66  }
67 
68  // Calls model.check for each checker in the fusion::list.
69  // Each list element is supposed to implement the AlgorithmCheckerBase API.
70  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
72 
74  };
75 
76  #define MAKE_ALGO_CHECKER_LIST(z, n, _) \
77  \
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)) \
81  { \
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))); \
84  }
85 
87 #else
88  template<class... D>
89  struct AlgorithmCheckerList : AlgorithmCheckerBase<AlgorithmCheckerList<D...>>
90  {
91  typedef typename boost::fusion::list<D...> ArgType;
92 
95  {
96  }
97 
98  // Calls model.check for each checker in the fusion::list.
99  // Each list element is supposed to implement the AlgorithmCheckerBase API.
100  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
101  bool checkModel_impl(const ModelTpl<Scalar, Options, JointCollectionTpl> & model) const;
102 
103  const ArgType & checkerList;
104  };
105 
106  template<class... T>
107  AlgorithmCheckerList<T...> makeAlgoCheckerList(const T &... args)
108  {
109  return AlgorithmCheckerList<T...>(boost::fusion::make_list(args...));
110  }
111 
112 #endif
113 
120  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
121  inline bool checkData(
122  const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
123  const DataTpl<Scalar, Options, JointCollectionTpl> & data);
124 
125 } // namespace pinocchio
126 
127 /* --- Details -------------------------------------------------------------------- */
128 #include "pinocchio/algorithm/check.hxx"
129 
130 #endif // ifndef __pinocchio_check_hpp__
simulation-contact-dynamics.T
int T
Definition: simulation-contact-dynamics.py:89
pinocchio::AlgorithmCheckerList::ArgType
boost::fusion::list< BOOST_PP_ENUM_PARAMS(PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE, D)> ArgType
Definition: algorithm/check.hpp:61
pinocchio::AlgorithmCheckerBase
CRTP class describing the API of the checkers.
Definition: algorithm/check.hpp:22
model.hpp
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::AlgorithmCheckerBase::checkModel
bool checkModel(const ModelTpl< Scalar, Options, JointCollectionTpl > &model) const
Definition: algorithm/check.hpp:35
pinocchio::AlgorithmCheckerBase::derived
AlgorithmCheckerDerived & derived()
Definition: algorithm/check.hpp:24
args
args
MAKE_ALGO_CHECKER_LIST
#define MAKE_ALGO_CHECKER_LIST(z, n, _)
Definition: algorithm/check.hpp:76
BOOST_PP_REPEAT
BOOST_PP_REPEAT(DOXYGEN_DOC_MAX_NUMBER_OF_ARGUMENTS_IN_CONSTRUCTOR, DOXYGEN_DOC_DECLARE_CONSTRUCTOR, ~) template< typename Class > struct destructor_doc_impl
pinocchio::AlgorithmCheckerList::AlgorithmCheckerList
AlgorithmCheckerList(const ArgType &checkerList)
Definition: algorithm/check.hpp:63
data.hpp
D
D
pinocchio::AlgorithmCheckerList
Checker having a list of Checker as input argument.
Definition: algorithm/check.hpp:55
PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE
#define PINOCCHIO_ALGO_CHECKER_LIST_MAX_LIST_SIZE
Definition: algorithm/check.hpp:14
pinocchio::PINOCCHIO_DEFINE_ALGO_CHECKER
PINOCCHIO_DEFINE_ALGO_CHECKER(ABA)
pinocchio::checkData
bool checkData(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data)
pinocchio::AlgorithmCheckerList::checkModel_impl
bool checkModel_impl(const ModelTpl< Scalar, Options, JointCollectionTpl > &model) const
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::AlgorithmCheckerBase::derived
const AlgorithmCheckerDerived & derived() const
Definition: algorithm/check.hpp:29
pinocchio::AlgorithmCheckerList::checkerList
const ArgType & checkerList
Definition: algorithm/check.hpp:73
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:26