Directory: | ./ |
---|---|
File: | include/hpp/constraints/serialization.hh |
Date: | 2025-05-05 12:19:30 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 9 | 9 | 100.0% |
Branches: | 3 | 6 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
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_CONSTRAINTS_SERIALIZATION_HH | ||
30 | #define HPP_CONSTRAINTS_SERIALIZATION_HH | ||
31 | |||
32 | #include <boost/serialization/serialization.hpp> | ||
33 | #include <boost/serialization/utility.hpp> | ||
34 | #include <boost/serialization/vector.hpp> | ||
35 | #include <hpp/constraints/matrix-view.hh> | ||
36 | |||
37 | namespace boost { | ||
38 | namespace serialization { | ||
39 | |||
40 | template <class Archive> | ||
41 | 32 | inline void segments_serialize(Archive& ar, const char* n, | |
42 | Eigen::BlockIndex::segments_t& s) { | ||
43 |
1/2✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
32 | ar& make_nvp(n, s); |
44 | } | ||
45 | template <class Archive> | ||
46 | 16 | inline void segments_serialize(Archive&, const char*, | |
47 | 16 | Eigen::internal::empty_struct&) {} | |
48 | |||
49 | template <class Archive, bool _allRows, bool _allCols> | ||
50 | 24 | inline void serialize(Archive& ar, Eigen::MatrixBlocks<_allRows, _allCols>& b, | |
51 | const unsigned int version) { | ||
52 | (void)version; | ||
53 |
1/2✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
|
24 | ar& make_nvp("nbRows", b.m_nbRows); |
54 |
1/2✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
|
24 | ar& make_nvp("nbCols", b.m_nbCols); |
55 | 24 | segments_serialize(ar, "rows", b.m_rows); | |
56 | 24 | segments_serialize(ar, "cols", b.m_cols); | |
57 | } | ||
58 | } // namespace serialization | ||
59 | } // namespace boost | ||
60 | |||
61 | #endif // HPP_CONSTRAINTS_SERIALIZATION_HH | ||
62 |