x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
adj_list_serialize.hpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\graph\adj_list_serialize.hpp
Girar
Efecto
Propiedad
Historial
//======================================================================= // Copyright 2005 Jeremy G. Siek // Authors: Jeremy G. Siek // // 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 ADJ_LIST_SERIALIZE_HPP #define ADJ_LIST_SERIALIZE_HPP #include
#include
#include
#include
#include
#include
#include
namespace boost { namespace serialization { // Turn off tracking for adjacency_list. It's not polymorphic, and we // need to do this to enable saving of non-const adjacency lists. template
struct tracking_level
> { typedef mpl::integral_c_tag tag; typedef mpl::int_
type; BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value); }; template
inline void save( Archive & ar, const boost::adjacency_list
&graph, const unsigned int /* file_version */ ){ typedef adjacency_list
Graph; typedef typename graph_traits
::vertex_descriptor Vertex; int V = num_vertices(graph); int E = num_edges(graph); ar << BOOST_SERIALIZATION_NVP(V); ar << BOOST_SERIALIZATION_NVP(E); // assign indices to vertices std::map
indices; int num = 0; typename graph_traits
::vertex_iterator vi; for (vi = vertices(graph).first; vi != vertices(graph).second; ++vi) { indices[*vi] = num++; 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 << 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) ); } } template
inline void load( Archive & ar, boost::adjacency_list
&graph, const unsigned int /* file_version */ ){ typedef adjacency_list
Graph; typedef typename graph_traits
::vertex_descriptor Vertex; typedef typename graph_traits
::edge_descriptor Edge; unsigned int V; ar >> BOOST_SERIALIZATION_NVP(V); unsigned int E; ar >> BOOST_SERIALIZATION_NVP(E); std::vector
verts(V); int i = 0; while(V-- > 0){ Vertex v = add_vertex(graph); verts[i++] = v; ar >> serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, v) ); } while(E-- > 0){ int u; int v; ar >> BOOST_SERIALIZATION_NVP(u); ar >> BOOST_SERIALIZATION_NVP(v); Edge e; bool inserted; tie(e,inserted) = add_edge(verts[u], verts[v], graph); ar >> serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } } template
inline void serialize( Archive & ar, boost::adjacency_list
&graph, const unsigned int file_version ){ boost::serialization::split_free(ar, graph, file_version); } }//serialization }//boost #endif // ADJ_LIST_SERIALIZE_HPP
adj_list_serialize.hpp
Dirección de la página
Dirección del archivo
Anterior 1/95
Siguiente
Descargar
( 3 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.