MobilityDB 1.1
Data Structures | Macros | Typedefs | Enumerations | Functions
temporal.h File Reference
#include <postgres.h>
#include "general/meos_catalog.h"
#include "general/span.h"
#include "general/set.h"
#include "general/tbox.h"
#include "point/stbox.h"
Include dependency graph for temporal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  bboxunion
 Structure to represent all types of bounding boxes. More...
 
struct  double2
 Structure to represent values of the internal type for computing aggregates for temporal number types. More...
 
struct  double3
 Structure to represent values of the internal type for computing aggregates for 2D temporal point types. More...
 
struct  double4
 Structure to represent values of the internal type for computing aggregates for 3D temporal point types. More...
 

Macros

#define ALWAYS   false
 
#define ANYTEMPSUBTYPE   0
 Enumeration for the concrete subtype of temporal types. More...
 
#define BBOX_TEST   true
 Symbolic constants for the synchronization and the aggregation functions. More...
 
#define BBOX_TEST_NO   false
 
#define C_COLLATION_OID   950
 
#define CONTINUOUS   false
 
#define CROSSINGS   true
 Symbolic constants for the synchronization and the aggregation functions. More...
 
#define CROSSINGS_NO   false
 
#define DATUM_FREE(value, basetype)
 
#define DATUM_FREE_IF_COPY(value, basetype, n)
 
#define DatumGetDouble2P(X)   ((double2 *) DatumGetPointer(X))
 
#define DatumGetDouble3P(X)   ((double3 *) DatumGetPointer(X))
 
#define DatumGetDouble4P(X)   ((double4 *) DatumGetPointer(X))
 
#define DatumGetGserializedP(X)   ((GSERIALIZED *) DatumGetPointer(X))
 Macro for accessing the GSERIALIZED value of a temporal point. More...
 
#define DatumGetTemporalP(X)   ((Temporal *) DatumGetPointer(X))
 
#define DatumGetTextP(X)   ((text *) DatumGetPointer(X))
 
#define DEFAULT_BIGINTSPAN_ORIGIN   (0)
 
#define DEFAULT_COLLATION_OID   100
 
#define DEFAULT_FLOATSPAN_ORIGIN   (0.0)
 
#define DEFAULT_INTSPAN_ORIGIN   (0)
 
#define DEFAULT_TIME_ORIGIN   (JAN_3_2000)
 
#define DISCONTINUOUS   true
 Symbolic constants for lifting. More...
 
#define DIST_EPSILON   1.0e-06
 Precision for distance operations. More...
 
#define Double2PGetDatum(X)   PointerGetDatum(X)
 
#define Double3PGetDatum(X)   PointerGetDatum(X)
 
#define Double4PGetDatum(X)   PointerGetDatum(X)
 
#define EVER   true
 Symbolic constants for the ever/always functions. More...
 
#define GET_MAX   false
 
#define GET_MIN   true
 Symbolic constants for the restriction and the aggregation functions. More...
 
#define INVERT   true
 Symbolic constants for lifting. More...
 
#define INVERT_NO   false
 
#define JAN_3_2000   (2 * USECS_PER_DAY)
 
#define MERGE   true
 Symbolic constants for the make functions. More...
 
#define MERGE_NO   false
 
#define MOBDB_EPSILON   1.0e-06
 Floating point precision. More...
 
#define MOBDB_FLAG_BYVAL   0x0001
 
#define MOBDB_FLAG_CONTINUOUS   0x0002
 
#define MOBDB_FLAG_GEODETIC   0x0080
 
#define MOBDB_FLAG_ORDERED   0x0002
 
#define MOBDB_FLAG_T   0x0040
 
#define MOBDB_FLAG_X   0x0010
 
#define MOBDB_FLAG_Z   0x0020
 
#define MOBDB_FLAGS_GET_BYVAL(flags)   ((bool) (((flags) & MOBDB_FLAG_BYVAL)))
 
#define MOBDB_FLAGS_GET_CONTINUOUS(flags)   ((bool) (((flags) & MOBDB_FLAG_CONTINUOUS)>>1))
 
#define MOBDB_FLAGS_GET_DISCRETE(flags)   ((bool) (MOBDB_FLAGS_GET_INTERP((flags)) == DISCRETE))
 
