]> granicus.if.org Git - postgis/commitdiff
Remove SERIALIZED_FORM
authorPaul Ramsey <pramsey@cleverelephant.ca>
Sun, 30 Oct 2011 20:45:58 +0000 (20:45 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Sun, 30 Oct 2011 20:45:58 +0000 (20:45 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8052 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/profile.h [deleted file]
libpgcommon/lwgeom_pg.h
postgis/SERIALIZED_FORM [deleted file]
postgis/profile.h [deleted file]

diff --git a/liblwgeom/profile.h b/liblwgeom/profile.h
deleted file mode 100644 (file)
index 8598f36..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef _PROFILE_H
-#define _PROFILE_H 1
-
-#include <math.h>
-
-/* Only enable profiling code if POSTGIS_PROFILE in postgis_config.h is > 0 */
-#if POSTGIS_PROFILE > 0
-
-#include <sys/time.h>
-
-#define PROF_P2G1 0
-#define PROF_P2G2 1
-#define PROF_G2P 2
-#define PROF_GRUN 3
-#define PROF_QRUN 4
-
-struct timeval profstart[5], profstop[5];
-long proftime[5];
-long profipts1, profipts2, profopts;
-
-#define PROFSTART(x) do { gettimeofday(&(profstart[x]), NULL); } while (0);
-#define PROFSTOP(x) do { gettimeofday(&(profstop[x]), NULL); \
-       proftime[x] = ( profstop[x].tv_sec*1000000+profstop[x].tv_usec) - \
-               ( profstart[x].tv_sec*1000000+profstart[x].tv_usec); \
-       } while (0);
-#define PROFREPORT(n, i1, i2, o) do { \
-       profipts1 = profipts2 = profopts = 0; \
-       if ((i1)) profipts1 += lwgeom_npoints(SERIALIZED_FORM((i1))); \
-       else proftime[PROF_P2G1] = 0; \
-       if ((i2)) profipts2 += lwgeom_npoints(SERIALIZED_FORM((i2))); \
-       else proftime[PROF_P2G2] = 0; \
-       if ((o)) profopts += lwgeom_npoints(SERIALIZED_FORM((o))); \
-       else proftime[PROF_G2P] = 0; \
-       long int conv = proftime[PROF_P2G1]+proftime[PROF_P2G2]+proftime[PROF_G2P]; \
-       long int run = proftime[PROF_GRUN]; \
-       long int qrun = proftime[PROF_QRUN]; \
-       long int tot = qrun; \
-       int convpercent = round(((double)conv/(double)tot)*100); \
-       int runpercent = round(((double)run/(double)tot)*100); \
-       elog(NOTICE, \
-               "PRF(%s) ipt1 %lu ipt2 %lu opt %lu p2g1 %lu p2g2 %lu g2p %lu grun %lu qrun %lu perc %d%%", \
-               (n), \
-               profipts1, profipts2, profopts, \
-               proftime[PROF_P2G1], proftime[PROF_P2G2], \
-               proftime[PROF_G2P], \
-               proftime[PROF_GRUN], \
-               proftime[PROF_QRUN], \
-               runpercent+convpercent); \
-       } while (0);
-
-#else
-
-/* Empty prototype that can be optimised away by the compiler for non-profiling builds */
-#define PROFSTART(x) ((void) 0)
-#define PROFSTOP(x) ((void) 0)
-#define PROFREPORT(n, i1, i2, o) ((void) 0)
-
-#endif /* POSTGIS_PROFILE */
-
-#endif /* _PROFILE_H */
index 64af975b3220a3eb0ca195e0bcd4bde45dc4badf..53bb8959fbf6fe7a3e0086e0eed975bac0ef11e9 100644 (file)
@@ -86,10 +86,11 @@ extern void pg_unparser_errhint(LWGEOM_UNPARSER_RESULT *lwg_unparser_result);
 ** GSERIALIED prototypes used outside the index functions
 */
 
-/* Remove the embedded bounding box */
+/**
+* Remove the embedded bounding box 
+*/
 GSERIALIZED* gserialized_drop_gidx(GSERIALIZED *g);
 
