Given a generic GeomCache, and a geometry to prepare, prepare a PrepGeomCache and stick it into the GeomCache->index slot.
The PrepGeomCache includes the original GEOS geometry, and the GEOS prepared geometry, and a pointer to the MemoryContext where the callback functions are registered.
This function is passed into the generic GetGeomCache function so that it can build an appropriate indexed structure in the case of a cache hit when there is no indexed structure yet available to return.
Definition at line 299 of file lwgeom_geos_prepared.c.
300{
303
304
305
306
309
310
311
312
314 {
316#if POSTGIS_PGSQL_VERSION < 96
318 &PreparedCacheContextMethods,
320 "PostGIS Prepared Geometry Context");
321
322#else
323 MemoryContextCallback *callback;
325 "PostGIS Prepared Geometry Context",
326 ALLOCSET_SMALL_SIZES);
327
328
329
330
331 callback = MemoryContextAlloc(prepcache->
context_callback,
sizeof(MemoryContextCallback));
335#endif
336
341 }
342
343
344
345
346
348 {
349 lwpgerror("PrepGeomCacheBuilder asked to build new prepcache where one already exists.");
351 }
352
357 prepcache->
gcache.argnum = cache->argnum;
358
359
360
361
362
364 if ( ! pghe )
365 {
366 lwpgerror(
"PrepGeomCacheBuilder failed to find hash entry for context %p", prepcache->
context_callback);
368 }
369
372
374}
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
static void CreatePrepGeomHash(void)
static HTAB * PrepGeomHash
static void AddPrepGeomHashEntry(PrepGeomHashEntry pghe)
static void PreparedCacheDelete(void *ptr)
static PrepGeomHashEntry * GetPrepGeomHashEntry(MemoryContext mcxt)
const GEOSPreparedGeometry * prepared_geom
MemoryContext context_statement
const GEOSGeometry * geom
MemoryContext context_callback
const GEOSGeometry * geom
const GEOSPreparedGeometry * prepared_geom
References AddPrepGeomHashEntry(), PrepGeomHashEntry::context, PrepGeomCache::context_callback, PrepGeomCache::context_statement, CreatePrepGeomHash(), PrepGeomCache::gcache, PrepGeomHashEntry::geom, PrepGeomCache::geom, GetPrepGeomHashEntry(), LW_FAILURE, LW_SUCCESS, LWGEOM2GEOS(), PrepGeomHashEntry::prepared_geom, PrepGeomCache::prepared_geom, PreparedCacheDelete(), and PrepGeomHash.