coal 3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
Loading...
Searching...
No Matches
fwd.h
Go to the documentation of this file.
1//
2// Copyright (c) 2021-2024 INRIA
3//
4
5#ifndef COAL_SERIALIZATION_FWD_H
6#define COAL_SERIALIZATION_FWD_H
7
8#include <type_traits>
9
10#include <boost/archive/text_iarchive.hpp>
11#include <boost/archive/text_oarchive.hpp>
12#include <boost/archive/xml_iarchive.hpp>
13#include <boost/archive/xml_oarchive.hpp>
14#include <boost/archive/binary_iarchive.hpp>
15#include <boost/archive/binary_oarchive.hpp>
16
17#include <boost/serialization/split_free.hpp>
18#include <boost/serialization/shared_ptr.hpp>
19#include <boost/serialization/export.hpp>
20
21#include "coal/fwd.hh"
23
24#define COAL_SERIALIZATION_SPLIT(Type) \
25 template <class Archive> \
26 void serialize(Archive& ar, Type& value, const unsigned int version) { \
27 split_free(ar, value, version); \
28 }
29
30#define COAL_SERIALIZATION_DECLARE_EXPORT(T) \
31 BOOST_CLASS_EXPORT_KEY(T) \
32 namespace boost { \
33 namespace archive { \
34 namespace detail { \
35 namespace extra_detail { \
36 template <> \
37 struct init_guid<T> { \
38 static guid_initializer<T> const& g; \
39 }; \
40 } \
41 } \
42 } \
43 } \
44
45
46#define COAL_SERIALIZATION_DEFINE_EXPORT(T) \
47 namespace boost { \
48 namespace archive { \
49 namespace detail { \
50 namespace extra_detail { \
51 guid_initializer<T> const& init_guid<T>::g = \
52 ::boost::serialization::singleton< \
53 guid_initializer<T> >::get_mutable_instance() \
54 .export_guid(); \
55 } \
56 } \
57 } \
58 } \
59
60
61namespace coal {
62namespace serialization {
63namespace detail {
64
65template <class Derived, class Base>
67
68template <class Derived, class Base>
70 void init(std::true_type) const {
71 boost::serialization::void_cast_register<Derived, Base>();
72 }
73
74 void init(std::false_type) const {}
75
78 _Pragma("GCC diagnostic ignored \"-Wconversion\"")
79 BOOST_STATIC_WARNING((std::is_base_of<Base, Derived>::value));
81 init(std::is_base_of<Base, Derived>());
82 return *this;
83 }
84};
85
86} // namespace detail
87
88template <typename T>
90 template <class Archive>
91 static void on(Archive& /*ar*/) {}
92};
93} // namespace serialization
94} // namespace coal
95
96#define COAL_SERIALIZATION_CAST_REGISTER(Derived, Base) \
97 namespace coal { \
98 namespace serialization { \
99 namespace detail { \
100 template <> \
101 struct init_cast_register<Derived, Base> { \
102 static cast_register_initializer<Derived, Base> const& g; \
103 }; \
104 cast_register_initializer<Derived, Base> const& init_cast_register< \
105 Derived, Base>::g = \
106 ::boost::serialization::singleton< \
107 cast_register_initializer<Derived, Base> >::get_mutable_instance() \
108 .init(); \
109 } \
110 } \
111 }
112
113#endif // ifndef COAL_SERIALIZATION_FWD_H
#define COAL_COMPILER_DIAGNOSTIC_PUSH
Definition fwd.hh:119
#define COAL_COMPILER_DIAGNOSTIC_POP
Definition fwd.hh:120
Main namespace.
Definition broadphase_bruteforce.h:44
void init(std::true_type) const
Definition fwd.h:70
cast_register_initializer const & init() const
Definition fwd.h:76
void init(std::false_type) const
Definition fwd.h:74
static void on(Archive &)
Definition fwd.h:91