MobilityDB 1.1
tpoint.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2023, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2023, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
27 *
28 *****************************************************************************/
29
34#ifndef __TPOINT_H__
35#define __TPOINT_H__
36
37/* PostgreSQL */
38#include <postgres.h>
39/* PostGIS */
40#include <liblwgeom.h>
41/* MEOS */
42#include "general/temporal.h"
43#include "point/stbox.h"
44
45/*****************************************************************************
46 * Macros for manipulating the 'typmod' int. An int32_t used as follows:
47 * Plus/minus = Top bit.
48 * Spare bits = Next 2 bits.
49 * SRID = Next 21 bits.
50 * TYPE = Next 6 bits.
51 * ZM Flags = Bottom 2 bits.
52 *****************************************************************************/
53
54/* The following (commented out) definitions are taken from POSTGIS
55#define TYPMOD_GET_SRID(typmod) ((((typmod) & 0x0FFFFF00) - ((typmod) & 0x10000000)) >> 8)
56#define TYPMOD_SET_SRID(typmod, srid) ((typmod) = (((typmod) & 0xE00000FF) | ((srid & 0x001FFFFF)<<8)))
57#define TYPMOD_GET_TYPE(typmod) ((typmod & 0x000000FC)>>2)
58#define TYPMOD_SET_TYPE(typmod, type) ((typmod) = (typmod & 0xFFFFFF03) | ((type & 0x0000003F)<<2))
59#define TYPMOD_GET_Z(typmod) ((typmod & 0x00000002)>>1)
60#define TYPMOD_SET_Z(typmod) ((typmod) = typmod | 0x00000002)
61#define TYPMOD_GET_M(typmod) (typmod & 0x00000001)
62#define TYPMOD_SET_M(typmod) ((typmod) = typmod | 0x00000001)
63#define TYPMOD_GET_NDIMS(typmod) (2+TYPMOD_GET_Z(typmod)+TYPMOD_GET_M(typmod))
64*/
65
66/* In order to reuse the above (commented out) macros for manipulating the
67 typmod from POSTGIS we need to shift them to take into account that the
68 first 4 bits are taken for the temporal type */
69
70#define TYPMOD_DEL_SUBTYPE(typmod) (typmod = typmod >> 4 )
71#define TYPMOD_SET_SUBTYPE(typmod, subtype) ((typmod) = typmod << 4 | subtype)
72
73/*****************************************************************************/
74
75/* General functions */
76
77extern void temporalgeom_init();
79
80/* Temporal comparisons */
81
82extern Temporal *tcomp_tpoint_point(const Temporal *temp, const GSERIALIZED *gs,
83 Datum (*func)(Datum, Datum, meosType, meosType), bool invert);
84
85/*****************************************************************************/
86
87#endif
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:53
uintptr_t Datum
Definition: pg_ext_defs.in.h:4
Definition: postgis_ext_defs.in.h:139
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:136
void temporalgeom_init()
Set the handlers for initializing the liblwgeom library.
Definition: tpoint.c:96
Temporal * tcomp_tpoint_point(const Temporal *temp, const GSERIALIZED *gs, Datum(*func)(Datum, Datum, meosType, meosType), bool invert)
Return the temporal comparison of a temporal point and a point.
Definition: tpoint.c:124
GSERIALIZED * gserialized_copy(const GSERIALIZED *g)
General functions for temporal points.
Definition: tpoint.c:55