Directory: | ./ |
---|---|
File: | include/coal/serialization/collision_object.h |
Date: | 2025-04-01 09:23:31 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 18 | 18 | 100.0% |
Branches: | 12 | 24 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2021 INRIA | ||
3 | // | ||
4 | |||
5 | #ifndef COAL_SERIALIZATION_COLLISION_OBJECT_H | ||
6 | #define COAL_SERIALIZATION_COLLISION_OBJECT_H | ||
7 | |||
8 | #include "coal/collision_object.h" | ||
9 | |||
10 | #include "coal/serialization/fwd.h" | ||
11 | #include "coal/serialization/AABB.h" | ||
12 | |||
13 | namespace boost { | ||
14 | namespace serialization { | ||
15 | |||
16 | template <class Archive> | ||
17 | 194 | void save(Archive& ar, const coal::CollisionGeometry& collision_geometry, | |
18 | const unsigned int /*version*/) { | ||
19 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar& make_nvp("aabb_center", collision_geometry.aabb_center); |
20 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar& make_nvp("aabb_radius", collision_geometry.aabb_radius); |
21 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar& make_nvp("aabb_local", collision_geometry.aabb_local); |
22 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar& make_nvp("cost_density", collision_geometry.cost_density); |
23 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar& make_nvp("threshold_occupied", collision_geometry.threshold_occupied); |
24 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar& make_nvp("threshold_free", collision_geometry.threshold_free); |
25 | 194 | } | |
26 | |||
27 | template <class Archive> | ||
28 | 194 | void load(Archive& ar, coal::CollisionGeometry& collision_geometry, | |
29 | const unsigned int /*version*/) { | ||
30 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar >> make_nvp("aabb_center", collision_geometry.aabb_center); |
31 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar >> make_nvp("aabb_radius", collision_geometry.aabb_radius); |
32 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar >> make_nvp("aabb_local", collision_geometry.aabb_local); |
33 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar >> make_nvp("cost_density", collision_geometry.cost_density); |
34 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar >> make_nvp("threshold_occupied", collision_geometry.threshold_occupied); |
35 |
1/2✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
|
194 | ar >> make_nvp("threshold_free", collision_geometry.threshold_free); |
36 | 194 | collision_geometry.user_data = NULL; // no way to recover this | |
37 | 194 | } | |
38 | |||
39 | 388 | COAL_SERIALIZATION_SPLIT(coal::CollisionGeometry) | |
40 | |||
41 | } // namespace serialization | ||
42 | } // namespace boost | ||
43 | |||
44 | namespace coal { | ||
45 | |||
46 | // fwd declaration | ||
47 | template <typename BV> | ||
48 | class HeightField; | ||
49 | |||
50 | template <typename PolygonT> | ||
51 | class Convex; | ||
52 | |||
53 | struct OBB; | ||
54 | struct OBBRSS; | ||
55 | class AABB; | ||
56 | |||
57 | class OcTree; | ||
58 | class Box; | ||
59 | class Sphere; | ||
60 | class Ellipsoid; | ||
61 | class Capsule; | ||
62 | class Cone; | ||
63 | class TriangleP; | ||
64 | class Cylinder; | ||
65 | class Halfspace; | ||
66 | class Plane; | ||
67 | |||
68 | namespace serialization { | ||
69 | template <> | ||
70 | struct register_type<CollisionGeometry> { | ||
71 | template <class Archive> | ||
72 | static void on(Archive& ar) { | ||
73 | ar.template register_type<Box>(); | ||
74 | ar.template register_type<Sphere>(); | ||
75 | ar.template register_type<Ellipsoid>(); | ||
76 | ar.template register_type<TriangleP>(); | ||
77 | ar.template register_type<Capsule>(); | ||
78 | ar.template register_type<Cone>(); | ||
79 | ar.template register_type<Cylinder>(); | ||
80 | ar.template register_type<Halfspace>(); | ||
81 | ar.template register_type<Plane>(); | ||
82 | ar.template register_type<OcTree>(); | ||
83 | ar.template register_type<HeightField<OBB>>(); | ||
84 | ar.template register_type<HeightField<OBBRSS>>(); | ||
85 | ar.template register_type<HeightField<AABB>>(); | ||
86 | ar.template register_type<Convex<Triangle>>(); | ||
87 | ; | ||
88 | } | ||
89 | }; | ||
90 | } // namespace serialization | ||
91 | } // namespace coal | ||
92 | |||
93 | #endif // ifndef COAL_SERIALIZATION_COLLISION_OBJECT_H | ||
94 |