示例#1
0
        /// <summary>
        /// Deserializes the given stream into a routable graph.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="lazy"></param>
        /// <returns></returns>
        public IBasicRouterDataSource<PreProcessedEdge> Deserialize(Stream stream, bool lazy = true)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");

            if (this.CanDeSerialize(stream))
            {
                // read/verify the current version header.
                this.ReadAndValidateHeader(stream);

                // wrap the stream.
                var routingSerializerStream = new RoutingSerializerStream(stream);

                // do the actual version-specific deserialization.
                return this.DoDeserialize(routingSerializerStream, lazy);
            }
            throw new ArgumentOutOfRangeException("stream", "Cannot deserialize the given stream, version unsupported or content unrecognized!");
        }
示例#2
0
 /// <summary>
 /// Deserializes the given stream into a routable graph.
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="lazy"></param>
 /// <returns></returns>
 protected abstract IBasicRouterDataSource<PreProcessedEdge> DoDeserialize(RoutingSerializerStream stream, bool lazy);
示例#3
0
        /// <summary>
        /// Serializes the given graph and tags index to the given stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="graph"></param>
        public void Serialize(Stream stream, DynamicGraphRouterDataSource<PreProcessedEdge> graph)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");
            if (graph == null)
                throw new ArgumentNullException("graph");

            // write the header.
            this.WriteVersionHeader(stream);

            // wrap the stream.
            var routingSerializerStream = new RoutingSerializerStream(stream);

            // do the version-specific serialization.
            this.DoSerialize(routingSerializerStream, graph);
        }
示例#4
0
 /// <summary>
 /// Serializes the given graph and tags index to the given stream.
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="graph"></param>
 protected abstract void DoSerialize(RoutingSerializerStream stream, DynamicGraphRouterDataSource<PreProcessedEdge> graph);