Use load_construct_data for kernel objects
This commit is contained in:
parent
3ed8d95866
commit
6917eaf53b
35 changed files with 158 additions and 113 deletions
|
@ -54,6 +54,7 @@ add_custom_command(OUTPUT scm_rev.cpp
|
|||
add_library(common STATIC
|
||||
alignment.h
|
||||
announce_multiplayer_room.h
|
||||
archives.h
|
||||
assert.h
|
||||
detached_tasks.cpp
|
||||
detached_tasks.h
|
||||
|
@ -66,6 +67,7 @@ add_library(common STATIC
|
|||
common_funcs.h
|
||||
common_paths.h
|
||||
common_types.h
|
||||
construct.h
|
||||
file_util.cpp
|
||||
file_util.h
|
||||
hash.h
|
||||
|
@ -91,8 +93,10 @@ add_library(common STATIC
|
|||
scm_rev.h
|
||||
scope_exit.h
|
||||
serialization/atomic.h
|
||||
serialization/boost_discrete_interval.hpp
|
||||
serialization/boost_flat_set.h
|
||||
serialization/boost_vector.hpp
|
||||
serialization/optional.h
|
||||
string_util.cpp
|
||||
string_util.h
|
||||
swap.h
|
||||
|
|
|
@ -6,12 +6,12 @@ using iarchive = boost::archive::binary_iarchive;
|
|||
using oarchive = boost::archive::binary_oarchive;
|
||||
|
||||
#define SERIALIZE_IMPL(A) template void A::serialize<iarchive>( \
|
||||
iarchive & ar, \
|
||||
const unsigned int file_version \
|
||||
); \
|
||||
template void A::serialize<oarchive>( \
|
||||
oarchive & ar, \
|
||||
const unsigned int file_version \
|
||||
iarchive & ar, \
|
||||
const unsigned int file_version \
|
||||
); \
|
||||
template void A::serialize<oarchive>( \
|
||||
oarchive & ar, \
|
||||
const unsigned int file_version \
|
||||
);
|
||||
|
||||
#define SERIALIZE_EXPORT_IMPL(A) \
|
||||
|
|
|
@ -12,20 +12,18 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#define BOOST_SERIALIZATION_CONSTRUCT(T) \
|
||||
namespace boost { namespace serialization { \
|
||||
\
|
||||
template<class Archive> \
|
||||
inline void save_construct_data( \
|
||||
Archive & ar, const T * t, const unsigned int file_version \
|
||||
){ \
|
||||
construct_access::save_construct(ar, t, file_version); \
|
||||
} \
|
||||
\
|
||||
template<class Archive> \
|
||||
inline void load_construct_data( \
|
||||
Archive & ar, T * t, const unsigned int file_version \
|
||||
){ \
|
||||
construct_access::load_construct(ar, t, file_version); \
|
||||
} \
|
||||
#define BOOST_SERIALIZATION_CONSTRUCT(T) \
|
||||
namespace boost { namespace serialization { \
|
||||
template<class Archive> \
|
||||
inline void save_construct_data( \
|
||||
Archive & ar, const T * t, const unsigned int file_version \
|
||||
){ \
|
||||
construct_access::save_construct(ar, t, file_version); \
|
||||
} \
|
||||
template<class Archive> \
|
||||
inline void load_construct_data( \
|
||||
Archive & ar, T * t, const unsigned int file_version \
|
||||
){ \
|
||||
construct_access::load_construct(ar, t, file_version); \
|
||||
} \
|
||||
}}
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
#include <atomic>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
|
||||
namespace boost::serialization
|
||||
namespace boost::serialization {
|
||||
|
||||
template <class Archive, class T>
|
||||
void serialize(Archive& ar, std::atomic<T>& value, const unsigned int file_version)
|
||||
{
|
||||
template <class Archive, class T>
|
||||
void serialize(Archive& ar, std::atomic<T>& value, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, value, file_version);
|
||||
}
|
||||
boost::serialization::split_free(ar, value, file_version);
|
||||
}
|
||||
|
||||
template <class Archive, class T>
|
||||
void save(Archive& ar, const std::atomic<T>& value, const unsigned int file_version)
|
||||
{
|
||||
ar << value.load();
|
||||
}
|
||||
template <class Archive, class T>
|
||||
void save(Archive& ar, const std::atomic<T>& value, const unsigned int file_version)
|
||||
{
|
||||
ar << value.load();
|
||||
}
|
||||
|
||||
template <class Archive, class T>
|
||||
void load(Archive& ar, std::atomic<T>& value, const unsigned int file_version)
|
||||
{
|
||||
T tmp;
|
||||
ar >> tmp;
|
||||
value.store(tmp);
|
||||
}
|
||||
template <class Archive, class T>
|
||||
void load(Archive& ar, std::atomic<T>& value, const unsigned int file_version)
|
||||
{
|
||||
T tmp;
|
||||
ar >> tmp;
|
||||
value.store(tmp);
|
||||
}
|
||||
|
||||
} // namespace boost::serialization
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue