GCC Code Coverage Report


Directory: ./
File: include/pinocchio/algorithm/check-model.hpp
Date: 2025-04-30 16:14:33
Exec Total Coverage
Lines: 5 5 100.0%
Branches: 0 0 -%

Line Branch Exec Source
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
23 /// Simple model checker, that assert that model.parents is indeed a tree.
24 PINOCCHIO_DEFINE_ALGO_CHECKER(Parent);
25 /// Simple model checker, that assert that there is a mimic joint in the tree
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 4 AlgorithmCheckerList(const ArgType & checkerList)
34 4 : checkerList(checkerList)
35 {
36 4 }
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 2 AlgorithmCheckerList<T...> makeAlgoCheckerList(const T &... args)
48 {
49 2 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__
58