pinocchio  3.5.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
check-model.hpp
1 //
2 // Copyright (c) 2025 INRIA
3 //
4 
5 #ifndef __pinocchio_algorithm_check_model_hpp__
6 #define __pinocchio_algorithm_check_model_hpp__
7 
8 #include "pinocchio/algorithm/check-base.hpp"
9 
10 #include <boost/fusion/container/list.hpp>
11 #include <boost/fusion/container/generation/make_list.hpp>
12 
13 namespace pinocchio
14 {
15 
16 #define PINOCCHIO_DEFINE_ALGO_CHECKER(NAME) \
17  struct NAME##Checker : public AlgorithmCheckerBase<NAME##Checker> \
18  { \
19  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl> \
20  bool checkModel_impl(const ModelTpl<Scalar, Options, JointCollectionTpl> &) const; \
21  }
22 
24  PINOCCHIO_DEFINE_ALGO_CHECKER(Parent);
26  PINOCCHIO_DEFINE_ALGO_CHECKER(Mimic);
27 
28  template<class... D>
29  struct AlgorithmCheckerList : AlgorithmCheckerBase<AlgorithmCheckerList<D...>>
30  {
31  typedef typename boost::fusion::list<D...> ArgType;
32 
33  AlgorithmCheckerList(const ArgType & checkerList)
34  : checkerList(checkerList)
35  {
36  }
37 
38  // Calls model.check for each checker in the fusion::list.
39  // Each list element is supposed to implement the AlgorithmCheckerBase API.
40  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
41  bool checkModel_impl(const ModelTpl<Scalar, Options, JointCollectionTpl> & model) const;
42 
43  const ArgType & checkerList;
44  };
45 
46  template<class... T>
47  AlgorithmCheckerList<T...> makeAlgoCheckerList(const T &... args)
48  {
49  return AlgorithmCheckerList<T...>(boost::fusion::make_list(args...));
50  }
51 
52 } // namespace pinocchio
53 
54 /* --- Details -------------------------------------------------------------------- */
55 #include "pinocchio/algorithm/check-model.hxx"
56 
57 #endif // __pinocchio_algorithm_check_model_hpp__
Main pinocchio namespace.
Definition: treeview.dox:11
CRTP class describing the API of the checkers.
Definition: check-base.hpp:16