Skip to content

Commit 0495fea

Browse files
committed
Serialization: import Serializable from pinocchio
1 parent 8934742 commit 0495fea

23 files changed

+942
-232
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ SET(${PROJECT_NAME}_HEADERS
264264
include/hpp/fcl/internal/traversal_recurse.h
265265
include/hpp/fcl/internal/traversal.h
266266
include/hpp/fcl/serialization/fwd.h
267+
include/hpp/fcl/serialization/serializable.h
268+
include/hpp/fcl/serialization/archive.h
269+
include/hpp/fcl/serialization/static-buffer.h
267270
include/hpp/fcl/serialization/transform.h
268271
include/hpp/fcl/serialization/AABB.h
269272
include/hpp/fcl/serialization/BV_node.h

include/hpp/fcl/BVH/BVH_model.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@
3939
#ifndef HPP_FCL_BVH_MODEL_H
4040
#define HPP_FCL_BVH_MODEL_H
4141

42-
#include <hpp/fcl/fwd.hh>
43-
#include <hpp/fcl/collision_object.h>
44-
#include <hpp/fcl/BVH/BVH_internal.h>
45-
#include <hpp/fcl/BV/BV_node.h>
42+
#include "hpp/fcl/fwd.hh"
43+
#include "hpp/fcl/collision_object.h"
44+
#include "hpp/fcl/BVH/BVH_internal.h"
45+
#include "hpp/fcl/BV/BV_node.h"
46+
#include "hpp/fcl/serialization/serializable.h"
47+
4648
#include <vector>
4749
#include <memory>
4850
#include <iostream>
@@ -311,7 +313,9 @@ class HPP_FCL_DLLAPI BVHModelBase : public CollisionGeometry {
311313
/// cloud model (which is viewed as a degraded version of mesh) \tparam BV one
312314
/// of the bounding volume class in \ref Bounding_Volume.
313315
template <typename BV>
314-
class HPP_FCL_DLLAPI BVHModel : public BVHModelBase {
316+
class HPP_FCL_DLLAPI BVHModel
317+
: public BVHModelBase,
318+
public ::hpp::fcl::serialization::Serializable<BVHModel<BV>> {
315319
typedef BVHModelBase Base;
316320

317321
public:

include/hpp/fcl/collision_data.h

+18-9
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@
4343
#include <set>
4444
#include <limits>
4545

46-
#include <hpp/fcl/collision_object.h>
47-
#include <hpp/fcl/config.hh>
48-
#include <hpp/fcl/data_types.h>
49-
#include <hpp/fcl/timings.h>
50-
#include <hpp/fcl/narrowphase/narrowphase_defaults.h>
46+
#include "hpp/fcl/collision_object.h"
47+
#include "hpp/fcl/config.hh"
48+
#include "hpp/fcl/data_types.h"
49+
#include "hpp/fcl/timings.h"
50+
#include "hpp/fcl/narrowphase/narrowphase_defaults.h"
51+
#include "hpp/fcl/serialization/serializable.h"
5152

5253
namespace hpp {
5354
namespace fcl {
@@ -301,7 +302,9 @@ enum CollisionRequestFlag {
301302
};
302303

303304
/// @brief request to the collision algorithm
304-
struct HPP_FCL_DLLAPI CollisionRequest : QueryRequest {
305+
struct HPP_FCL_DLLAPI CollisionRequest
306+
: QueryRequest,
307+
::hpp::fcl::serialization::Serializable<CollisionRequest> {
305308
/// @brief The maximum number of contacts that can be returned
306309
size_t num_max_contacts;
307310

@@ -382,7 +385,9 @@ inline FCL_REAL Contact::getDistanceToCollision(
382385
}
383386

384387
/// @brief collision result
385-
struct HPP_FCL_DLLAPI CollisionResult : QueryResult {
388+
struct HPP_FCL_DLLAPI CollisionResult
389+
: QueryResult,
390+
::hpp::fcl::serialization::Serializable<CollisionResult> {
386391
private:
387392
/// @brief contact information
388393
std::vector<Contact> contacts;
@@ -490,7 +495,9 @@ struct HPP_FCL_DLLAPI CollisionResult : QueryResult {
490495
struct DistanceResult;
491496

492497
/// @brief request to the distance computation
493-
struct HPP_FCL_DLLAPI DistanceRequest : QueryRequest {
498+
struct HPP_FCL_DLLAPI DistanceRequest
499+
: QueryRequest,
500+
::hpp::fcl::serialization::Serializable<DistanceRequest> {
494501
/// @brief whether to return the nearest points.
495502
/// Nearest points are always computed and are the points of the shapes that
496503
/// achieve a distance of `DistanceResult::min_distance`.
@@ -556,7 +563,9 @@ struct HPP_FCL_DLLAPI DistanceRequest : QueryRequest {
556563
};
557564

558565
/// @brief distance result
559-
struct HPP_FCL_DLLAPI DistanceResult : QueryResult {
566+
struct HPP_FCL_DLLAPI DistanceResult
567+
: QueryResult,
568+
::hpp::fcl::serialization::Serializable<DistanceResult> {
560569
public:
561570
/// @brief minimum distance between two objects.
562571
/// If two objects are in collision and

include/hpp/fcl/hfield.h

+13-10
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@
3737
#ifndef HPP_FCL_HEIGHT_FIELD_H
3838
#define HPP_FCL_HEIGHT_FIELD_H
3939

40-
#include <hpp/fcl/fwd.hh>
41-
#include <hpp/fcl/data_types.h>
42-
#include <hpp/fcl/collision_object.h>
43-
#include <hpp/fcl/BV/BV_node.h>
44-
#include <hpp/fcl/BVH/BVH_internal.h>
40+
#include "hpp/fcl/fwd.hh"
41+
#include "hpp/fcl/data_types.h"
42+
#include "hpp/fcl/collision_object.h"
43+
#include "hpp/fcl/BV/BV_node.h"
44+
#include "hpp/fcl/BVH/BVH_internal.h"
45+
#include "hpp/fcl/serialization/serializable.h"
4546

4647
#include <vector>
4748

@@ -200,14 +201,16 @@ struct UpdateBoundingVolume<AABB> {
200201
/// The height field is centered at the origin and the corners of the geometry
201202
/// correspond to the following coordinates [± x_dim/2; ± y_dim/2].
202203
template <typename BV>
203-
class HPP_FCL_DLLAPI HeightField : public CollisionGeometry {
204+
class HPP_FCL_DLLAPI HeightField
205+
: public CollisionGeometry,
206+
public ::hpp::fcl::serialization::Serializable<HeightField<BV>> {
204207
public:
205208
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
206209

207210
typedef CollisionGeometry Base;
208211

209212
typedef HFNode<BV> Node;
210-
typedef std::vector<Node, Eigen::aligned_allocator<Node> > BVS;
213+
typedef std::vector<Node, Eigen::aligned_allocator<Node>> BVS;
211214

212215
/// @brief Constructing an empty HeightField
213216
HeightField()
@@ -528,13 +531,13 @@ template <>
528531
NODE_TYPE HeightField<OBBRSS>::getNodeType() const;
529532

530533
template <>
531-
NODE_TYPE HeightField<KDOP<16> >::getNodeType() const;
534+
NODE_TYPE HeightField<KDOP<16>>::getNodeType() const;
532535

533536
template <>
534-
NODE_TYPE HeightField<KDOP<18> >::getNodeType() const;
537+
NODE_TYPE HeightField<KDOP<18>>::getNodeType() const;
535538

536539
template <>
537-
NODE_TYPE HeightField<KDOP<24> >::getNodeType() const;
540+
NODE_TYPE HeightField<KDOP<24>>::getNodeType() const;
538541

539542
/// @}
540543

include/hpp/fcl/math/transform.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
#ifndef HPP_FCL_TRANSFORM_H
3939
#define HPP_FCL_TRANSFORM_H
4040

41-
#include <hpp/fcl/fwd.hh>
42-
#include <hpp/fcl/data_types.h>
41+
#include "hpp/fcl/fwd.hh"
42+
#include "hpp/fcl/data_types.h"
43+
#include "hpp/fcl/serialization/serializable.h"
4344

4445
namespace hpp {
4546
namespace fcl {
@@ -53,7 +54,8 @@ static inline std::ostream& operator<<(std::ostream& o, const Quatf& q) {
5354
}
5455

5556
/// @brief Simple transform class used locally by InterpMotion
56-
class HPP_FCL_DLLAPI Transform3f {
57+
class HPP_FCL_DLLAPI Transform3f
58+
: public ::hpp::fcl::serialization::Serializable<Transform3f> {
5759
/// @brief Matrix cache
5860
Matrix3f R;
5961

0 commit comments

Comments
 (0)