PostGIS  3.0.6dev-r@@SVN_REVISION@@
gserialized.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright 2019 Paul Ramsey <pramsey@cleverelephant.ca>
22  *
23  **********************************************************************/
24 
25 /*
26 * GSERIALIZED PUBLIC API
27 */
28 
34 
41 
47 
53 int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *gbox);
54 
59 int gserialized_fast_gbox_p(const GSERIALIZED *g, GBOX *gbox);
60 
65 extern uint32_t gserialized_get_type(const GSERIALIZED *g);
66 
71 extern uint32_t gserialized_max_header_size(void);
72 
78 extern int32_t gserialized_hash(const GSERIALIZED *g);
79 
84 extern int32_t gserialized_get_srid(const GSERIALIZED *g);
85 
90 extern void gserialized_set_srid(GSERIALIZED *g, int32_t srid);
91 
98 extern int gserialized_is_empty(const GSERIALIZED *g);
99 
103 extern int gserialized_has_bbox(const GSERIALIZED *gser);
104 
108 extern int gserialized_has_z(const GSERIALIZED *gser);
109 
113 extern int gserialized_has_m(const GSERIALIZED *gser);
114 
118 extern int gserialized_is_geodetic(const GSERIALIZED *gser);
119 
123 extern int gserialized_ndims(const GSERIALIZED *gser);
124 
134 extern int gserialized_cmp(const GSERIALIZED *g1, const GSERIALIZED *g2);
135 
143 GSERIALIZED *gserialized_from_lwgeom(LWGEOM *geom, size_t *size);
144 
148 size_t gserialized_from_lwgeom_size(const LWGEOM *geom);
149 
155 
161 int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box);
162 
167 int gserialized_fast_gbox_p(const GSERIALIZED *g, GBOX *box);
168 
172 int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point);
size_t gserialized_from_lwgeom_size(const LWGEOM *geom)
Return the memory size a GSERIALIZED will occupy for a given LWGEOM.
Definition: gserialized.c:230
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: gserialized.c:126
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Read the box from the GSERIALIZED or calculate it if necessary.
Definition: gserialized.c:65
int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point)
Pull the first point values of a GSERIALIZED.
Definition: gserialized.c:257
int gserialized_has_z(const GSERIALIZED *gser)
Check if a GSERIALIZED has a Z ordinate.
Definition: gserialized.c:174
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: gserialized.c:152
void gserialized_set_srid(GSERIALIZED *g, int32_t srid)
Write the SRID into the serialized form (it is packed into three bytes so this is a handy function).
Definition: gserialized.c:138
int gserialized_is_geodetic(const GSERIALIZED *gser)
Check if a GSERIALIZED is a geography.
Definition: gserialized.c:196
int gserialized_ndims(const GSERIALIZED *gser)
Return the number of dimensions (2, 3, 4) in a geometry.
Definition: gserialized.c:207
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: gserialized.c:89
GSERIALIZED * gserialized_set_gbox(GSERIALIZED *g, GBOX *gbox)
Copy a new bounding box into an existing gserialized.
Definition: gserialized.c:31
int gserialized_has_m(const GSERIALIZED *gser)
Check if a GSERIALIZED has an M ordinate.
Definition: gserialized.c:185
int gserialized_has_bbox(const GSERIALIZED *gser)
Check if a GSERIALIZED has a bounding box without deserializing first.
Definition: gserialized.c:163
uint32_t gserialized_max_header_size(void)
Returns the size in bytes to read from toast to get the basic information from a geometry: GSERIALIZE...
Definition: gserialized.c:101
GSERIALIZED * gserialized_drop_gbox(GSERIALIZED *g)
Remove the bounding box from a GSERIALIZED.
Definition: gserialized.c:52
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
Definition: gserialized.c:222
int gserialized_fast_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Read the box from the GSERIALIZED or return #LWFAILURE if box is unavailable.
Definition: gserialized.c:77
lwflags_t gserialized_get_lwflags(const GSERIALIZED *g)
Read the flags from a GSERIALIZED and return a standard lwflag integer.
Definition: gserialized.c:18
int32_t gserialized_hash(const GSERIALIZED *g)
Returns a hash code for the srid/type/geometry information in the GSERIALIZED.
Definition: gserialized.c:114
int gserialized_cmp(const GSERIALIZED *g1, const GSERIALIZED *g2)
Return -1 if g1 is "less than" g2, 1 if g1 is "greater than" g2 and 0 if g1 and g2 are the "same".
Definition: gserialized.c:313
uint16_t lwflags_t
Definition: liblwgeom.h:313