sl@0: // Copyright (C) 2006 Trustees of Indiana University sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. sl@0: // (See accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: /* sl@0: * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #include "std_log_result.h" sl@0: #define LOG_FILENAME_LINE __FILE__, __LINE__ sl@0: #endif sl@0: struct vertex_properties { sl@0: std::string name; sl@0: sl@0: template sl@0: void serialize(Archive & ar, const unsigned int version) { sl@0: ar & BOOST_SERIALIZATION_NVP(name); sl@0: } sl@0: }; sl@0: sl@0: struct edge_properties { sl@0: std::string name; sl@0: sl@0: template sl@0: void serialize(Archive & ar, const unsigned int version) { sl@0: ar & BOOST_SERIALIZATION_NVP(name); sl@0: } sl@0: }; sl@0: sl@0: using namespace boost; sl@0: sl@0: typedef adjacency_list Graph; sl@0: sl@0: typedef graph_traits::vertex_descriptor vd_type; sl@0: sl@0: sl@0: typedef adjacency_list Graph_no_edge_property; sl@0: sl@0: int main() sl@0: { sl@0: { sl@0: std::ofstream ofs("./kevin-bacon2.dat"); sl@0: archive::xml_oarchive oa(ofs); sl@0: Graph g; sl@0: vertex_properties vp; sl@0: vp.name = "A"; sl@0: vd_type A = add_vertex( vp, g ); sl@0: vp.name = "B"; sl@0: vd_type B = add_vertex( vp, g ); sl@0: sl@0: edge_properties ep; sl@0: ep.name = "a"; sl@0: add_edge( A, B, ep, g); sl@0: sl@0: oa << BOOST_SERIALIZATION_NVP(g); sl@0: sl@0: Graph_no_edge_property g_n; sl@0: oa << BOOST_SERIALIZATION_NVP(g_n); sl@0: } sl@0: sl@0: { sl@0: std::ifstream ifs("./kevin-bacon2.dat"); sl@0: archive::xml_iarchive ia(ifs); sl@0: Graph g; sl@0: ia >> BOOST_SERIALIZATION_NVP(g); sl@0: sl@0: if (!( g[*(vertices( g ).first)].name == "A" )) return -1; sl@0: sl@0: Graph_no_edge_property g_n; sl@0: ia >> BOOST_SERIALIZATION_NVP(g_n); sl@0: } sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: sl@0: std_log(LOG_FILENAME_LINE,"[End Test Case ]"); sl@0: sl@0: testResultXml("serialize"); sl@0: close_log_file(); sl@0: #endif sl@0: return 0; sl@0: }