Reorg to allow the pc core to build independent of postgres.

This commit is contained in:
Paul Ramsey 2013-01-07 16:58:15 -08:00
parent 2af6f11e24
commit be8365d2ec
7 changed files with 43 additions and 29 deletions

View File

@ -1,7 +1,7 @@
# pointcloud
MODULE_big = pointcloud
OBJS = pc_core.o
OBJS = pc_core.a
EXTENSION = pointcloud
DATA = pointcloud--1.0.sql
@ -13,4 +13,7 @@ SHLIB_LINK += $(filter -lm, $(LIBS))
# We are going to use PGXS for sure
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
include $(PGXS)
pg_core.a: pc_core.o

10
core/Makefile Normal file
View File

@ -0,0 +1,10 @@
OBJS = pc_core.o
all: liblwgeom.a
liblwgeom.a: $(OBJS)
ar rs $@ $^
clean:
@rm -f *.o *.a *.so

0
core/cunit/Makefile Normal file
View File

View File

@ -7,10 +7,6 @@
*
***********************************************************************/
/* PostgreSQL types and functions */
#include "postgres.h"
/**********************************************************************
* DATA STRUCTURES
*/
@ -29,14 +25,6 @@ enum COMPRESSIONS
PC_GHT = 1
};
/**
* Map compression enum to strings for human consumption/creation.
*/
static char *PCCOMPRESSIONSTR[PCCOMPRESSIONTYPES] = {
"NONE",
"GHT"
};
/**
* We will need to flag endianness for inter-architecture
* data transfers.
@ -61,7 +49,7 @@ enum INTERPRETATIONS {
/**
* Point type for clouds. Variable length, because there can be
* an arbitrary number of dimensions. The pcid is a foreign key
* reference to the POINTCLOUD_FORMATS table, where
* reference to the POINTCLOUD_SCHEMAS table, where
* the underlying structure of the data is described in XML,
* the spatial reference system is indicated, and the data
* packing scheme is indicated.
@ -80,7 +68,7 @@ typedef struct
* Variable length, because there can be
* an arbitrary number of points encoded within.
* The pcid is a foriegn key reference to the
* POINTCLOUD_FORMATS table, where
* POINTCLOUD_SCHEMAS table, where
* the underlying structure of the data is described in XML,
* the spatial reference system is indicated, and the data
* packing scheme is indicated.
@ -116,7 +104,7 @@ typedef struct
uint32 pcid;
uint32 ndims;
PCDIMENSION *dims;
} PCFORMAT;
} PCSCHEMA;
@ -125,7 +113,9 @@ typedef struct
*/
/* Utility */
void pc_format_free(PCFORMAT *pcf);
void pc_schema_free(PCSCHEMA *pcf);
PCSCHEMA* pc_schema_construct(const char *xmlstr);
/* Accessors */
int8 pc_point_get_int8 (const PCPOINT *pt, uint32 dim);

18
core/pc_c.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef HAVE_INT8
typedef signed char int8; /* == 8 bits */
typedef signed short int16; /* == 16 bits */
typedef signed int int32; /* == 32 bits */
#endif /* not HAVE_INT8 */
#ifndef HAVE_UINT8
typedef unsigned char uint8; /* == 8 bits */
typedef unsigned short uint16; /* == 16 bits */
typedef unsigned int uint32; /* == 32 bits */
#endif /* not HAVE_UINT8 */
#ifndef HAVE_INT64
typedef long int int64;
#endif
#ifndef HAVE_UINT64
typedef unsigned long int uint64;
#endif

View File

@ -7,4 +7,5 @@
*
***********************************************************************/
#include "pc_core.h"
#include "pc_c.h"
#include "pc_api.h"

View File

@ -2,20 +2,12 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pointcloud" to load this file. \quit
-- We need this for every point cloud, so we won't bury it in the XML
CREATE DOMAIN pointcloud_compression AS TEXT
CHECK (
VALUE = 'GHT' OR
VALUE = 'NONE'
);
-- Metadata table describing contents of pcpoints
CREATE TABLE pointcloud_formats (
pcid INTEGER PRIMARY KEY,
srid INTEGER, -- REFERENCE spatial_ref_sys(srid)
compression pointcloud_compression,
format XML
srid INTEGER, -- REFERENCES spatial_ref_sys(srid)
schema XML
);
-- Register pointcloud_formats table so the contents are included in pg_dump output
SELECT pg_catalog.pg_extension_config_dump('pointcloud_formats', '');