diff -r 000000000000 -r e4d67989cc36 stdcpp/tsrc/Boost_test/graph/src/serialize.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stdcpp/tsrc/Boost_test/graph/src/serialize.cpp Tue Feb 02 02:01:42 2010 +0200 @@ -0,0 +1,99 @@ +// Copyright (C) 2006 Trustees of Indiana University +// +// 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) +/* + * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __SYMBIAN32__ +#include "std_log_result.h" +#define LOG_FILENAME_LINE __FILE__, __LINE__ +#endif +struct vertex_properties { + std::string name; + + template + void serialize(Archive & ar, const unsigned int version) { + ar & BOOST_SERIALIZATION_NVP(name); + } +}; + +struct edge_properties { + std::string name; + + template + void serialize(Archive & ar, const unsigned int version) { + ar & BOOST_SERIALIZATION_NVP(name); + } +}; + +using namespace boost; + +typedef adjacency_list Graph; + +typedef graph_traits::vertex_descriptor vd_type; + + +typedef adjacency_list Graph_no_edge_property; + +int main() +{ + { + std::ofstream ofs("./kevin-bacon2.dat"); + archive::xml_oarchive oa(ofs); + Graph 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 << BOOST_SERIALIZATION_NVP(g_n); + } + + { + std::ifstream ifs("./kevin-bacon2.dat"); + archive::xml_iarchive ia(ifs); + Graph g; + ia >> BOOST_SERIALIZATION_NVP(g); + + if (!( g[*(vertices( g ).first)].name == "A" )) return -1; + + Graph_no_edge_property g_n; + ia >> BOOST_SERIALIZATION_NVP(g_n); + } + + #ifdef __SYMBIAN32__ + + std_log(LOG_FILENAME_LINE,"[End Test Case ]"); + + testResultXml("serialize"); + close_log_file(); +#endif + return 0; +}