pinocchio  3.3.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> class ConstraintCollectionTpl>
21  {
22  typedef _Scalar Scalar;
23  enum
24  {
25  Options = _Options
26  };
28  };
29 
30  template<
31  typename _Scalar,
32  int _Options,
33  template<typename S, int O> class ConstraintCollectionTpl>
35  : ConstraintModelBase<ConstraintModelTpl<_Scalar, _Options, ConstraintCollectionTpl>>
36  , ConstraintCollectionTpl<_Scalar, _Options>::ConstraintModelVariant
37  {
38  typedef _Scalar Scalar;
39  enum
40  {
41  Options = _Options
42  };
43 
45  Base;
48  typedef typename ConstraintCollection::ConstraintDataVariant ConstraintDataVariant;
49  typedef typename ConstraintCollection::ConstraintModelVariant ConstraintModelVariant;
50 
52  : ConstraintModelVariant()
53  {
54  }
55 
56  ConstraintModelTpl(const ConstraintModelVariant & cmodel_variant)
57  : ConstraintModelVariant(cmodel_variant)
58  {
59  }
60 
61  template<typename ContraintModelDerived>
63  : ConstraintModelVariant((ConstraintModelVariant)cmodel.derived())
64  {
65  BOOST_MPL_ASSERT(
66  (boost::mpl::contains<typename ConstraintModelVariant::types, ContraintModelDerived>));
67  }
68 
69  ConstraintData createData() const
70  {
71  return ::pinocchio::createData<Scalar, Options, ConstraintCollectionTpl>(*this);
72  }
73  };
74 
75 } // namespace pinocchio
76 
77 #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