Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
any_poly.h
Go to the documentation of this file.
1
26#ifndef TESSERACT_COMMON_ANY_POLY_H
27#define TESSERACT_COMMON_ANY_POLY_H
30#include <boost/serialization/base_object.hpp>
31#include <boost/serialization/export.hpp>
32#include <boost/concept_check.hpp>
34
37
39#define TESSERACT_ANY_EXPORT_KEY(N, C) \
40 namespace N \
41 { \
42 using C##AnyInstanceBase = tesseract_common::TypeErasureInstance<C, tesseract_common::TypeErasureInterface>; \
43 using C##AnyInstance = tesseract_common::detail_any::AnyInstance<C>; \
44 using C##AnyInstanceWrapper = tesseract_common::TypeErasureInstanceWrapper<C##AnyInstance>; \
45 } \
46 BOOST_CLASS_EXPORT_KEY(N::C##AnyInstanceBase) \
47 BOOST_CLASS_EXPORT_KEY(N::C##AnyInstance) \
48 BOOST_CLASS_EXPORT_KEY(N::C##AnyInstanceWrapper) \
49 BOOST_CLASS_TRACKING(N::C##AnyInstanceBase, boost::serialization::track_never) \
50 BOOST_CLASS_TRACKING(N::C##AnyInstance, boost::serialization::track_never) \
51 BOOST_CLASS_TRACKING(N::C##AnyInstanceWrapper, boost::serialization::track_never)
52
54#define TESSERACT_ANY_EXPORT_IMPLEMENT(inst) \
55 BOOST_CLASS_EXPORT_IMPLEMENT(inst##AnyInstanceBase) \
56 BOOST_CLASS_EXPORT_IMPLEMENT(inst##AnyInstance) \
57 BOOST_CLASS_EXPORT_IMPLEMENT(inst##AnyInstanceWrapper)
58
63#define TESSERACT_ANY_EXPORT(N, C) \
64 TESSERACT_ANY_EXPORT_KEY(N, C) \
65 TESSERACT_ANY_EXPORT_IMPLEMENT(N::C)
66
68{
69template <typename A>
70struct AnyConcept // NOLINT
71 : boost::Assignable<A>,
72 boost::CopyConstructible<A>,
73 boost::EqualityComparable<A>
74{
76 {
77 A cp(c);
78 A assign = c;
79 bool eq = (c == cp);
80 bool neq = (c != cp);
81 UNUSED(eq);
82 UNUSED(neq);
83 }
84
85private:
86 A c;
87};
88
89template <typename T>
90struct AnyInstance : tesseract_common::TypeErasureInstance<T, tesseract_common::TypeErasureInterface> // NOLINT
91{
93 AnyInstance() = default;
94 AnyInstance(const T& x) : BaseType(x) {}
95 AnyInstance(AnyInstance&& x) noexcept : BaseType(std::move(x)) {}
96
98
99private:
102 template <class Archive>
103 void serialize(Archive& ar, const unsigned int /*version*/) // NOLINT
104 {
105 ar& boost::serialization::make_nvp("base", boost::serialization::base_object<BaseType>(*this));
106 }
107};
108} // namespace tesseract_common::detail_any
109
110namespace tesseract_common
111{
113
115{
116 using AnyPolyBase::AnyPolyBase;
117
118private:
121
122 template <class Archive>
123 void serialize(Archive& ar, const unsigned int /*version*/); // NOLINT
124};
125
126} // namespace tesseract_common
127
128BOOST_CLASS_EXPORT_KEY(tesseract_common::AnyPolyBase)
129BOOST_CLASS_TRACKING(tesseract_common::AnyPolyBase, boost::serialization::track_never)
130
131BOOST_CLASS_EXPORT_KEY(tesseract_common::AnyPoly)
132BOOST_CLASS_TRACKING(tesseract_common::AnyPoly, boost::serialization::track_never)
133
134#endif // TESSERACT_COMMON_ANY_POLY_H
#define UNUSED(x)
Definition: VHACD.cpp:58
Definition: polygon_mesh.h:46
BOOST_CLASS_TRACKING(Eigen::VectorXd, boost::serialization::track_never)
Common Tesseract Macros.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
Definition: any_poly.h:68
Definition: allowed_collision_matrix.h:16
Definition: any_poly.h:115
void serialize(Archive &ar, const unsigned int)
Definition: any_poly.cpp:32
friend class boost::serialization::access
Definition: any_poly.h:119
Definition: serialization.h:90
Definition: type_erasure.h:134
Definition: type_erasure.h:67
BOOST_CONCEPT_USAGE(AnyConcept)
Definition: any_poly.h:75
void serialize(Archive &ar, const unsigned int)
Definition: any_poly.h:103
AnyInstance(AnyInstance &&x) noexcept
Definition: any_poly.h:95
tesseract_common::TypeErasureInstance< T, tesseract_common::TypeErasureInterface > BaseType
Definition: any_poly.h:92
AnyInstance(const T &x)
Definition: any_poly.h:94
friend class boost::serialization::access
Definition: any_poly.h:100
Additional Boost serialization wrappers.
Boilerplate code for creating type erasures.