GCC Code Coverage Report


Directory: ./
File: src/serialization.cc
Date: 2024-08-10 11:29:48
Exec Total Coverage
Lines: 29 29 100.0%
Branches: 18 36 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2020 CNRS
3 // Authors: Joseph Mirabel
4 //
5
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // 1. Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //
13 // 2. Redistributions in binary form must reproduce the above copyright
14 // notice, this list of conditions and the following disclaimer in the
15 // documentation and/or other materials provided with the distribution.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28 // DAMAGE.
29
30 #include <boost/serialization/version.hpp>
31 #if BOOST_VERSION / 100 % 1000 == 74
32 #include <boost/serialization/library_version_type.hpp>
33 #endif
34 // ref https://github.com/boostorg/serialization/issues/219
35
36 #include <boost/serialization/list.hpp>
37 #include <boost/serialization/serialization.hpp>
38 #include <boost/serialization/set.hpp>
39 #include <boost/serialization/weak_ptr.hpp>
40 #include <hpp/core/connected-component.hh>
41 #include <hpp/core/distance.hh>
42 #include <hpp/core/edge.hh>
43 #include <hpp/core/nearest-neighbor.hh>
44 #include <hpp/core/node.hh>
45 #include <hpp/core/path.hh>
46 #include <hpp/core/roadmap.hh>
47 #include <hpp/pinocchio/serialization.hh>
48 #include <hpp/util/serialization.hh>
49 #include <pinocchio/serialization/eigen.hpp>
50
51 namespace hpp {
52 namespace core {
53
54 template <typename Archive>
55 72 inline void Node::serialize(Archive& ar, const unsigned int version) {
56 (void)version;
57 72 Configuration_t& config(configuration_);
58 72 serialization::remove_duplicate::serialize_vector(ar, "config", config,
59 version);
60
1/2
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
72 ar& BOOST_SERIALIZATION_NVP(outEdges_);
61
1/2
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
72 ar& BOOST_SERIALIZATION_NVP(inEdges_);
62
1/2
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
72 ar& BOOST_SERIALIZATION_NVP(connectedComponent_);
63 72 }
64 HPP_SERIALIZATION_IMPLEMENT(Node);
65
66 template <typename Archive>
67 60 inline void Edge::serialize(Archive& ar, const unsigned int version) {
68 (void)version;
69
1/2
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
60 ar& BOOST_SERIALIZATION_NVP(n1_);
70
1/2
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
60 ar& BOOST_SERIALIZATION_NVP(n2_);
71
1/2
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
60 ar& BOOST_SERIALIZATION_NVP(path_);
72 60 }
73 HPP_SERIALIZATION_IMPLEMENT(Edge);
74
75 template <typename Archive>
76 48 inline void ConnectedComponent::serialize(Archive& ar,
77 const unsigned int version) {
78 (void)version;
79
1/2
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
48 ar& BOOST_SERIALIZATION_NVP(nodes_);
80
1/2
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
48 ar& BOOST_SERIALIZATION_NVP(reachableFrom_);
81
1/2
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
48 ar& BOOST_SERIALIZATION_NVP(reachableTo_);
82
1/2
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
48 ar& BOOST_SERIALIZATION_NVP(weak_);
83 48 }
84 HPP_SERIALIZATION_IMPLEMENT(ConnectedComponent);
85
86 template <typename Archive>
87 12 inline void Roadmap::serialize(Archive& ar, const unsigned int version) {
88 (void)version;
89
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
12 ar& boost::serialization::make_nvp("distance_",
90 12 const_cast<DistancePtr_t&>(distance_));
91
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 ar& BOOST_SERIALIZATION_NVP(connectedComponents_);
92
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 ar& BOOST_SERIALIZATION_NVP(nodes_);
93
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 ar& BOOST_SERIALIZATION_NVP(edges_);
94
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 ar& BOOST_SERIALIZATION_NVP(initNode_);
95
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 ar& BOOST_SERIALIZATION_NVP(goalNodes_);
96
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 ar& BOOST_SERIALIZATION_NVP(nearestNeighbor_);
97
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 ar& BOOST_SERIALIZATION_NVP(weak_);
98 12 }
99 HPP_SERIALIZATION_IMPLEMENT(Roadmap);
100
101 } // namespace core
102 } // namespace hpp
103