[geos-devel] CGAlgoritms singleton

strk at refractions.net strk at refractions.net
Thu May 19 04:46:59 EDT 2005


On Thu, May 19, 2005 at 05:41:53PM +0900, Paul Selormey wrote:
> The new JTS simply uses static methods, hope you have seen that too.

Yes, that's why I'm asking. I'm trying to keep the code
simple to maintain and I don't like all these CGAlgorithms
pointers passing around with really no reason. Note that
often these pointers are instantiated at class instantiation
time.

I'm now working on changing all CGAltorithms access using
fully qualified paths and making CGAlgorithms pointer arguments
optional (and unused if provided). This would reduce flexibility
as users won't be able to pass in another implementation
of CGAlgorithms, but this flexibility was already broken in 
GEOS (not all classes using do accept it as argument).

Since GEOS is free software recompiling sources should not
be a problem in case we find improved algorithms. This is
what happened already between NonRobust and Robust algos...

Comments ?

--strk;


> 
> Best regards,
> Paul. 
> 
> > -----Original Message-----
> > From: geos-devel-bounces at geos.refractions.net 
> > [mailto:geos-devel-bounces at geos.refractions.net] On Behalf Of 
> > strk at refractions.net
> > Sent: Thursday, May 19, 2005 4:42 PM
> > To: geos-devel at geos.refractions.net
> > Subject: Re: [geos-devel] CGAlgoritms singleton
> > 
> > Actually, if there's no state, why not using a namespace instead ?
> > 
> > --strk;
> > 
> > On Thu, May 19, 2005 at 09:39:05AM +0200, strk at refractions.net wrote:
> > > Hunting for the multipolygon buffer bug I've seen one of multiple 
> > > places where CGAlgoritms class is instanciated.
> > > Apart from high paranoia due to Robust/NonRobust implementation 
> > > (actually marked as obsoleted in GEOS) I don't really 
> > understand if we 
> > > really have a need to instantiate that class multiple time.
> > > 
> > > Wouldn't it be smarter to make it a Singleton and store 
> > reference to 
> > > it in the different classes ?
> > > 
> > > (the instance I'm talking about is in 
> > OffsetCurveSetBuilder.cpp, but I 
> > > recall to have seen many others around)
> > > 
> > > --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
> > 
> > 
> 
> 
> _______________________________________________
> 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