pinocchio  3.2.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
constraint-model-generic.hpp
1 //
2 // Copyright (c) 2023 INRIA
3 //
4 
5 #ifndef __pinocchio_algorithm_constraint_model_generic_hpp__
6 #define __pinocchio_algorithm_constraint_model_generic_hpp__
7 
8 #include "pinocchio/algorithm/constraints/fwd.hpp"
9 #include "pinocchio/algorithm/constraints/constraint-model-base.hpp"
10 #include "pinocchio/algorithm/constraints/constraint-data-generic.hpp"
11 #include "pinocchio/algorithm/constraints/visitors/constraint-model-visitor.hpp"
12 
13 namespace pinocchio
14 {
15 
16  template<
17  typename _Scalar,
18  int _Options,
19  template<typename S, int O>
20  class ConstraintCollectionTpl>
22  {
23  typedef _Scalar Scalar;
24  enum
25  {
26  Options = _Options
27  };
29  };
30 
31  template<
32  typename _Scalar,
33  int _Options,
34  template<typename S, int O>
37  : ConstraintModelBase<ConstraintModelTpl<_Scalar, _Options, ConstraintCollectionTpl>>
38  , ConstraintCollectionTpl<_Scalar, _Options>::ConstraintModelVariant
39  {
40  typedef _Scalar Scalar;
41  enum
42  {
43  Options = _Options
44  };
45 
47  Base;
50  typedef typename ConstraintCollection::ConstraintDataVariant ConstraintDataVariant;
51  typedef typename ConstraintCollection::ConstraintModelVariant ConstraintModelVariant;
52 
54  : ConstraintModelVariant()
55  {
56  }
57 
58  ConstraintModelTpl(const ConstraintModelVariant & cmodel_variant)
59  : ConstraintModelVariant(cmodel_variant)
60  {
61  }
62 
63  template<typename ContraintModelDerived>
65  : ConstraintModelVariant((ConstraintModelVariant)cmodel.derived())
66  {
67  BOOST_MPL_ASSERT(
68  (boost::mpl::contains<typename ConstraintModelVariant::types, ContraintModelDerived>));
69  }
70 
71  ConstraintData createData() const
72  {
73  return ::pinocchio::createData<Scalar, Options, ConstraintCollectionTpl>(*this);
74  }
75  };
76 
77 } // namespace pinocchio
78 
79 #endif // ifndef __pinocchio_algorithm_constraint_model_generic_hpp__
Main pinocchio namespace.
Definition: treeview.dox:11
Common traits structure to fully define base classes for CRTP.
Definition: fwd.hpp:72