#define MOBDB_FLAGS_GET_GEODETIC(flags)   ((bool) (((flags) & MOBDB_FLAG_GEODETIC)>>7))
 
#define MOBDB_FLAGS_GET_INTERP(flags)   (((flags) & MOBDB_FLAGS_INTERP) >> 2)
 
#define MOBDB_FLAGS_GET_LINEAR(flags)   ((bool) (MOBDB_FLAGS_GET_INTERP((flags)) == LINEAR))
 
#define MOBDB_FLAGS_GET_ORDERED(flags)   ((bool) (((flags) & MOBDB_FLAG_ORDERED)>>1))
 
#define MOBDB_FLAGS_GET_STEP(flags)   ((bool) (MOBDB_FLAGS_GET_INTERP((flags)) == STEP))
 
#define MOBDB_FLAGS_GET_T(flags)   ((bool) (((flags) & MOBDB_FLAG_T)>>6))
 
#define MOBDB_FLAGS_GET_X(flags)   ((bool) (((flags) & MOBDB_FLAG_X)>>4))
 
#define MOBDB_FLAGS_GET_Z(flags)   ((bool) (((flags) & MOBDB_FLAG_Z)>>5))
 
#define MOBDB_FLAGS_INTERP   0x000C
 
#define MOBDB_FLAGS_SET_BYVAL(flags, value)    ((flags) = (value) ? ((flags) | MOBDB_FLAG_BYVAL) : ((flags) & ~MOBDB_FLAG_BYVAL))
 
#define MOBDB_FLAGS_SET_CONTINUOUS(flags, value)    ((flags) = (value) ? ((flags) | MOBDB_FLAG_CONTINUOUS) : ((flags) & ~MOBDB_FLAG_CONTINUOUS))
 
#define MOBDB_FLAGS_SET_GEODETIC(flags, value)    ((flags) = (value) ? ((flags) | MOBDB_FLAG_GEODETIC) : ((flags) & ~MOBDB_FLAG_GEODETIC))
 
#define MOBDB_FLAGS_SET_INTERP(flags, value)   ((flags) = (((flags) & ~MOBDB_FLAGS_INTERP) | ((value & 0x0003) << 2)))
 
#define MOBDB_FLAGS_SET_ORDERED(flags, value)    ((flags) = (value) ? ((flags) | MOBDB_FLAG_ORDERED) : ((flags) & ~MOBDB_FLAG_ORDERED))
 
#define MOBDB_FLAGS_SET_T(flags, value)    ((flags) = (value) ? ((flags) | MOBDB_FLAG_T) : ((flags) & ~MOBDB_FLAG_T))
 
#define MOBDB_FLAGS_SET_X(flags, value)    ((flags) = (value) ? ((flags) | MOBDB_FLAG_X) : ((flags) & ~MOBDB_FLAG_X))
 
#define MOBDB_FLAGS_SET_Z(flags, value)    ((flags) = (value) ? ((flags) | MOBDB_FLAG_Z) : ((flags) & ~MOBDB_FLAG_Z))
 
#define MOBDB_FP_EQ(A, B)   (fabs((A)-(B)) <= MOBDB_EPSILON)
 
#define MOBDB_FP_GE(A, B)   (((A) + MOBDB_EPSILON) >= (B))
 
#define MOBDB_FP_GT(A, B)   (((A) - MOBDB_EPSILON) > (B))
 
#define MOBDB_FP_LE(A, B)   (((A) - MOBDB_EPSILON) <= (B))
 
#define MOBDB_FP_LT(A, B)   (((A) + MOBDB_EPSILON) < (B))
 
#define MOBDB_FP_NE(A, B)   (fabs((A)-(B)) > MOBDB_EPSILON)
 
#define MOBDB_WKB_BYTE_SIZE   1
 
#define MOBDB_WKB_DOUBLE_SIZE   8
 
#define MOBDB_WKB_GEODETICFLAG   0x20
 
#define MOBDB_WKB_GET_INTERP(flags)   (((flags) & MOBDB_WKB_INTERPFLAGS) >> 2)
 
#define MOBDB_WKB_INT2_SIZE   2
 
