Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:57

0001 // (C) Copyright 2005 Matthias Troyer
0002 
0003 // Use, modification and distribution is subject to the Boost Software
0004 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 //  Authors: Matthias Troyer
0008 
0009 #ifndef BOOST_MPI_DETAIL_CONTENT_OARCHIVE_HPP
0010 #define BOOST_MPI_DETAIL_CONTENT_OARCHIVE_HPP
0011 
0012 #include <boost/archive/detail/auto_link_archive.hpp>
0013 #include <boost/archive/basic_archive.hpp>
0014 #include <boost/mpi/detail/ignore_skeleton_oarchive.hpp>
0015 #include <boost/mpi/detail/mpi_datatype_primitive.hpp>
0016 #include <boost/mpi/datatype.hpp>
0017 #include <boost/archive/detail/register_archive.hpp>
0018 
0019 namespace boost { namespace mpi {
0020 
0021 namespace detail {
0022   // an archive wrapper that stores only the data members but not the
0023   // special types defined by the serialization library
0024   // to define the data skeletons (classes, pointers, container sizes, ...)
0025 
0026   class BOOST_MPI_DECL content_oarchive
0027     : public mpi_datatype_primitive,
0028       public ignore_skeleton_oarchive<content_oarchive>
0029   {
0030   public:
0031       content_oarchive()
0032        : committed(false)
0033           {}
0034 
0035       content get_content()
0036       {
0037         if (!committed)
0038         {
0039           // create the content holder only once
0040           c=this->get_mpi_datatype();
0041           committed=true;
0042         }
0043         return c;
0044       }
0045 
0046   private:
0047     bool committed;
0048     content c;
0049   };
0050 } // end namespace detail
0051 
0052 template <class T>
0053 const content get_content(const T& x)
0054 {
0055   detail::content_oarchive ar;
0056   ar << x;
0057   return ar.get_content();
0058 }
0059 
0060 } } // end namespace boost::mpi
0061 
0062 // required by export
0063 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::content_oarchive)
0064 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::ignore_skeleton_oarchive<boost::mpi::detail::content_oarchive>)
0065 BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::mpi::detail::content_oarchive)
0066 #endif // BOOST_MPI_DETAIL_CONTENT_OARCHIVE_HPP