hpp-pinocchio  4.10.1
Wrapping of the kinematic/dynamic chain Pinocchio for HPP.
serialization.hh
Go to the documentation of this file.
1 // Copyright (c) 2020, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of hpp-pinocchio.
5 // hpp-pinocchio is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-pinocchio is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-pinocchio. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HPP_PINOCCHIO_LIEGROUP_SERIALIZATION_HH
18 #define HPP_PINOCCHIO_LIEGROUP_SERIALIZATION_HH
19 
20 #include <boost/serialization/serialization.hpp>
21 #include <boost/serialization/split_free.hpp>
22 
24 
25 namespace boost {
26 namespace serialization {
27 
28 template<class Archive, int Size, bool rot>
29 inline void serialize(Archive & ar,
31  const unsigned int version)
32 {
33  (void) version;
34  if (Size == Eigen::Dynamic) {
35  int size = static_cast<int>(lg.nq());
36  ar & make_nvp("size", size);
37  if (!Archive::is_saving::value) {
38  // TODO VectorSpaceOperation should provide a resize operation.
40  }
41  }
42 }
43 
44 template<class Archive, typename LieGroup1, typename LieGroup2>
45 inline void serialize(Archive & ar,
47  const unsigned int version)
48 {
49  (void) version;
50 #if PINOCCHIO_VERSION_AT_LEAST(2,4,5)
51  ar & make_nvp("lg1", lg.lg1);
52  ar & make_nvp("lg2", lg.lg2);
53 #else
54  (void) ar; (void) lg;
55  throw std::logic_error("Pinocchio version is too low for serializing "
56  "hpp::pinocchio::liegroup::CartesianProductOperation");
57 #endif
58 }
59 
60 template<class Archive, int N>
61 inline void serialize(Archive & ar,
63  const unsigned int version)
64 {
65  (void) ar;
66  (void) lg;
67  (void) version;
68 }
69 
70 template<class Archive, int N>
71 inline void serialize(Archive & ar,
73  const unsigned int version)
74 {
75  (void) ar;
76  (void) lg;
77  (void) version;
78 }
79 } // namespace serialization
80 } // namespace boost
81 
82 #endif // HPP_PINOCCHIO_LIEGROUP_SERIALIZATION_HH
Definition: serialization.hh:25
Definition: cartesian-product.hh:28
void serialize(Archive &ar, hpp::pinocchio::liegroup::VectorSpaceOperation< Size, rot > &lg, const unsigned int version)
Definition: serialization.hh:29
Definition: special-orthogonal.hh:26
Definition: special-euclidean.hh:26