[geos-devel] WKB parser port

Artem Pavlenko artem at pavlenko.uklinux.net
Wed Apr 20 06:48:20 EDT 2005

I don't know all the details, but sounds like a good idea,
I cannot think about any system that spits out WKB stream, but who knows?

template<typename IStream>
struct WKBReader
        ByteOrderDataInStream<IStream> in;
Then IStream can be sstream, fstream etc.

Java-ish interfaces dont work well in c++:(

PS. I wonder how you're going to swap doubles. Macros?

>In the process of porting the WKB parser from JTS
>to GEOS I encoutered one of the situation which in
>the past have led to poor-performing code.
>JTS WKBReader object uses an ByteOrderDataInStream
>object to read a byte, an int, a long and a double.
>The ByteOrderDataInStream object can be initialized
>with an InStream object to set it's input source.
>WKBReader object can also accept an InStream object
>to initialize its internal ByteOrderDataInStream.
>Now, for JTS InStream is an INTERFACE. 
>This has been in the past ported to a virtual base
>My understanding of it is that it is intended to
>be used to abstract reading from a memory buffer
>and reading from a stream. Currently only reading
>from a memory buffer is implemented using the
>derived class ByteArrayInStream.
>Is this a good candidate for templating ?
>Shouldn't we use standard C++ templates for this ?
>Would InStream really be an istream ?
>Comments welcome.
>geos-devel mailing list
>geos-devel at geos.refractions.net

More information about the geos-devel mailing list