Chris@16: // (C) Copyright 2005 Matthias Troyer Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // Authors: Matthias Troyer Chris@16: Chris@16: #ifndef BOOST_MPI_DETAIL_CONTENT_OARCHIVE_HPP Chris@16: #define BOOST_MPI_DETAIL_CONTENT_OARCHIVE_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace mpi { Chris@16: Chris@16: namespace detail { Chris@16: // an archive wrapper that stores only the data members but not the Chris@16: // special types defined by the serialization library Chris@16: // to define the data skeletons (classes, pointers, container sizes, ...) Chris@16: Chris@16: class BOOST_MPI_DECL content_oarchive Chris@16: : public mpi_datatype_primitive, Chris@16: public ignore_skeleton_oarchive Chris@16: { Chris@16: public: Chris@16: content_oarchive() Chris@16: : committed(false) Chris@16: {} Chris@16: Chris@16: content get_content() Chris@16: { Chris@16: if (!committed) Chris@16: { Chris@16: // create the content holder only once Chris@16: c=this->get_mpi_datatype(); Chris@16: committed=true; Chris@16: } Chris@16: return c; Chris@16: } Chris@16: Chris@16: private: Chris@16: bool committed; Chris@16: content c; Chris@16: }; Chris@16: } // end namespace detail Chris@16: Chris@16: template Chris@16: const content get_content(const T& x) Chris@16: { Chris@16: detail::content_oarchive ar; Chris@16: ar << x; Chris@16: return ar.get_content(); Chris@16: } Chris@16: Chris@16: } } // end namespace boost::mpi Chris@16: Chris@16: // required by export Chris@16: BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::content_oarchive) Chris@16: BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::ignore_skeleton_oarchive) Chris@16: BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::mpi::detail::content_oarchive) Chris@16: #endif // BOOST_MPI_DETAIL_CONTENT_OARCHIVE_HPP