[geos-devel] WKB parser port

strk at refractions.net strk at refractions.net
Wed Apr 20 06:52:01 EDT 2005


On Wed, Apr 20, 2005 at 11:48:20AM +0100, Artem Pavlenko wrote:
> 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?

JTS implementation *always* use byte_after_byte reads,
while I'm used to code swapping only when required, which
is faster if swapping is not required (postgis does it that
way). I think JTS way is due to FIXED byte order in the Java
world - am I right ?

--strk;

> 
> >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
> >class.
> >
> >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.
> >
> >--strk;
> >_______________________________________________
> >geos-devel mailing list
> >geos-devel at geos.refractions.net
> >http://geos.refractions.net/mailman/listinfo/geos-devel
> >
> >
> > 
> >
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel



More information about the geos-devel mailing list