Line |
Branch |
Exec |
Source |
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" |
22 |
|
|
#include "coal/serialization/eigen.h" |
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> |
66 |
|
|
struct init_cast_register {}; |
67 |
|
|
|
68 |
|
|
template <class Derived, class Base> |
69 |
|
|
struct cast_register_initializer { |
70 |
|
864 |
void init(std::true_type) const { |
71 |
|
864 |
boost::serialization::void_cast_register<Derived, Base>(); |
72 |
|
864 |
} |
73 |
|
|
|
74 |
|
|
void init(std::false_type) const {} |
75 |
|
|
|
76 |
|
432 |
cast_register_initializer const& init() const { |
77 |
|
|
COAL_COMPILER_DIAGNOSTIC_PUSH |
78 |
|
|
_Pragma("GCC diagnostic ignored \"-Wconversion\"") |
79 |
|
|
BOOST_STATIC_WARNING((std::is_base_of<Base, Derived>::value)); |
80 |
|
|
COAL_COMPILER_DIAGNOSTIC_POP |
81 |
|
432 |
init(std::is_base_of<Base, Derived>()); |
82 |
|
432 |
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 |
114 |
|
|
|