PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_from_lwgeom_size()

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 566 of file g_serialized.c.

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

Referenced by gserialized_from_lwgeom(), test_gserialized_from_lwgeom_size(), and test_gserialized_peek_gbox_p_fails_for_unsupported_cases().

567 {
568  size_t size = 8; /* Header overhead. */
569  assert(geom);
570 
571  if ( geom->bbox )
572  size += gbox_serialized_size(geom->flags);
573 
574  size += gserialized_from_any_size(geom);
575  LWDEBUGF(3, "g_serialize size = %d", size);
576 
577  return size;
578 }
GBOX * bbox
Definition: liblwgeom.h:397
uint8_t flags
Definition: liblwgeom.h:396
static size_t gserialized_from_any_size(const LWGEOM *geom)
Definition: g_serialized.c:531
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
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:451
Here is the call graph for this function:
Here is the caller graph for this function: