mirror of
https://github.com/boostorg/mpi.git
synced 2026-02-25 04:22:17 +00:00
Fixed trac issue 3261
[SVN r55438]
This commit is contained in:
@@ -65,6 +65,13 @@ BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::tracking_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_name_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(serialization::collection_size_type)
|
||||
|
||||
void load_override(std::string & s , int)
|
||||
{
|
||||
serialization::collection_size_type length(s.size());
|
||||
load_override(length,0);
|
||||
s.resize(length);
|
||||
}
|
||||
|
||||
#undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION
|
||||
protected:
|
||||
/// the actual archive used to serialize the information we actually want to store
|
||||
|
||||
@@ -66,6 +66,11 @@ BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::tracking_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_name_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(serialization::collection_size_type)
|
||||
|
||||
void save_override(std::string const & t , int)
|
||||
{
|
||||
save_override(serialization::collection_size_type(t.size()),0);
|
||||
}
|
||||
|
||||
|
||||
#undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION
|
||||
protected:
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
/// don't do anything when loading primitive types
|
||||
template<class T>
|
||||
void load(T & t)
|
||||
{
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ public:
|
||||
|
||||
/// don't do anything when saving binary data
|
||||
void save_binary(const void *, std::size_t )
|
||||
{
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
/// don't do anything when saving arrays
|
||||
template<class T>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/oserializer.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
|
||||
namespace boost { namespace mpi { namespace detail {
|
||||
|
||||
@@ -60,6 +61,12 @@ BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::tracking_type)
|
||||
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_name_type)
|
||||
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::collection_size_type)
|
||||
|
||||
void save_override(std::string const & s, int)
|
||||
{
|
||||
if (s.size())
|
||||
save_override(serialization::make_array(s.data(),s.size()),0);
|
||||
}
|
||||
|
||||
#undef BOOST_ARCHIVE_IGNORE_IMPLEMENTATION
|
||||
};
|
||||
|
||||
|
||||
@@ -97,15 +97,15 @@ public:
|
||||
s.resize(l);
|
||||
// note breaking a rule here - could be a problem on some platform
|
||||
load_impl(const_cast<char *>(s.data()),MPI_CHAR,l);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void load_impl(void * p, MPI_Datatype t, int l)
|
||||
{
|
||||
{
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Unpack,
|
||||
(const_cast<char*>(boost::serialization::detail::get_data(buffer_)), buffer_.size(), &position, p, l, t, comm));
|
||||
}
|
||||
}
|
||||
|
||||
buffer_type & buffer_;
|
||||
mutable std::size_t size_;
|
||||
|
||||
@@ -77,12 +77,12 @@ public:
|
||||
save_impl(&t, get_mpi_datatype<T>(t), 1);
|
||||
}
|
||||
|
||||
void save(const std::string &s)
|
||||
{
|
||||
void save(const std::string &s)
|
||||
{
|
||||
unsigned int l = static_cast<unsigned int>(s.size());
|
||||
save(l);
|
||||
save_impl(s.data(),MPI_CHAR,s.size());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user