[postgis-devel] Common Code
Bryce L Nordgren
bnordgren at gmail.com
Tue Aug 9 17:45:40 PDT 2011
On Tue, Aug 9, 2011 at 9:39 PM, Chris Hodgson <chodgson at refractions.net>wrote:
> - 1-D r-tree indexes of lwgeoms
> - prepared geoms aka. geos geoms
> - Proj contexts
>
> - looking at the proj4 cache code, it appears that it would also
> overwrite/be overwritten by the prepared geom and r-tree index caches (all
> appear to use fcinfo->flinfo->fn_extra as if no-one else was using it)
>
Thinking into email, it appears the requirement for the thing stored in
fcinfo->flinfo->fn_extra would be an implementation of :
(crudely represented)
struct cache_master {
cache *r_tree;
cache *prepped_geoms;
cache *projections;
} ;
Meaning: there are three caches and you select the one you want before using
it. I think the caching API would have to explicitly declare the legitimate
data types (or enum {} them or something).
If all three caches can be forced to use integer keys, we may be able to
steal this: http://elliottback.com/wp/hashmap-implementation-in-c/ Better
yet, we could just use the projection cache API, since it already has an int
key. However, it looks like the first two use LWGEOM structures as a key.
Bah.
What about putting this in fn_extra:
struct uber_cache_monster {
RTREE_POLY_CACHE *r_tree ;
RTREE_POLY_CACHE *prepped_geoms ;
PROJ4PortalCache *projections ;
} ;
It doesn't solve the duplicate code issue, but it should fix #547. Which,
now that I look at it, is exactly what you suggested in the ticket. (
http://trac.osgeo.org/postgis/ticket/547#comment:4) Nevermind me, I'm just
catching up.
BTW: is fn_extra private to postgis, or is it shared among other extensions
(which may also want to use it)?
Bryce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20110810/2be118b0/attachment.html>
More information about the postgis-devel
mailing list