MobilityDB  1.0
Functions
temporal_util.h File Reference
#include <postgres.h>
#include <catalog/pg_type.h>
#include <utils/array.h>
#include <utils/rangetypes.h>
#include "temporal.h"
#include "point/postgis.h"
Include dependency graph for temporal_util.h:

Go to the source code of this file.

Functions

bool temporal_type (Oid temptypid)
 Returns true if the Oid is a EXTERNAL temporal type. More...
 
void ensure_temporal_base_type (Oid basetypid)
 Ensures that the Oid is a base type supported by MobilityDB. More...
 
bool base_type_continuous (Oid basetypid)
 Returns true if the Oid corresponds to a continuous base type. More...
 
void ensure_base_type_continuous (Temporal *temp)
 Ensures that the Oid is an internal or external base type that is continuous. More...
 
bool base_type_byvalue (Oid basetypid)
 Returns true if the values of the type are passed by value. More...
 
int16 base_type_length (Oid basetypid)
 Returns the length of type. More...
 
bool talpha_base_type (Oid basetypid)
 Returns true if the Oid is a alpha base type (i.e., those whose bounding box is a period) supported by MobilityDB. More...
 
bool tnumber_type (Oid temptypid)
 Returns true if the Oid is a temporal number type. More...
 
bool tnumber_base_type (Oid basetypid)
 Test whether the Oid is a number base type supported by MobilityDB. More...
 
void ensure_tnumber_base_type (Oid basetypid)
 Returns true if the Oid is a number base type supported by MobilityDB. More...
 
bool tnumber_range_type (Oid rangetype)
 Returns true if the Oid is a temporal number type. More...
 
void ensure_tnumber_range_type (Oid rangetype)
 Ensures that the Oid is a range type. More...
 
bool tspatial_type (Oid temptypid)
 Returns true if the Oid is a spatiotemporal type. More...
 
bool tspatial_base_type (Oid basetypid)
 Returns true if the Oid is a spatiotemporal type. More...
 
bool tgeo_base_type (Oid basetypid)
 Returns true if the Oid is a point base type supported by MobilityDB. More...
 
void ensure_tgeo_base_type (Oid basetypid)
 Ensures that the Oid is a point base type supported by MobilityDB. More...
 
bool type_has_precomputed_trajectory (Oid basetypid)
 Returns true if the temporal type corresponding to the Oid of the base type has its trajectory precomputed. More...
 
size_t temporal_bbox_size (Oid basetypid)
 Returns the size of the bounding box. More...
 
Oid range_oid_from_base (Oid basetypid)
 Returns the Oid of the range type corresponding to the Oid of the base type. More...
 
Oid temporal_oid_from_base (Oid basetypid)
 Returns the Oid of the temporal type corresponding to the Oid of the base type. More...
 
Oid base_oid_from_temporal (Oid temptypid)
 Returns the Oid of the base type corresponding to the Oid of the temporal type. More...
 
size_t double_pad (size_t size)
 Align to double. More...
 
Datum datum_copy (Datum value, Oid type)
 Copy a Datum if it is passed by reference. More...
 
double datum_double (Datum d, Oid basetypid)
 Convert a number to a double. More...
 
char * text2cstring (const text *textptr)
 Convert a text value into a C string. More...
 
Datum call_input (Oid type, char *str)
 Call input function of the base type. More...
 
char * call_output (Oid type, Datum value)
 Call output function of the base type. More...
 
bytea * call_send (Oid type, Datum value)
 Call send function of the base type. More...
 
Datum call_recv (Oid type, StringInfo buf)
 Call receive function of the base type. More...
 
Datum call_function1 (PGFunction func, Datum arg1)
 Call PostgreSQL function with 1 argument. More...
 
Datum call_function2 (PGFunction func, Datum arg1, Datum arg2)
 Call PostgreSQL function with 2 arguments. More...
 
Datum call_function3 (PGFunction func, Datum arg1, Datum arg2, Datum arg3)
 Call PostgreSQL function with 3 arguments. More...
 