-
 /**
 * Utility method to call the serialization and then set the
 * PgSQL varsize header appropriately with the serialized size.
@@ -109,20 +110,17 @@ GSERIALIZED* geography_serialize(LWGEOM *lwgeom);
  */
 extern int pglwgeom_getbox2d_p(const GSERIALIZED *geom, GBOX *box);
 
-/* PG-dependant */
-
 /**
-* Utility to convert cstrings to textp pointers 
+* Convert cstrings (null-terminated byte array) to textp pointers 
+* (PgSQL varlena structure with VARSIZE header).
 */
 text* cstring2text(const char *cstring);
-char* text2cstring(const text *textptr);
 
-/*
- * Use this macro to extract the char * required
- * by most functions from an GSERIALIZED struct.
- * (which is an GSERIALIZED w/out int32 size casted to char *)
- */
-#define SERIALIZED_FORM(x) ((uint8_t *)VARDATA((x)))
+/**
+* Convert textp (PgSQL varlena structure with VARSIZE header) to 
+* cstrings (null-terminated byte array). 
+*/
+char* text2cstring(const text *textptr);
 
 /* 
  * For PostgreSQL >= 8.5 redefine the STATRELATT macro to its
diff --git a/postgis/SERIALIZED_FORM b/postgis/SERIALIZED_FORM
deleted file mode 100644 (file)
index eb7ff10..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-===PostGIS Serialized Geometry Format===
-
-
-==Introduction==
-
-
-This document describe the serialied form of
-Geometries as implemented starting from version 1.x.
-
-Prior versions used a different format.
-
-The new format is aimed at reducing geometries size, for
-this reason we refer to the old format as HWGEOM (High Weight GEOMetry)
-and to the new one as LWGEOM (Light Weight GEOMetry).
-
-
-==Serialized Form and PostgreSQL varlena objects==
-
-
-PostGIS serialized form is a recursive structure, where
-elements in a collection (multi* or geometrycollections)
-are complete serialized forms themself.
-
-PostgreSQL requires to add an header to variable-lenght
-user defined types, for this reason, the type actually
-stored on disk is a SERIALIZED geometry wrapped in this
-required header. We call the complete PostgreSQL type
-``PG_LWGEOM''.
-
-
-==Geometry Type byte==
-
-
-All serialiezd geometries start with a single byte
-encoding geometry type (lower nibble) and flags
-(higher nibble). 
-
-Geometry Type Byte:
-
-     [BSZM] [TTTT]
-
-Flags values:
-
-      B = 16 byte BOX2DFLOAT4 follows (probably not aligned) [before SRID]
-      S = 4 byte SRID attached (0= not attached (-1), 1= attached)
-      ZM = dimensionality (hasZ, hasM)
-
-Type values:
-
-      wkbPoint = 1
-      wkbLineString = 2
-      wkbPolygon = 3
-      wkbMultiPoint = 4
-      wkbMultiLineString = 5
-      wkbMultiPolygon = 6
-      wkbGeometryCollection = 7
-
-* Note that the following values do not correspond to wkb type values.
-      CircularString = 8
-      CompoundCurve = 9
-      CurvePolygon = 13
-      MultiCurve = 14
-      MultiSurface = 15
-
-==Bounding box and SRID==
-
-
-Following the Geometry type byte we find optional bounding box
-and/or SRID values. Presence of them is encoded in the type byte.
-
-If both objects are present the bounding box come first.
-
-Bounding box is composed by 4 32-bit float:
-
-       [FLOAT32] [FLOAT32] [FLOAT32] [FLOAT32]
-          xmin      ymin      xmax      ymax
-
-SRID is composed by a 32-bit integer:
-
-       [INT32]
-        SRID
-
-
-==Ordinate Arrays==
-
-
-When it comes to ordinate values all geometries use arrays of 64-bit
-floats. Number and semantic of values depend on the dimension flags
-on the geometry type byte:
-
-        2D (ZM=0x00)
-               [FLOAT64] [FLOAT64]
-                   x         y
-
-       3DM (ZM=0x01)
-               [FLOAT64] [FLOAT64] [FLOAT64]
-                   x         y         m
-
-       3DZ (ZM=0x10)
-               [FLOAT64] [FLOAT64] [FLOAT64]
-                   x         y         z
-
-        4D (ZM=0x11)
-               [FLOAT64] [FLOAT64] [FLOAT64] [FLOAT64]
-                   x         y         z         m
-
-
-==Geometry types==
-
-What you find after the type byte and optional bbox and SRID
-(COMMON_HEADER from now on) depends on actual geometry type.
-
-=Point=
-
-A Point geometry is as follows:
-
-       <COMMON_HEADER>
-       <ORDINATE_ARRAY> -- single element
-
-=LineString=
-
-A LineString geometry is as follows:
-
-       <COMMON_HEADER>
-       <UINT32> -- number of elements in following ORDINATE_ARRAY
-       <ORDINATE_ARRAY>
-
-=CircularString=
-
-A CircularString geometry is as follows:
-
-        <COMMON_HEADER>
-        <UINT32> -- number of elements in following ORDINATE_ARRAY
-        <ORDINATE_ARRAY>
-
-=CompoundCurve=
-
-A CompoundCurve geometry is as follows:
-
-        <COMMON_HEADER>
-        <UINT32> -- number of segments
-        One or more geometries as specified by previous uint32:
-                <SERIALIZED_GEOMETRY> -- Must be some combination of 
-                                         LineStrings and CircularStrings.
-
-=Polygon=
-
-A Polygon geometry is as follows:
-
-       <COMMON_HEADER>
-
-       <UINT32> -- number of ORDINATE_ARRAYs (at least 1, the shell)
-
-       One or more arrays (rings) as specified by previous uint32:
-
-               <UINT32> -- number of elements in following ORDINATE_ARRAY
-               <ORDINATE_ARRAY> -- single element
-
-=CurvePolygon=                
-
-A CurvePolygon geometry is as follows:
-
-        <COMMON_HEADER>
-        <UINT32> -- number of rings
-        One or more geometries as specified by previous uint32:
-                <SERIALIZED_GEOMETRY> -- Must be some combination of 
-                                         LineStrings and CircularStrings.
-                                         CompoundCurve are not yet supported.
-
-=Collections=
-
-All collection types (MultiPoint, MultiLineString, MultiPolygon,
-GeometryCollection) have the same structure. Real type is just
-an hint on what one should expect from element geometries.
-Note that the GeometryCollection type is also used for EMPTY
-Geometries (number_of_geometries is set to 0 in this case).
-
-A Collection geometry is as follows:
-
-       <COMMON_HEADER>
-
-       <UINT32> -- number of GEOMETRIES
-
-       Zero (EMPTY) or more geometries as specified by previous uint32:
-
-               <SERIALIZED_GEOMETRY> -- starting from type byte again
-
-
-==Examples==
-
-
-=3DZ point, no bounding box, no SRID=
-
-       <char>   TYPE - flags:__Z_  type:1
-       <double> X
-       <double> Y
-       <double> Z
-
-=3DM point, bounding box, no SRID=
-
-       <char>   TYPE - flags:B__M  type:1
-       <float>  XMIN
-       <float>  YMIN
-       <float>  XMAX
-       <float>  YMAX
-       <double> X
-       <double> Y
-       <double> M
-
-=2D LineString, no bounding box, SRID=
-
-       <char>   TYPE - flags:_S__  type:2
-
-       <uint32> NPOINTS - 3
-
-       <uint32> SRID
-
-       <double> X0
-       <double> Y0
-
-       <double> X1
-       <double> Y1
-
-       <double> X2
-       <double> Y2
-
-=2D polygon, no bounding box, no SRID=
-
-       <char>   TYPE - flags:____  type:3
-
-       <uint32> NRINGS - 2
-
-       <uint32> NPOINTS - 4
-       <double> X0
-       <double> Y0
-       <double> X1
-       <double> Y1
-       <double> X2
-       <double> Y2
-       <double> X3
-       <double> Y3
-
-       <uint32> NPOINTS - 6
-       <double> X0
-       <double> Y0
-       <double> X1
-       <double> Y1
-       <double> X2
-       <double> Y2
-       <double> X3
-       <double> Y3
-       <double> X4
-       <double> Y4
-       <double> X5
-       <double> Y5
-
-=2D Collection of a point and a line, SRID and bbox present=
-
-       <char>   TYPE - flags:BS__  type:7
-
-       -- BBOX
-       <float>  XMIN
-       <float>  YMIN
-       <float>  XMAX
-       <float>  YMAX
-
-       -- SRID
-       <uint32> SRID
-
-       <uint32> NGEOMS - 2
-
-       <char>   TYPE - flags:____  type:1 ( the point )
-       <double> X0
-       <double> Y0
-
-       <char>   TYPE - flags:____  type:2 ( the line )
-       <uint32> NPOINTS - 3
-       <double> X0
-       <double> Y0
-       <double> X1
-       <double> Y1
-       <double> X2
-       <double> Y2
-
-Note that in the inner geometries:
-
-       - SRID value is inherited by parent geometry type.
-
-       - BBOX value is not present (can be, however)
-
-       - ZM flags must exactly match those in the outer geometry type byte
-
diff --git a/postgis/profile.h b/postgis/profile.h
deleted file mode 100644 (file)
index 239ca70..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/**********************************************************************
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- *
- * Copyright (C) 2004 Sandro Santilli <strk@keybit.net>
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU General Public Licence. See the COPYING file.
- *
- **********************************************************************/
-
-#ifndef _PROFILE_H
-#define _PROFILE_H 1
-
-#include <math.h>
-
-/* Only enable profiling code if POSTGIS_PROFILE in postgis_config.h is > 0 */
-#if POSTGIS_PROFILE > 0
-
-#include <sys/time.h>
-
-#define PROF_P2G1 0
-#define PROF_P2G2 1
-#define PROF_G2P 2
-#define PROF_GRUN 3
-#define PROF_QRUN 4
-
-struct timeval profstart[5], profstop[5];
-long proftime[5];
-long profipts1, profipts2, profopts;
-
-#define PROFSTART(x) do { gettimeofday(&(profstart[x]), NULL); } while (0);
-#define PROFSTOP(x) do { gettimeofday(&(profstop[x]), NULL); \
-       proftime[x] = ( profstop[x].tv_sec*1000000+profstop[x].tv_usec) - \
-               ( profstart[x].tv_sec*1000000+profstart[x].tv_usec); \
-       } while (0);
-#define PROFREPORT(n, i1, i2, o) do { \
-       profipts1 = profipts2 = profopts = 0; \
-       if ((i1)) profipts1 += lwgeom_npoints(SERIALIZED_FORM((i1))); \
-       else proftime[PROF_P2G1] = 0; \
-       if ((i2)) profipts2 += lwgeom_npoints(SERIALIZED_FORM((i2))); \
-       else proftime[PROF_P2G2] = 0; \
-       if ((o)) profopts += lwgeom_npoints(SERIALIZED_FORM((o))); \
-       else proftime[PROF_G2P] = 0; \
-       long int conv = proftime[PROF_P2G1]+proftime[PROF_P2G2]+proftime[PROF_G2P]; \
-       long int run = proftime[PROF_GRUN]; \
-       long int qrun = proftime[PROF_QRUN]; \
-       long int tot = qrun; \
-       int convpercent = round(((double)conv/(double)tot)*100); \
-       int runpercent = round(((double)run/(double)tot)*100); \
-       elog(NOTICE, \
-               "PRF(%s) ipt1 %lu ipt2 %lu opt %lu p2g1 %lu p2g2 %lu g2p %lu grun %lu qrun %lu perc %d%%", \
-               (n), \
-               profipts1, profipts2, profopts, \
-               proftime[PROF_P2G1], proftime[PROF_P2G2], \
-               proftime[PROF_G2P], \
-               proftime[PROF_GRUN], \
-               proftime[PROF_QRUN], \
-               runpercent+convpercent); \
-       } while (0);
-
-#else
-
-/* Empty prototype that can be optimised away by the compiler for non-profiling builds */
-#define PROFSTART(x) ((void) 0)
-#define PROFSTOP(x) ((void) 0)
-#define PROFREPORT(n, i1, i2, o) ((void) 0)
-
-#endif /* POSTGIS_PROFILE */
-
-#endif /* _PROFILE_H */