1 // (C) Copyright Jeremy Siek 2006
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef BOOST_PROPERTY_SERIALIZE_HPP
7 #define BOOST_PROPERTY_SERIALIZE_HPP
8
9 #include <boost/pending/property.hpp>
10 #include <boost/serialization/is_bitwise_serializable.hpp>
11 #include <boost/serialization/base_object.hpp>
12 #include <boost/serialization/nvp.hpp>
13
14 namespace boost
15 {
16 template < class Archive >
serialize(Archive &,no_property &,const unsigned int)17 inline void serialize(Archive&, no_property&, const unsigned int)
18 {
19 }
20
21 template < class Archive, class Tag, class T, class Base >
serialize(Archive & ar,property<Tag,T,Base> & prop,const unsigned int)22 void serialize(
23 Archive& ar, property< Tag, T, Base >& prop, const unsigned int /*version*/)
24 {
25 ar& serialization::make_nvp("property_value", prop.m_value);
26 ar& serialization::make_nvp("property_base", prop.m_base);
27 }
28
29 #ifdef BOOST_GRAPH_USE_MPI
30
31 // Setting the serialization properties of boost::property<> and
32 // boost::no_property to is_bitwise_serializable, object_serializable,
33 // track_never only when BOOST_GRAPH_USE_MPI is defined is dubious.
34 //
35 // This changes the serialization format of these classes, and hence
36 // of boost::adjacency_list, depending on whether BOOST_GRAPH_USE_MPI
37 // is defined.
38 //
39 // These serialization properties should probably be set in either case.
40 //
41 // Unfortunately, doing that now will change the serialization format
42 // of boost::adjacency_list in the non-MPI case, and could potentially
43 // break software that reads files serialized with an older release.
44
45 namespace mpi
46 {
47
48 // forward declaration, to avoid including mpi
49 template < typename T > struct is_mpi_datatype;
50
51 template < typename Tag, typename T, typename Base >
52 struct is_mpi_datatype< property< Tag, T, Base > >
53 : mpl::and_< is_mpi_datatype< T >, is_mpi_datatype< Base > >
54 {
55 };
56 }
57
58 namespace serialization
59 {
60 template < typename Tag, typename T, typename Base >
61 struct is_bitwise_serializable< property< Tag, T, Base > >
62 : mpl::and_< is_bitwise_serializable< T >, is_bitwise_serializable< Base > >
63 {
64 };
65
66 template < typename Tag, typename T, typename Base >
67 struct implementation_level< property< Tag, T, Base > >
68 : mpl::int_< object_serializable >
69 {
70 };
71
72 template < typename Tag, typename T, typename Base >
73 struct tracking_level< property< Tag, T, Base > > : mpl::int_< track_never >
74 {
75 };
76
77 }
78 #endif // BOOST_GRAPH_USE_MPI
79
80 } // end namespace boost
81
82 #ifdef BOOST_GRAPH_USE_MPI
83 namespace boost
84 {
85 namespace mpi
86 {
87 template <> struct is_mpi_datatype< boost::no_property > : mpl::true_
88 {
89 };
90
91 }
92 } // end namespace boost::mpi
93
94 BOOST_IS_BITWISE_SERIALIZABLE(boost::no_property)
95 BOOST_CLASS_IMPLEMENTATION(boost::no_property, object_serializable)
96 BOOST_CLASS_TRACKING(boost::no_property, track_never)
97 #endif // BOOST_GRAPH_USE_MPI
98
99 #endif // BOOST_PROPERTY_SERIALIZE_HPP
100