GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/hpp/fcl/serialization/geometric_shapes.h Lines: 56 56 100.0 %
Date: 2024-02-09 12:57:42 Branches: 26 52 50.0 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2021 INRIA
3
//
4
5
#ifndef HPP_FCL_SERIALIZATION_GEOMETRIC_SHAPES_H
6
#define HPP_FCL_SERIALIZATION_GEOMETRIC_SHAPES_H
7
8
#include "hpp/fcl/shape/geometric_shapes.h"
9
#include "hpp/fcl/serialization/fwd.h"
10
11
namespace boost {
12
namespace serialization {
13
14
template <class Archive>
15
140
void serialize(Archive& ar, hpp::fcl::ShapeBase& shape_base,
16
               const unsigned int /*version*/) {
17
140
  ar& make_nvp("base",
18
               boost::serialization::base_object<hpp::fcl::CollisionGeometry>(
19
140
                   shape_base));
20
140
}
21
22
template <class Archive>
23
12
void serialize(Archive& ar, hpp::fcl::TriangleP& triangle,
24
               const unsigned int /*version*/) {
25
12
  ar& make_nvp(
26
12
      "base", boost::serialization::base_object<hpp::fcl::ShapeBase>(triangle));
27
12
  ar& make_nvp("a", triangle.a);
28
12
  ar& make_nvp("b", triangle.b);
29
12
  ar& make_nvp("c", triangle.c);
30
12
}
31
32
template <class Archive>
33
16
void serialize(Archive& ar, hpp::fcl::Box& box,
34
               const unsigned int /*version*/) {
35
16
  ar& make_nvp("base",
36
16
               boost::serialization::base_object<hpp::fcl::ShapeBase>(box));
37
16
  ar& make_nvp("halfSide", box.halfSide);
38
16
}
39
40
template <class Archive>
41
16
void serialize(Archive& ar, hpp::fcl::Sphere& sphere,
42
               const unsigned int /*version*/) {
43
16
  ar& make_nvp("base",
44
16
               boost::serialization::base_object<hpp::fcl::ShapeBase>(sphere));
45
16
  ar& make_nvp("radius", sphere.radius);
46
16
}
47
48
template <class Archive>
49
16
void serialize(Archive& ar, hpp::fcl::Ellipsoid& ellipsoid,
50
               const unsigned int /*version*/) {
51
16
  ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::ShapeBase>(
52
16
                           ellipsoid));
53
16
  ar& make_nvp("radii", ellipsoid.radii);
54
16
}
55
56
template <class Archive>
57
16
void serialize(Archive& ar, hpp::fcl::Capsule& capsule,
58
               const unsigned int /*version*/) {
59
16
  ar& make_nvp("base",
60
16
               boost::serialization::base_object<hpp::fcl::ShapeBase>(capsule));
61
16
  ar& make_nvp("radius", capsule.radius);
62
16
  ar& make_nvp("halfLength", capsule.halfLength);
63
16
}
64
65
template <class Archive>
66
12
void serialize(Archive& ar, hpp::fcl::Cone& cone,
67
               const unsigned int /*version*/) {
68
12
  ar& make_nvp("base",
69
12
               boost::serialization::base_object<hpp::fcl::ShapeBase>(cone));
70
12
  ar& make_nvp("radius", cone.radius);
71
12
  ar& make_nvp("halfLength", cone.halfLength);
72
12
}
73
74
template <class Archive>
75
16
void serialize(Archive& ar, hpp::fcl::Cylinder& cylinder,
76
               const unsigned int /*version*/) {
77
16
  ar& make_nvp(
78
16
      "base", boost::serialization::base_object<hpp::fcl::ShapeBase>(cylinder));
79
16
  ar& make_nvp("radius", cylinder.radius);
80
16
  ar& make_nvp("halfLength", cylinder.halfLength);
81
16
}
82
83
template <class Archive>
84
16
void serialize(Archive& ar, hpp::fcl::Halfspace& half_space,
85
               const unsigned int /*version*/) {
86
16
  ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::ShapeBase>(
87
16
                           half_space));
88
16
  ar& make_nvp("n", half_space.n);
89
16
  ar& make_nvp("d", half_space.d);
90
16
}
91
92
template <class Archive>
93
16
void serialize(Archive& ar, hpp::fcl::Plane& plane,
94
               const unsigned int /*version*/) {
95
16
  ar& make_nvp("base",
96
16
               boost::serialization::base_object<hpp::fcl::ShapeBase>(plane));
97
16
  ar& make_nvp("n", plane.n);
98
16
  ar& make_nvp("d", plane.d);
99
16
}
100
101
}  // namespace serialization
102
}  // namespace boost
103
104
#endif  // ifndef HPP_FCL_SERIALIZATION_GEOMETRIC_SHAPES_H