#define MOBDB_WKB_INT4_SIZE   4
 
#define MOBDB_WKB_INT8_SIZE   8
 
#define MOBDB_WKB_INTERPFLAGS   0x0C
 
#define MOBDB_WKB_LOWER_INC   0x01
 
#define MOBDB_WKB_ORDERED   0x01
 
#define MOBDB_WKB_SET_INTERP(flags, value)   ((flags) = (((flags) & ~MOBDB_WKB_INTERPFLAGS) | ((value & 0x0003) << 2)))
 
#define MOBDB_WKB_SRIDFLAG   0x40
 
#define MOBDB_WKB_TFLAG   0x02
 
#define MOBDB_WKB_TIMESTAMP_SIZE   8
 
#define MOBDB_WKB_UPPER_INC   0x02
 
#define MOBDB_WKB_XFLAG   0x01
 
#define MOBDB_WKB_ZFLAG   0x10
 
#define NDR   1 /* little endian */
 
#define NO_Z   false
 
#define NORMALIZE   true
 
#define NORMALIZE_NO   false
 
#define ORDERED   true
 Symbolic constants for sets. More...
 
#define ORDERED_NO   false
 
#define PG_DATUM_NEEDS_DETOAST(datum)
 
#define PG_FREE_IF_COPY_P(ptrsrc, ptrori)
 This macro is based on PG_FREE_IF_COPY, except that it accepts two pointers. More...
 
#define PG_GETARG_TEMPORAL_P(X)   ((Temporal *) PG_GETARG_VARLENA_P(X))
 
#define PG_GETARG_TINSTANT_P(X)   ((TInstant *) PG_GETARG_VARLENA_P(X))
 
#define PG_GETARG_TSEQUENCE_P(X)   ((TSequence *) PG_GETARG_VARLENA_P(X))
 
#define PG_GETARG_TSEQUENCESET_P(X)   ((TSequenceSet *) PG_GETARG_VARLENA_P(X))
 
#define POSIX_COLLATION_OID   951
 
#define QUOTES   true
 Symbolic constants for the output of string elements. More...
 
#define QUOTES_NO   false
 
#define REST_AT   true
 Symbolic constants for the restriction functions. More...
 
#define REST_MINUS   false
 
#define SORT   true
 Symbolic constants for the normalizing spans. More...
 
#define SORT_NO   false
 
#define SPACES   true
 Symbolic constants for the output of string elements. More...
 
#define SPACES_NO   false
 
#define SPAN_ROUNDOFF   false
 
#define TIME_SEL   false
 
#define TINSTANT   1
 
#define TSEQUENCE   2
 
#define TSEQUENCESET   3
 
#define UPPER_EXC   false
 
#define UPPER_INC   true
 Symbolic constants for the restriction functions with boxes. More...
 
#define VALUE_SEL   true
 Symbolic constants for the span selectivity functions. More...
 
#define WITH_Z   true
 Symbolic constants for spatial relationships. More...
 
#define XDR   0 /* big endian */
 

Typedefs

typedef union bboxunion bboxunion
 Structure to represent all types of bounding boxes. More...
 
typedef Datum(* datum_func2) (Datum, Datum)
 
typedef Datum(* datum_func3) (Datum, Datum, Datum)
 
typedef char *(* outfunc) (Datum value, meosType type, int maxdd)
 
typedef int(* qsort_comparator) (const void *a, const void *b)
 
typedef Datum(* varfunc) (Datum,...)
 

Enumerations

enum  MOBDB_WKB_TSUBTYPE { MOBDB_WKB_TINSTANT = 1 , MOBDB_WKB_TSEQUENCE = 2 , MOBDB_WKB_TSEQUENCESET = 3 }
 
enum  SetOper { UNION , INTER , MINUS }
 Enumeration for the set operations of span and temporal types. More...
 
enum  SyncMode { SYNCHRONIZE_NOCROSS , SYNCHRONIZE_CROSS }
 Enumeration for the intersection/synchronization functions. More...
 
enum  TemporalFamily { TEMPORALTYPE , TNUMBERTYPE , TPOINTTYPE , TNPOINTTYPE }
 Enumeration for the families of temporal types. More...
 

Functions

