[geos-devel] GeometryFactory - call for explanation
Mateusz Łoskot
mateusz at loskot.net
Sun Apr 2 19:29:32 EDT 2006
Mateusz Łoskot wrote:
> strk at refractions.net wrote: On Fri, Mar 31, 2006 at 03:45:25AM +0200,
> Mateusz £oskot wrote:
>
>> I'd suggest to use "Shared Smart Pointer" semantic to manage
>> geometry factories and their relations to geometry objects. One
>> possibility is to use boost::shared_ptr (no linking to ext. libs
>> required, just including one header, as <vector> or <list>).
>
> I agree on using shared pointer, but I don't think it takes a single
> header.
You are right that smart pointer need more than single file to be
shipped with them, but only one file needs to be included in client code.
I have extracted Boost's smart pointers and it contains *only* headers.
It's not so small package, around 2.7 MB, but if you want to use e.g.
shared_ptr you need to inclyde *only* <boost/shared_ptr.hpp> file.
So, for now, it is possible to include smart pointesr to GEOS source
tree if you don't want to force users to download/install them theirself.
> If you want to inspect this please do, and also remember Frank
> request of making it possible for builders to choose between the
> GEOS-embedded version and an external version of them (acting on the
> -I switch would be enough).
Yes, that's what I'm talking about.
Boost provides tool called BCP. You can use this tool to extract a
subset of libraries you want to use and ship them to users.
>> Why not to use singleton or when to use it?
>>
>> Singleton is another option but *does* *not* apply to the current
>> design, according to assumptions already confirmed.
>
> I might have used the wrong term, but by Singleton I meant a
> "default" instance of a GeometryFactory, for use by calls w/out an
> explicit provision of it. I don't know if it's worth the trouble,
> when using shared_ptr. Probably not.
Obsiously, well known is that Singleton is a single
instance of some class.
What I understand as a default factory that is not a Singleton?
My understanding of the idea of default factory that is not a
singleton is that it is not a single instance shared between geometries
but it is represented as one-or-more factories having the same default
state.
It is a factory that is created with well known and well defined state.
Such factory can be created many times for many geometries, e.g.:
default_factory1 ---> geometry1
default_factory2 ---> geometry2
default_factory3 ---> geometry3
All three default factories are created separately and are separate
objects. They just has the same state and provide same conditions for
creating geoemtries.
Cheers
--
Mateusz Łoskot
http://mateusz.loskot.net
More information about the geos-devel
mailing list