Datum call_function4 (PGFunction func, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
 
Datum CallerFInfoFunctionCall4 (PGFunction func, FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
 
void pfree_array (void **array, int count)
 Free a C array of pointers. More...
 
void pfree_datumarr (Datum *array, int count)
 Free a C array of Datum pointers. More...
 
char * stringarr_to_string (char **strings, int count, int outlen, char *prefix, char open, char close)
 Returns the string resulting from assembling the array of strings. More...
 
Datum * datumarr_extract (ArrayType *array, int *count)
 Extract a C array from a PostgreSQL array containing datums. More...
 
TimestampTz * timestamparr_extract (ArrayType *array, int *count)
 Extract a C array from a PostgreSQL array containing timestamps. More...
 
Period ** periodarr_extract (ArrayType *array, int *count)
 Extract a C array from a PostgreSQL array containing periods. More...
 
RangeType ** rangearr_extract (ArrayType *array, int *count)
 Extract a C array from a PostgreSQL array containing ranges. More...
 
Temporal ** temporalarr_extract (ArrayType *array, int *count)
 Extract a C array from a PostgreSQL array containing temporal values. More...
 
ArrayType * datumarr_to_array (Datum *values, int count, Oid type)
 Convert a C array of datums into a PostgreSQL array. More...
 
ArrayType * timestamparr_to_array (const TimestampTz *times, int count)
 Convert a C array of timestamps into a PostgreSQL array. More...
 
ArrayType * periodarr_to_array (const Period **periods, int count)
 Convert a C array of periods into a PostgreSQL array. More...
 
ArrayType * rangearr_to_array (RangeType **ranges, int count, Oid type)
 Convert a C array of ranges into a PostgreSQL array. More...
 
ArrayType * textarr_to_array (text **textarr, int count)
 Convert a C array of text values into a PostgreSQL array. More...
 
ArrayType * temporalarr_to_array (const Temporal **temporal, int count)
 Convert a C array of temporal values into a PostgreSQL array. More...
 
ArrayType * stboxarr_to_array (STBOX *boxarr, int count)
 Convert a C array of spatiotemporal boxes into a PostgreSQL array. More...
 
void datumarr_sort (Datum *values, int count, Oid basetypid)
 Sort function for datums. More...
 
void timestamparr_sort (TimestampTz *times, int count)
 Sort function for timestamps. More...
 
void double2arr_sort (double2 *doubles, int count)
 
void double3arr_sort (double3 *triples, int count)
 
void periodarr_sort (Period **periods, int count)
 Sort function for double2 This function is currently not used void double2arr_sort(double2 *doubles, int count) { qsort(doubles, count, sizeof(double2), (qsort_comparator) &double2_cmp); }. More...
 
void rangearr_sort (RangeType **ranges, int count)
 Sort function for ranges. More...
 
void tinstantarr_sort (TInstant **instants, int count)
 Sort function for temporal instants. More...
 
void tsequencearr_sort (TSequence **sequences, int count)
 Sort function for temporal sequences. More...
 
int datumarr_remove_duplicates (Datum *values, int count, Oid basetypid)
 Remove duplicates from an array of datums. More...
 
int timestamparr_remove_duplicates (TimestampTz *values, int count)
 Remove duplicates from an array of timestamps. More...
 
int tinstantarr_remove_duplicates (const TInstant **instants, int count)
 Remove duplicates from an array of temporal instants. More...
 
int text_cmp (text *arg1, text *arg2, Oid collid)
 Comparison function for text values. More...
 
Datum datum_add (Datum l, Datum r, Oid typel, Oid typer)
 Returns the addition of the two numbers. More...
 
Datum datum_sub (Datum l, Datum r, Oid typel, Oid typer)
 Returns the subtraction of the two numbers. More...
 
Datum datum_mult (Datum l, Datum r, Oid typel, Oid typer)
 Returns the multiplication of the two numbers. More...
 
Datum datum_div (Datum l, Datum r, Oid typel, Oid typer)
 Returns the division of the two numbers. More...
 
bool datum_eq (Datum l, Datum r, Oid type)
 Returns true if the two values are equal. More...
 
bool datum_ne (Datum l, Datum r, Oid type)
 Returns true if the two values are different. More...
 
bool datum_lt (Datum l, Datum r, Oid type)
 Returns true if the first value is less than the second one. More...
 
bool datum_le (Datum l, Datum r, Oid type)
 Returns true if the first value is less than or equal to the second one. More...
 
bool datum_gt (Datum l, Datum r, Oid type)
 Returns true if the first value is greater than the second one. More...
 
bool datum_ge (Datum l, Datum r, Oid type)
 
bool datum_eq2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns true if the first value is greater than or equal to the second one This function is currently not used bool datum_ge(Datum l, Datum r, Oid type) { return datum_eq2(l, r, type, type) || datum_lt2(r, l, type, type); }. More...
 
bool datum_ne2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns true if the two values are different. More...
 
bool datum_lt2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns true if the first value is less than the second one (base type dispatch function) More...
 
bool datum_le2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns true if the first value is less than or equal to the second one. More...
 
bool datum_gt2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns true if the first value is greater than the second one. More...
 
bool datum_ge2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns true if the first value is greater than or equal to the second one. More...
 
Datum datum2_eq2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns a Datum true if the two values are equal. More...
 
Datum datum2_ne2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns a Datum true if the two values are different. More...
 
Datum datum2_lt2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns a Datum true if the first value is less than the second one. More...
 
Datum datum2_le2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns a Datum true if the first value is less than or equal to the second one. More...
 
Datum datum2_gt2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns a Datum true if the first value is greater than the second one. More...
 
Datum datum2_ge2 (Datum l, Datum r, Oid typel, Oid typer)
 Returns a Datum true if the first value is greater than or equal to the second one. More...
 
double hypot3d (double x, double y, double z)
 Determine the 3D hypotenuse. More...
 
double hypot4d (double x, double y, double z, double m)
 Determine the 4D hypotenuse. More...