textcstring_to_text (const char *s)
 Basic functions for temporal types of any subtype. More...
 
void ensure_common_dimension (int16 flags1, int16 flags2)
 Ensure that two temporal values have at least one common dimension based on their flags. More...
 
void ensure_continuous (const Temporal *temp)
 Ensure that the subtype of temporal type is a sequence (set) More...
 
void ensure_continuous_interpolation (int16 flags)
 Ensure that a temporal value has continuous interpolation. More...
 
void ensure_discrete_interpolation (int16 flags)
 Ensure that a temporal value has discrete interpolation. More...
 
void ensure_increasing_timestamps (const TInstant *inst1, const TInstant *inst2, bool strict)
 Ensure that the timestamp of the first temporal instant is smaller (or equal if the merge parameter is true) than the one of the second temporal instant. More...
 
void ensure_nonlinear_interpolation (int16 flags)
 Ensure that a temporal value does not have linear interpolation. More...
 
void ensure_positive_datum (Datum size, meosType basetype)
 Ensure that the number is positive. More...
 
void ensure_same_interpolation (const Temporal *temp1, const Temporal *temp2)
 Ensure that two temporal values have the same interpolation. More...
 
void ensure_same_temptype (const Temporal *temp1, const Temporal *temp2)
 Ensure that two temporal values have the same base type. More...
 
void ensure_tinstarr (const TInstant **instants, int count)
 Ensure that the elements of an array are of instant subtype. More...
 
void ensure_valid_duration (const Interval *duration)
 Ensure that the interval is a positive and absolute duration. More...
 
void ensure_valid_tempsubtype (int16 type)
 Basic functions for temporal types of any subtype. More...
 
void ensure_valid_tempsubtype_all (int16 type)
 Ensure that the subtype of a temporal value is valid. More...
 
void ensure_valid_tinstarr (const TInstant **instants, int count, bool merge, interpType interp)
 Ensure that all temporal instants of the array have increasing timestamp (or may be equal if the merge parameter is true), and if they are temporal points, have the same srid and the same dimensionality. More...
 
int * ensure_valid_tinstarr_gaps (const TInstant **instants, int count, bool merge, interpType interp, double maxdist, Interval *maxt, int *countsplits)
 Ensure that all temporal instants of the array have increasing timestamp (or may be equal if the merge parameter is true), and if they are temporal points, have the same srid and the same dimensionality. More...
 
void ensure_valid_tseqarr (const TSequence **sequences, int count)
 Ensure that all temporal instants of the array have increasing timestamp, and if they are temporal points, have the same srid and the same dimensionality. More...
 
bool intersection_temporal_temporal (const Temporal *temp1, const Temporal *temp2, SyncMode mode, Temporal **inter1, Temporal **inter2)
 Temporally intersect the two temporal values. More...
 
char * mobilitydb_full_version (void)
 Versions of the MobilityDB extension and its dependencies. More...
 
char * mobilitydb_version (void)
 Version of the MobilityDB extension. More...
 
bool temporal_bbox_ev_al_eq (const Temporal *temp, Datum value, bool ever)
 Return true if the bounding box of a temporal value is ever/always equal to a base value. More...
 
bool temporal_bbox_ev_al_lt_le (const Temporal *temp, Datum value, bool ever)
 Return true if the bounding box of a temporal value is ever/always less than or equal to the base value. More...
 
void * temporal_bbox_ptr (const Temporal *temp)
 Return a pointer to the precomputed bounding box of a temporal value. More...
 
bool temporal_bbox_restrict_set (const Temporal *temp, const Set *set)
 Return true if the bounding box of the temporal and the set overlap values. More...
 
bool temporal_bbox_restrict_value (const Temporal *temp, Datum value)
 Return true if the bounding box of a temporal value contains a base value. More...
 
Datumtemporal_bbox_restrict_values (const Temporal *temp, const Datum *values, int count, int *newcount)
 
void temporal_bbox_slice (Datum tempdatum, void *box)
 Peak into a temporal datum to find the bounding box. More...
 
Temporaltemporal_restrict_minmax (const Temporal *temp, bool min, bool atfunc)
 Restrict a temporal value to (the complement of) a minimum base value. More...
 
char * text_to_cstring (const text *t)