Files

100 lines
2.9 KiB
C++

// (C) Copyright Jeremy Siek 2006
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_PROPERTY_SERIALIZE_HPP
#define ACTIV_BOOST_PROPERTY_SERIALIZE_HPP
#include <ActivBoost/pending/property.hpp>
#include <ActivBoost/serialization/is_bitwise_serializable.hpp>
#include <ActivBoost/serialization/base_object.hpp>
#include <ActivBoost/serialization/nvp.hpp>
namespace Boost
{
template < class Archive >
inline void serialize(Archive&, no_property&, const unsigned int)
{
}
template < class Archive, class Tag, class T, class Base >
void serialize(
Archive& ar, property< Tag, T, Base >& prop, const unsigned int /*version*/)
{
ar& serialization::make_nvp("property_value", prop.m_value);
ar& serialization::make_nvp("property_base", prop.m_base);
}
#ifdef ACTIV_BOOST_GRAPH_USE_MPI
// Setting the serialization properties of Boost::property<> and
// Boost::no_property to is_bitwise_serializable, object_serializable,
// track_never only when ACTIV_BOOST_GRAPH_USE_MPI is defined is dubious.
//
// This changes the serialization format of these classes, and hence
// of Boost::adjacency_list, depending on whether ACTIV_BOOST_GRAPH_USE_MPI
// is defined.
//
// These serialization properties should probably be set in either case.
//
// Unfortunately, doing that now will change the serialization format
// of Boost::adjacency_list in the non-MPI case, and could potentially
// break software that reads files serialized with an older release.
namespace mpi
{
// forward declaration, to avoid including mpi
template < typename T > struct is_mpi_datatype;
template < typename Tag, typename T, typename Base >
struct is_mpi_datatype< property< Tag, T, Base > >
: mpl::and_< is_mpi_datatype< T >, is_mpi_datatype< Base > >
{
};
}
namespace serialization
{
template < typename Tag, typename T, typename Base >
struct is_bitwise_serializable< property< Tag, T, Base > >
: mpl::and_< is_bitwise_serializable< T >, is_bitwise_serializable< Base > >
{
};
template < typename Tag, typename T, typename Base >
struct implementation_level< property< Tag, T, Base > >
: mpl::int_< object_serializable >
{
};
template < typename Tag, typename T, typename Base >
struct tracking_level< property< Tag, T, Base > > : mpl::int_< track_never >
{
};
}
#endif // ACTIV_BOOST_GRAPH_USE_MPI
} // end namespace Boost
#ifdef ACTIV_BOOST_GRAPH_USE_MPI
namespace Boost
{
namespace mpi
{
template <> struct is_mpi_datatype< Boost::no_property > : mpl::true_
{
};
}
} // end namespace Boost::mpi
ACTIV_BOOST_IS_BITWISE_SERIALIZABLE(Boost::no_property)
ACTIV_BOOST_CLASS_IMPLEMENTATION(Boost::no_property, object_serializable)
ACTIV_BOOST_CLASS_TRACKING(Boost::no_property, track_never)
#endif // ACTIV_BOOST_GRAPH_USE_MPI
#endif // ACTIV_BOOST_PROPERTY_SERIALIZE_HPP