hpp-pinocchio  6.0.0
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 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28 
29 #ifndef HPP_PINOCCHIO_LIEGROUP_SERIALIZATION_HH
30 #define HPP_PINOCCHIO_LIEGROUP_SERIALIZATION_HH
31 
32 #include <boost/serialization/serialization.hpp>
33 #include <boost/serialization/split_free.hpp>
35 
36 namespace boost {
37 namespace serialization {
38 
39 template <class Archive, int Size, bool rot>
40 inline void serialize(
42  const unsigned int version) {
43  (void)version;
44  if (Size == Eigen::Dynamic) {
45  int size = static_cast<int>(lg.nq());
46  ar& make_nvp("size", size);
47  if (!Archive::is_saving::value) {
48  // TODO VectorSpaceOperation should provide a resize operation.
50  }
51  }
52 }
53 
54 template <class Archive, typename LieGroup1, typename LieGroup2>
55 inline void serialize(
56  Archive& ar,
58  lg,
59  const unsigned int version) {
60  (void)version;
61 #if PINOCCHIO_VERSION_AT_LEAST(2, 4, 5)
62  ar& make_nvp("lg1", lg.lg1);
63  ar& make_nvp("lg2", lg.lg2);
64 #else
65  (void)ar;
66  (void)lg;
67  throw std::logic_error(
68  "Pinocchio version is too low for serializing "
69  "hpp::pinocchio::liegroup::CartesianProductOperation");
70 #endif
71 }
72 
73 template <class Archive, int N>
74 inline void serialize(
76  const unsigned int version) {
77  (void)ar;
78  (void)lg;
79  (void)version;
80 }
81 
82 template <class Archive, int N>
83 inline void serialize(
85  const unsigned int version) {
86  (void)ar;
87  (void)lg;
88  (void)version;
89 }
90 } // namespace serialization
91 } // namespace boost
92 
93 #endif // HPP_PINOCCHIO_LIEGROUP_SERIALIZATION_HH
void serialize(Archive &ar, hpp::pinocchio::liegroup::VectorSpaceOperation< Size, rot > &lg, const unsigned int version)
Definition: serialization.hh:40
Definition: serialization.hh:36
Definition: cartesian-product.hh:40
Definition: special-euclidean.hh:39
Definition: special-orthogonal.hh:39