GCC Code Coverage Report


Directory: ./
File: include/pinocchio/serialization/inertia.hpp
Date: 2025-02-12 21:03:38
Exec Total Coverage
Lines: 14 14 100.0%
Branches: 10 19 52.6%

Line Branch Exec Source
1 //
2 // Copyright (c) 2019 INRIA
3 //
4
5 #ifndef __pinocchio_serialization_inertia_hpp__
6 #define __pinocchio_serialization_inertia_hpp__
7
8 #include "pinocchio/spatial/inertia.hpp"
9 #include "pinocchio/serialization/fwd.hpp"
10 #include "pinocchio/serialization/symmetric3.hpp"
11
12 #include <boost/serialization/split_free.hpp>
13 #include <boost/serialization/vector.hpp>
14
15 namespace boost
16 {
17 namespace serialization
18 {
19
20 template<class Archive, typename Scalar, int Options>
21 3687 void save(
22 Archive & ar,
23 const pinocchio::InertiaTpl<Scalar, Options> & I,
24 const unsigned int /*version*/)
25 {
26 3687 const Scalar mass = I.mass();
27
1/2
✓ Branch 2 taken 1885 times.
✗ Branch 3 not taken.
3687 ar & make_nvp("mass", mass);
28
5/9
✓ Branch 2 taken 1802 times.
✓ Branch 3 taken 83 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1439 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 446 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1439 times.
✗ Branch 10 not taken.
3687 ar & make_nvp("lever", make_array(I.lever().data(), 3));
29
1/2
✓ Branch 3 taken 1885 times.
✗ Branch 4 not taken.
3687 ar & make_nvp("inertia", I.inertia());
30 3687 }
31
32 template<class Archive, typename Scalar, int Options>
33 void
34 3189 load(Archive & ar, pinocchio::InertiaTpl<Scalar, Options> & I, const unsigned int /*version*/)
35 {
36
1/2
✓ Branch 3 taken 1636 times.
✗ Branch 4 not taken.
3189 ar >> make_nvp("mass", I.mass());
37
1/2
✓ Branch 5 taken 1636 times.
✗ Branch 6 not taken.
3189 ar >> make_nvp("lever", make_array(I.lever().data(), 3));
38
1/2
✓ Branch 3 taken 1636 times.
✗ Branch 4 not taken.
3189 ar >> make_nvp("inertia", I.inertia());
39 3189 }
40
41 template<class Archive, typename Scalar, int Options>
42 void
43 7042 serialize(Archive & ar, pinocchio::InertiaTpl<Scalar, Options> & I, const unsigned int version)
44 {
45 7042 split_free(ar, I, version);
46 7042 }
47
48 } // namespace serialization
49 } // namespace boost
50
51 #endif // ifndef __pinocchio_serialization_inertia_hpp__
52