|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66785 - in trunk/boost/mpi: . detail
From: troyer_at_[hidden]
Date: 2010-11-27 07:40:33
Author: troyer
Date: 2010-11-27 07:40:31 EST (Sat, 27 Nov 2010)
New Revision: 66785
URL: http://svn.boost.org/trac/boost/changeset/66785
Log:
Fixed tickets #4693 and #4772
Text files modified:
trunk/boost/mpi/detail/binary_buffer_iprimitive.hpp | 3 ++-
trunk/boost/mpi/packed_iarchive.hpp | 33 ++++++++++++++++-----------------
trunk/boost/mpi/packed_oarchive.hpp | 33 ++++++++++++++++++++-------------
3 files changed, 38 insertions(+), 31 deletions(-)
Modified: trunk/boost/mpi/detail/binary_buffer_iprimitive.hpp
==============================================================================
--- trunk/boost/mpi/detail/binary_buffer_iprimitive.hpp (original)
+++ trunk/boost/mpi/detail/binary_buffer_iprimitive.hpp 2010-11-27 07:40:31 EST (Sat, 27 Nov 2010)
@@ -107,7 +107,8 @@
void load_impl(void * p, int l)
{
assert(position+l<=static_cast<int>(buffer_.size()));
- std::memcpy(p,&buffer_[position],l);
+ if (l)
+ std::memcpy(p,&buffer_[position],l);
position += l;
}
Modified: trunk/boost/mpi/packed_iarchive.hpp
==============================================================================
--- trunk/boost/mpi/packed_iarchive.hpp (original)
+++ trunk/boost/mpi/packed_iarchive.hpp 2010-11-27 07:40:31 EST (Sat, 27 Nov 2010)
@@ -37,14 +37,16 @@
typedef packed_iprimitive iprimitive;
#endif
-/** @brief An archive that packs binary data into an MPI buffer.
+
+/** @brief An archive that unpacks binary data from an MPI buffer.
*
- * The @c packed_iarchive class is an Archiver (as in the
- * Boost.Serialization library) that packs binary data into a buffer
- * for transmission via MPI. It can operate on any Serializable data
- * type and will use the @c MPI_Pack function of the underlying MPI
- * implementation to perform serialization.
+ * The @c packed_oarchive class is an Archiver (as in the
+ * Boost.Serialization library) that unpacks binary data from a
+ * buffer received via MPI. It can operate on any Serializable data
+ * type and will use the @c MPI_Unpack function of the underlying MPI
+ * implementation to perform deserialization.
*/
+
class BOOST_MPI_DECL packed_iarchive
: public iprimitive
, public archive::detail::common_iarchive<packed_iarchive>
@@ -52,40 +54,37 @@
{
public:
/**
- * Construct a @c packed_iarchive for transmission over the given
+ * Construct a @c packed_iarchive to receive data over the given
* MPI communicator and with an initial buffer.
*
* @param comm The communicator over which this archive will be
- * sent.
+ * received.
*
- * @param b A user-defined buffer that will be filled with the
- * binary representation of serialized objects.
+ * @param b A user-defined buffer that contains the binary
+ * representation of serialized objects.
*
* @param flags Control the serialization of the data types. Refer
* to the Boost.Serialization documentation before changing the
* default flags.
- *
- * @param position Set the offset into buffer @p b at which
- * deserialization will begin.
*/
+
packed_iarchive(MPI_Comm const & comm, buffer_type & b, unsigned int flags = boost::archive::no_header, int position = 0)
: iprimitive(b,comm,position),
archive::detail::common_iarchive<packed_iarchive>(flags)
{}
/**
- * Construct a @c packed_iarchive for transmission over the given
+ * Construct a @c packed_iarchive to receive data over the given
* MPI communicator.
*
* @param comm The communicator over which this archive will be
- * sent.
- *
- * @param s The size of the buffer to be received.
+ * received.
*
* @param flags Control the serialization of the data types. Refer
* to the Boost.Serialization documentation before changing the
* default flags.
*/
+
packed_iarchive
( MPI_Comm const & comm , std::size_t s=0,
unsigned int flags = boost::archive::no_header)
Modified: trunk/boost/mpi/packed_oarchive.hpp
==============================================================================
--- trunk/boost/mpi/packed_oarchive.hpp (original)
+++ trunk/boost/mpi/packed_oarchive.hpp 2010-11-27 07:40:31 EST (Sat, 27 Nov 2010)
@@ -36,13 +36,13 @@
typedef packed_oprimitive oprimitive;
#endif
-/** @brief An archive that unpacks binary data from an MPI buffer.
+/** @brief An archive that packs binary data into an MPI buffer.
*
- * The @c packed_oarchive class is an Archiver (as in the
- * Boost.Serialization library) that unpacks binary data from a
- * buffer received via MPI. It can operate on any Serializable data
- * type and will use the @c MPI_Unpack function of the underlying MPI
- * implementation to perform deserialization.
+ * The @c packed_iarchive class is an Archiver (as in the
+ * Boost.Serialization library) that packs binary data into a buffer
+ * for transmission via MPI. It can operate on any Serializable data
+ * type and will use the @c MPI_Pack function of the underlying MPI
+ * implementation to perform serialization.
*/
class BOOST_MPI_DECL packed_oarchive
@@ -52,35 +52,42 @@
{
public:
/**
- * Construct a @c packed_oarchive to receive data over the given
+ * Construct a @c packed_oarchive for transmission over the given
* MPI communicator and with an initial buffer.
*
* @param comm The communicator over which this archive will be
- * received.
+ * sent.
*
- * @param b A user-defined buffer that contains the binary
- * representation of serialized objects.
+ * @param b A user-defined buffer that will be filled with the
+ * binary representation of serialized objects.
*
* @param flags Control the serialization of the data types. Refer
* to the Boost.Serialization documentation before changing the
* default flags.
+ *
+ * @param position Set the offset into buffer @p b at which
+ * deserialization will begin.
*/
+
packed_oarchive( MPI_Comm const & comm, buffer_type & b, unsigned int flags = boost::archive::no_header)
: oprimitive(b,comm),
archive::detail::common_oarchive<packed_oarchive>(flags)
{}
/**
- * Construct a @c packed_oarchive to receive data over the given
+ * Construct a @c packed_oarchive for transmission over the given
* MPI communicator.
*
* @param comm The communicator over which this archive will be
- * received.
+ * sent.
+ *
+ * @param s The size of the buffer to be received.
*
* @param flags Control the serialization of the data types. Refer
* to the Boost.Serialization documentation before changing the
* default flags.
*/
+
packed_oarchive ( MPI_Comm const & comm, unsigned int flags = boost::archive::no_header)
: oprimitive(internal_buffer_,comm),
archive::detail::common_oarchive<packed_oarchive>(flags)
@@ -93,7 +100,7 @@
archive::detail::common_oarchive<packed_oarchive>::save_override(x,version);
}
- // Save it directly using the primnivites
+ // Save it directly using the primitives
template<class T>
void save_override(T const& x, int /*version*/, mpl::true_)
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk