Support serialization in DLLS

Make thread-safe
fix portable binary archives

[SVN r43693]
This commit is contained in:
Robert Ramey
2008-03-18 05:52:10 +00:00
parent 0530d1fcaa
commit b3c87d2dfa
2 changed files with 7 additions and 19 deletions

View File

@@ -8,17 +8,16 @@
#include <boost/archive/basic_archive.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/pfto.hpp>
//#include <boost/archive/archive_exception.hpp>
namespace boost { namespace archive { namespace array {
@@ -51,8 +50,8 @@ public:
{}
// save_override for std::vector and serialization::array dispatches to
// save_optimized with an additional argument.
// load_override for std::vector and serialization::array dispatches to
// load_optimized with an additional argument.
//
// If that argument is of type mpl::true_, an optimized serialization is provided
// If it is false, we just forward to the default serialization in the base class
@@ -65,9 +64,9 @@ public:
}
// the optimized implementation for vector uses serialization::array
template<class U, class Allocator>
template<class ValueType, class Allocator>
void load_optimized(
std::vector<U, Allocator> &t, unsigned int version, mpl::true_)
std::vector<ValueType, Allocator> &t, unsigned int version, mpl::true_)
{
t.clear();
// retrieve number of elements
@@ -86,7 +85,6 @@ public:
this->This()->load_array(t,version);
}
// to load a vector:
// if the value type is trivially constructable or an optimized array save exists,
// then we can use the optimized version
@@ -103,7 +101,6 @@ public:
load_optimized(x,version, use_optimized() );
}
// dispatch loading of arrays to the optimized version where supported
template<class ValueType>
void load_override(serialization::array<ValueType> const& x, unsigned int version)
@@ -123,10 +120,7 @@ public:
}
};
} } } // end namespace boost::archive::array
#endif // BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP

View File

@@ -13,11 +13,11 @@
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/pfto.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace archive { namespace array {
@@ -63,7 +63,6 @@ public:
Base::save_override(t, version);
}
// the optimized implementation for vector uses serialization::array
template<class ValueType, class Allocator>
void save_optimized(
@@ -83,7 +82,6 @@ public:
this->This()->save_array(t,version);
}
// to save a vector:
// if the value type is trivially constructable or an optimized array save exists,
// then we can use the optimized version
@@ -100,8 +98,6 @@ public:
>::type use_optimized;
save_optimized(x,version,use_optimized() );
}
// dispatch saving of arrays to the optimized version where supported
template<class ValueType>
@@ -125,6 +121,4 @@ public:
} } } // end namespace boost::archive::array
#endif // BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP