? .project ? bin.v2 ? graph_serialization.diff ? stage ? boost/patch ? libs/graph/test/kevin-bacon2.dat Index: boost/graph/adj_list_serialize.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/graph/adj_list_serialize.hpp,v retrieving revision 1.7 diff -u -r1.7 adj_list_serialize.hpp --- boost/graph/adj_list_serialize.hpp 21 Sep 2006 17:02:14 -0000 1.7 +++ boost/graph/adj_list_serialize.hpp 20 Jan 2007 08:55:14 -0000 @@ -51,15 +51,15 @@ typename graph_traits::vertex_iterator vi; for (vi = vertices(graph).first; vi != vertices(graph).second; ++vi) { indices[*vi] = num++; - ar << get(vertex_all_t(), graph, *vi); + ar << serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, *vi) ); } // write edges typename graph_traits::edge_iterator ei; for (ei = edges(graph).first; ei != edges(graph).second; ++ei){ - ar << BOOST_SERIALIZATION_NVP(indices[source(*ei,graph)]); - ar << BOOST_SERIALIZATION_NVP(indices[target(*ei,graph)]); - ar << get(edge_all_t(), graph, *ei); + ar << serialization::make_nvp("u" , indices[source(*ei,graph)]); + ar << serialization::make_nvp("v" , indices[target(*ei,graph)]); + ar << serialization::make_nvp("edge_property", get(edge_all_t(), graph, *ei) ); } } @@ -85,7 +85,7 @@ while(V-- > 0){ Vertex v = add_vertex(graph); verts[i++] = v; - ar >> get(vertex_all_t(), graph, v); + ar >> serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, v) ); } while(E-- > 0){ int u; int v; @@ -93,7 +93,7 @@ ar >> BOOST_SERIALIZATION_NVP(v); Edge e; bool inserted; tie(e,inserted) = add_edge(verts[u], verts[v], graph); - ar >> get(edge_all_t(), graph, e); + ar >> serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } } Index: boost/pending/property_serialize.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/pending/property_serialize.hpp,v retrieving revision 1.1 diff -u -r1.1 property_serialize.hpp --- boost/pending/property_serialize.hpp 10 Jan 2006 13:53:48 -0000 1.1 +++ boost/pending/property_serialize.hpp 20 Jan 2007 08:55:16 -0000 @@ -8,11 +8,8 @@ #include -// Wierd, I get compilation errors if the following include is -// removed, but it shouldn't be needed. Some kind of strange -// include dependency in the serialization library. -#include #include +#include namespace boost { template @@ -23,8 +20,8 @@ serialize(Archive& ar, property& prop, const unsigned int version) { - ar & boost::serialization::base_object(prop); - ar & prop.m_value; + ar & serialization::make_nvp( "property_base" , boost::serialization::base_object(prop) ); + ar & serialization::make_nvp( "property_value" , prop.m_value ); } } // end namespace boost Index: libs/graph/test/serialize.cpp =================================================================== RCS file: /cvsroot/boost/boost/libs/graph/test/serialize.cpp,v retrieving revision 1.2 diff -u -r1.2 serialize.cpp --- libs/graph/test/serialize.cpp 21 Sep 2006 17:02:14 -0000 1.2 +++ libs/graph/test/serialize.cpp 20 Jan 2007 08:55:23 -0000 @@ -8,15 +8,15 @@ #include #include #include -#include -#include +#include +#include struct vertex_properties { std::string name; template void serialize(Archive & ar, const unsigned int version) { - ar & name; + ar & BOOST_SERIALIZATION_NVP(name); } }; @@ -25,7 +25,7 @@ template void serialize(Archive & ar, const unsigned int version) { - ar & name; + ar & BOOST_SERIALIZATION_NVP(name); } }; @@ -34,6 +34,8 @@ typedef adjacency_list Graph; +typedef graph_traits::vertex_descriptor vd_type; + typedef adjacency_list Graph_no_edge_property; @@ -42,22 +44,34 @@ { { std::ofstream ofs("./kevin-bacon2.dat"); - archive::text_oarchive oa(ofs); + archive::xml_oarchive oa(ofs); Graph g; - oa << g; + vertex_properties vp; + vp.name = "A"; + vd_type A = add_vertex( vp, g ); + vp.name = "B"; + vd_type B = add_vertex( vp, g ); + + edge_properties ep; + ep.name = "a"; + add_edge( A, B, ep, g); + + oa << BOOST_SERIALIZATION_NVP(g); Graph_no_edge_property g_n; - oa << g_n; + oa << BOOST_SERIALIZATION_NVP(g_n); } { std::ifstream ifs("./kevin-bacon2.dat"); - archive::text_iarchive ia(ifs); + archive::xml_iarchive ia(ifs); Graph g; - ia >> g; + ia >> BOOST_SERIALIZATION_NVP(g); + + if (!( g[*(vertices( g ).first)].name == "A" )) return -1; Graph_no_edge_property g_n; - ia >> g_n; + ia >> BOOST_SERIALIZATION_NVP(g_n); } return 0; }