PostGIS  2.2.7dev-r@@SVN_REVISION@@
size_t gserialized_from_lwgeom_size ( const LWGEOM geom)

Calculate required memory segment to contain a serialized form of the LWGEOM.

Primarily used internally by the serialization code. Exposed to allow the cunit tests to exercise it.

Definition at line 539 of file g_serialized.c.

References LWGEOM::bbox, LWGEOM::flags, gbox_serialized_size(), gserialized_from_any_size(), and LWDEBUGF.

Referenced by gserialized_from_lwgeom(), and test_gserialized_from_lwgeom_size().

540 {
541  size_t size = 8; /* Header overhead. */
542  assert(geom);
543 
544  if ( geom->bbox )
545  size += gbox_serialized_size(geom->flags);
546 
547  size += gserialized_from_any_size(geom);
548  LWDEBUGF(3, "g_serialize size = %d", size);
549 
550  return size;
551 }
GBOX * bbox
Definition: liblwgeom.h:382
uint8_t flags
Definition: liblwgeom.h:381
static size_t gserialized_from_any_size(const LWGEOM *geom)
Definition: g_serialized.c:504
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
size_t gbox_serialized_size(uint8_t flags)
Return the number of bytes necessary to hold a GBOX of this dimension in serialized form...
Definition: g_box.c:416

Here is the call graph for this function:

Here is the caller graph for this function: