coal/serialization/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 
61 namespace coal {
62 namespace serialization {
63 namespace detail {
64 
65 template <class Derived, class Base>
67 
68 template <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 
88 template <typename T>
89 struct register_type {
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
eigen.h
coal::serialization::detail::cast_register_initializer::init
cast_register_initializer const & init() const
Definition: coal/serialization/fwd.h:76
coal::serialization::detail::cast_register_initializer::init
void init(std::true_type) const
Definition: coal/serialization/fwd.h:70
COAL_COMPILER_DIAGNOSTIC_PUSH
#define COAL_COMPILER_DIAGNOSTIC_PUSH
Definition: include/coal/fwd.hh:120
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
coal::serialization::register_type::on
static void on(Archive &)
Definition: coal/serialization/fwd.h:91
fwd.hh
coal::serialization::detail::cast_register_initializer
Definition: coal/serialization/fwd.h:69
COAL_COMPILER_DIAGNOSTIC_POP
#define COAL_COMPILER_DIAGNOSTIC_POP
Definition: include/coal/fwd.hh:121
coal::serialization::detail::init_cast_register
Definition: coal/serialization/fwd.h:66
coal::serialization::register_type
Definition: coal/serialization/fwd.h:89
coal::serialization::detail::cast_register_initializer::init
void init(std::false_type) const
Definition: coal/serialization/fwd.h:74


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58