mirror of
https://github.com/boostorg/mpi.git
synced 2026-01-19 04:22:10 +00:00
Attempted workaround to breaking changes in Boost.Serialization and removed any remaining dependence on binary archives
[SVN r64343]
This commit is contained in:
@@ -339,8 +339,8 @@ BOOST_MPI_DATATYPE(boost::archive::class_id_optional_type, get_mpi_datatype(int_
|
||||
BOOST_MPI_DATATYPE(boost::archive::object_id_type, get_mpi_datatype(uint_least32_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::object_reference_type, get_mpi_datatype(uint_least32_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::tracking_type, get_mpi_datatype(bool()), builtin);
|
||||
BOOST_MPI_DATATYPE(boost::serialization::collection_size_type, get_mpi_datatype(std::size_t()), builtin);
|
||||
BOOST_MPI_DATATYPE(boost::serialization::item_version_type, get_mpi_datatype(uint_least8_t()), builtin);
|
||||
BOOST_MPI_DATATYPE(boost::serialization::collection_size_type, get_mpi_datatype(std::size_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::serialization::item_version_type, get_mpi_datatype(uint_least8_t()), integer);
|
||||
|
||||
#endif // Doxygen
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@ template<typename T> struct is_mpi_logical_datatype;
|
||||
template<typename T> struct is_mpi_complex_datatype;
|
||||
template<typename T> struct is_mpi_byte_datatype;
|
||||
template<typename T> struct is_mpi_datatype;
|
||||
template<typename T> MPI_Datatype get_mpi_datatype(const T& x = T());
|
||||
template<typename T> MPI_Datatype get_mpi_datatype(const T& x);
|
||||
template<typename T> MPI_Datatype get_mpi_datatype()
|
||||
{ return get_mpi_datatype(T());}
|
||||
|
||||
/// a dummy data type giving MPI_PACKED as its MPI_Datatype
|
||||
struct packed {};
|
||||
|
||||
@@ -20,10 +20,13 @@
|
||||
|
||||
#include <boost/mpi/datatype.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/basic_binary_iarchive.hpp>
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
#include <boost/mpi/detail/packed_iprimitive.hpp>
|
||||
#include <boost/mpi/detail/binary_buffer_iprimitive.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
@@ -44,7 +47,7 @@ namespace boost { namespace mpi {
|
||||
*/
|
||||
class BOOST_MPI_DECL packed_iarchive
|
||||
: public iprimitive
|
||||
, public archive::basic_binary_iarchive<packed_iarchive>
|
||||
, public archive::detail::common_iarchive<packed_iarchive>
|
||||
, public archive::detail::shared_ptr_helper
|
||||
{
|
||||
public:
|
||||
@@ -67,7 +70,7 @@ public:
|
||||
*/
|
||||
packed_iarchive(MPI_Comm const & comm, buffer_type & b, unsigned int flags = boost::archive::no_header, int position = 0)
|
||||
: iprimitive(b,comm,position),
|
||||
archive::basic_binary_iarchive<packed_iarchive>(flags)
|
||||
archive::detail::common_iarchive<packed_iarchive>(flags)
|
||||
{}
|
||||
|
||||
/**
|
||||
@@ -87,7 +90,7 @@ public:
|
||||
( MPI_Comm const & comm , std::size_t s=0,
|
||||
unsigned int flags = boost::archive::no_header)
|
||||
: iprimitive(internal_buffer_,comm)
|
||||
, archive::basic_binary_iarchive<packed_iarchive>(flags)
|
||||
, archive::detail::common_iarchive<packed_iarchive>(flags)
|
||||
, internal_buffer_(s)
|
||||
{}
|
||||
|
||||
@@ -95,7 +98,7 @@ public:
|
||||
template<class T>
|
||||
void load_override(T& x, int version, mpl::false_)
|
||||
{
|
||||
archive::basic_binary_iarchive<packed_iarchive>::load_override(x,version);
|
||||
archive::detail::common_iarchive<packed_iarchive>::load_override(x,version);
|
||||
}
|
||||
|
||||
// Load it directly using the primnivites
|
||||
@@ -115,6 +118,16 @@ public:
|
||||
load_override(x, version, use_optimized());
|
||||
}
|
||||
|
||||
void load_override(archive::class_name_type & t, int)
|
||||
{
|
||||
std::string cn;
|
||||
cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
|
||||
* this->This() >> cn;
|
||||
std::memcpy(t, cn.data(), cn.size());
|
||||
// borland tweak
|
||||
t.t[cn.size()] = '\0';
|
||||
}
|
||||
|
||||
private:
|
||||
/// An internal buffer to be used when the user does not supply his
|
||||
/// own buffer.
|
||||
|
||||
@@ -20,9 +20,12 @@
|
||||
|
||||
#include <boost/mpi/datatype.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/basic_binary_oarchive.hpp>
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
#include <boost/mpi/detail/packed_oprimitive.hpp>
|
||||
#include <boost/mpi/detail/binary_buffer_oprimitive.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
|
||||
@@ -43,7 +46,7 @@ namespace boost { namespace mpi {
|
||||
|
||||
class BOOST_MPI_DECL packed_oarchive
|
||||
: public oprimitive,
|
||||
public archive::basic_binary_oarchive<packed_oarchive>
|
||||
public archive::detail::common_oarchive<packed_oarchive>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -62,7 +65,7 @@ public:
|
||||
*/
|
||||
packed_oarchive( MPI_Comm const & comm, buffer_type & b, unsigned int flags = boost::archive::no_header)
|
||||
: oprimitive(b,comm),
|
||||
archive::basic_binary_oarchive<packed_oarchive>(flags)
|
||||
archive::detail::common_oarchive<packed_oarchive>(flags)
|
||||
{}
|
||||
|
||||
/**
|
||||
@@ -78,14 +81,14 @@ public:
|
||||
*/
|
||||
packed_oarchive ( MPI_Comm const & comm, unsigned int flags = boost::archive::no_header)
|
||||
: oprimitive(internal_buffer_,comm),
|
||||
archive::basic_binary_oarchive<packed_oarchive>(flags)
|
||||
archive::detail::common_oarchive<packed_oarchive>(flags)
|
||||
{}
|
||||
|
||||
// Save everything else in the usual way, forwarding on to the Base class
|
||||
template<class T>
|
||||
void save_override(T const& x, int version, mpl::false_)
|
||||
{
|
||||
archive::basic_binary_oarchive<packed_oarchive>::save_override(x,version);
|
||||
archive::detail::common_oarchive<packed_oarchive>::save_override(x,version);
|
||||
}
|
||||
|
||||
// Save it directly using the primnivites
|
||||
@@ -103,6 +106,12 @@ public:
|
||||
save_override(x, version, use_optimized());
|
||||
}
|
||||
|
||||
// explicitly convert to char * to avoid compile ambiguities
|
||||
void save_override(const archive::class_name_type & t, int){
|
||||
const std::string s(t);
|
||||
* this->This() << s;
|
||||
}
|
||||
|
||||
private:
|
||||
/// An internal buffer to be used when the user does not supply his
|
||||
/// own buffer.
|
||||
|
||||
@@ -11,15 +11,11 @@
|
||||
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
#include <boost/archive/binary_iarchive.hpp>
|
||||
#include <boost/archive/impl/basic_binary_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_iarchive.ipp>
|
||||
|
||||
namespace boost { namespace archive {
|
||||
|
||||
// explicitly instantiate all required templates
|
||||
|
||||
template class basic_binary_iarchive<mpi::packed_iarchive> ;
|
||||
template class detail::archive_serializer_map<mpi::packed_iarchive> ;
|
||||
|
||||
} } // end namespace boost::archive
|
||||
|
||||
@@ -8,17 +8,12 @@
|
||||
|
||||
#define BOOST_ARCHIVE_SOURCE
|
||||
#include <boost/mpi/packed_oarchive.hpp>
|
||||
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#include <boost/archive/impl/basic_binary_oprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oarchive.ipp>
|
||||
|
||||
namespace boost { namespace archive {
|
||||
// explicitly instantiate all required templates
|
||||
|
||||
template class detail::archive_serializer_map<mpi::packed_oarchive> ;
|
||||
template class basic_binary_oarchive<mpi::packed_oarchive> ;
|
||||
|
||||
} } // end namespace boost::archive
|
||||
|
||||
@@ -10,22 +10,16 @@
|
||||
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
|
||||
#include <boost/mpi/skeleton_and_content.hpp>
|
||||
|
||||
#include <boost/archive/binary_iarchive.hpp>
|
||||
#include <boost/archive/impl/basic_binary_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_iarchive.ipp>
|
||||
|
||||
namespace boost { namespace archive {
|
||||
|
||||
// explicitly instantiate all required templates
|
||||
|
||||
template class basic_binary_iarchive<mpi::packed_skeleton_iarchive> ;
|
||||
// template class basic_binary_iarchive<mpi::packed_skeleton_iarchive> ;
|
||||
template class detail::archive_serializer_map<mpi::packed_skeleton_iarchive> ;
|
||||
template class detail::archive_serializer_map<
|
||||
mpi::detail::forward_skeleton_iarchive<
|
||||
boost::mpi::packed_skeleton_iarchive, boost::mpi::packed_iarchive> > ;
|
||||
//template class binary_iarchive_impl<packed_skeleton_iarchive> ;
|
||||
|
||||
} } // end namespace boost::archive
|
||||
|
||||
@@ -8,12 +8,8 @@
|
||||
|
||||
#define BOOST_ARCHIVE_SOURCE
|
||||
#include <boost/mpi/skeleton_and_content.hpp>
|
||||
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#include <boost/archive/impl/basic_binary_oprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oarchive.ipp>
|
||||
|
||||
namespace boost { namespace archive {
|
||||
// explicitly instantiate all required templates
|
||||
@@ -22,7 +18,5 @@ template class detail::archive_serializer_map<mpi::packed_skeleton_oarchive> ;
|
||||
template class detail::archive_serializer_map<
|
||||
mpi::detail::forward_skeleton_oarchive<
|
||||
boost::mpi::packed_skeleton_oarchive, boost::mpi::packed_oarchive> > ;
|
||||
template class basic_binary_oarchive<mpi::packed_skeleton_oarchive> ;
|
||||
//template class binary_oarchive_impl<mpi_packed_oarchive> ;
|
||||
|
||||
} } // end namespace boost::archive
|
||||
|
||||
@@ -11,13 +11,10 @@
|
||||
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#include <boost/archive/impl/basic_binary_oprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oarchive.ipp>
|
||||
|
||||
namespace boost { namespace archive {
|
||||
// explicitly instantiate all required templates
|
||||
|
||||
template class detail::archive_serializer_map<text_oarchive>;
|
||||
// template class detail::archive_serializer_map<text_oarchive>;
|
||||
|
||||
} } // end namespace boost::archive
|
||||
|
||||
Reference in New Issue
Block a user