MobilityDB  1.0
Data Structures | Macros | Functions
tbox.h File Reference

Functions for temporal bounding boxes. More...

#include <postgres.h>
#include <catalog/pg_type.h>
#include <utils/rangetypes.h>
#include <utils/timestamp.h>
#include "timetypes.h"
Include dependency graph for tbox.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TBOX
 Structure to represent temporal boxes. More...
 

Macros

#define DatumGetTboxP(X)   ((TBOX *) DatumGetPointer(X))
 
#define TboxPGetDatum(X)   PointerGetDatum(X)
 
#define PG_GETARG_TBOX_P(n)   DatumGetTboxP(PG_GETARG_DATUM(n))
 
#define PG_RETURN_TBOX_P(x)   return TboxPGetDatum(x)
 

Functions

TBOXtbox_make (bool hasx, bool hast, double xmin, double xmax, TimestampTz tmin, TimestampTz tmax)
 Constructs a newly allocated temporal box. More...
 
void tbox_set (TBOX *box, bool hasx, bool hast, double xmin, double xmax, TimestampTz tmin, TimestampTz tmax)
 Set the temporal box from the argument values. More...
 
TBOXtbox_copy (const TBOX *box)
 Returns a copy of the temporal box value. More...
 
void tbox_expand (TBOX *box1, const TBOX *box2)
 Expand the first temporal box value with the second one. More...
 
void tbox_shift_tscale (TBOX *box, const Interval *start, const Interval *duration)
 Shift and/or scale the time span of the temporal box by the interval. More...
 
void ensure_has_X_tbox (const TBOX *box)
 Ensure that the temporal box has X values. More...
 
void ensure_has_T_tbox (const TBOX *box)
 Ensure that the temporal box has T values. More...
 
void ensure_same_dimensionality_tbox (const TBOX *box1, const TBOX *box2)
 Ensure that the temporal boxes have the same dimensionality. More...
 
Datum tbox_in (PG_FUNCTION_ARGS)
 Input function for temporal boxes. More...
 
Datum tbox_out (PG_FUNCTION_ARGS)
 Output function for temporal boxes. More...
 
Datum tbox_constructor (PG_FUNCTION_ARGS)
 Construct a temporal box value from the arguments. More...
 
Datum tbox_constructor_t (PG_FUNCTION_ARGS)
 Construct a temporal box value from the timestamps. More...
 
Datum tbox_to_floatrange (PG_FUNCTION_ARGS)
 Cast the temporal box value as a float range value. More...
 
Datum tbox_to_period (PG_FUNCTION_ARGS)
 Cast the temporal box value as a period value. More...
 
Datum int_to_tbox (PG_FUNCTION_ARGS)
 Transform the integer to a temporal box. More...
 
Datum float_to_tbox (PG_FUNCTION_ARGS)
 Transform the float to a temporal box. More...
 
Datum number_to_tbox (PG_FUNCTION_ARGS)
 
Datum range_to_tbox (PG_FUNCTION_ARGS)
 Transform the range to a temporal box. More...
 
Datum timestamp_to_tbox (PG_FUNCTION_ARGS)
 Transform the timestamp to a temporal box. More...
 
Datum period_to_tbox (PG_FUNCTION_ARGS)
 Transform the period to a temporal box. More...
 
Datum timestampset_to_tbox (PG_FUNCTION_ARGS)
 Transform the period set to a temporal box. More...
 
Datum periodset_to_tbox (PG_FUNCTION_ARGS)
 Transform the period set to a temporal box. More...
 
Datum int_timestamp_to_tbox (PG_FUNCTION_ARGS)
 Transform the integer and the timestamp to a temporal box. More...
 
Datum float_timestamp_to_tbox (PG_FUNCTION_ARGS)
 Transform the float and the timestamp to a temporal box. More...
 
Datum int_period_to_tbox (PG_FUNCTION_ARGS)
 Transform the integer and the period to a temporal box. More...
 
Datum float_period_to_tbox (PG_FUNCTION_ARGS)
 Transform the float and the period to a temporal box. More...
 
Datum range_timestamp_to_tbox (PG_FUNCTION_ARGS)
 Transform the range and the timestamp to a temporal box. More...
 
Datum range_period_to_tbox (PG_FUNCTION_ARGS)
 Transform the range and the period to a temporal box. More...
 
void number_to_box (TBOX *box, Datum value, Oid basetypid)
 Transform the value to a temporal box (internal function only) More...
 
void range_to_tbox_internal (TBOX *box, const RangeType *r)
 Transform the range to a temporal box (internal function) More...
 
void int_to_tbox_internal (TBOX *box, int i)
 Transform the integer to a temporal box (internal function) More...
 
void float_to_tbox_internal (TBOX *box, double d)
 Transform the float to a temporal box (internal function) More...
 
void timestamp_to_tbox_internal (TBOX *box, TimestampTz t)
 Transform the timestamp to a temporal box (internal function) More...
 
void timestampset_to_tbox_internal (TBOX *box, const TimestampSet *ts)
 Transform the period set to a temporal box (internal function) More...
 
void period_to_tbox_internal (TBOX *box, const Period *p)
 Transform the period to a temporal box (internal function) More...
 
void periodset_to_tbox_internal (TBOX *box, const PeriodSet *ps)
 Transform the period set to a temporal box (internal function) More...
 
Datum tbox_xmin (PG_FUNCTION_ARGS)
 Returns the minimum X value of the temporal box value. More...
 
Datum tbox_xmax (PG_FUNCTION_ARGS)
 Returns the maximum X value of the temporal box value. More...
 
Datum tbox_tmin (PG_FUNCTION_ARGS)
 Returns the minimum timestamp of the temporal box value. More...
 
Datum tbox_tmax (PG_FUNCTION_ARGS)
 Returns the maximum timestamp of the temporal box value. More...
 
Datum tbox_expand_value (PG_FUNCTION_ARGS)
 Expand the value dimension of the temporal box with the double value. More...
 
Datum tbox_expand_temporal (PG_FUNCTION_ARGS)
 Expand the time dimension of the temporal box with the interval value. More...
 
Datum tbox_set_precision (PG_FUNCTION_ARGS)
 Set the precision of the value dimension of the temporal box to the number of decimal places. More...
 
Datum contains_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box contains the second one. More...
 
Datum contained_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box is contained by the second one. More...
 
Datum overlaps_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the temporal boxes overlap. More...
 
Datum same_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the temporal boxes are equal on the common dimensions. More...
 
Datum adjacent_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the temporal boxes are adjacent. More...
 
bool contains_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box contains the second one (internal function) More...
 
bool contained_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box is contained by the second one (internal function) More...
 
bool overlaps_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the temporal boxes overlap (internal function) More...
 
bool same_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the temporal boxes are equal on the common dimensions (internal function) More...
 
bool adjacent_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the temporal boxes are adjacent (internal function) More...
 
Datum left_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box is strictly to the left of the second one. More...
 
Datum overleft_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box does not extend to the right of the second one. More...
 
Datum right_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box is strictly to the right of the second one. More...
 
Datum overright_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box does not extend to the left of the second one. More...
 
Datum before_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box is strictly before the second one. More...
 
Datum overbefore_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box does not extend after the second one. More...
 
Datum after_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box is strictly after the second one. More...
 
Datum overafter_tbox_tbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box does not extend before the second one. More...
 
bool left_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box is strictly to the left of the second one (internal function) More...
 
bool overleft_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box does not extend to the right of the second one (internal function) More...
 
bool right_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box is strictly to the right of the second one (internal function) More...
 
bool overright_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box does not extend to the left of the second one (internal function) More...
 
bool before_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box is strictly before the second one (internal function) More...
 
bool overbefore_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box does not extend after the second one (internal function) More...
 
bool after_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box is strictly after the second one (internal function) More...
 
bool overafter_tbox_tbox_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the first temporal box does not extend before the second one (internal function) More...
 
Datum tbox_union (PG_FUNCTION_ARGS)
 Returns the union of the temporal boxes. More...
 
Datum tbox_intersection (PG_FUNCTION_ARGS)
 Returns the intersection of the temporal boxes. More...
 
TBOXtbox_union_internal (const TBOX *box1, const TBOX *box2)
 Returns the union of the temporal boxes (internal function) More...
 
TBOXtbox_minus_internal (const TBOX *box1, const TBOX *box2)
 
TBOXtbox_intersection_internal (const TBOX *box1, const TBOX *box2)
 Returns the intersection of the temporal boxes (internal function) More...
 
Datum tbox_cmp (PG_FUNCTION_ARGS)
 Returns -1, 0, or 1 depending on whether the first temporal box value is less than, equal, or greater than the second one. More...
 
Datum tbox_lt (PG_FUNCTION_ARGS)
 Returns true if the first temporal box value is less than the second one. More...
 
Datum tbox_le (PG_FUNCTION_ARGS)
 Returns true if the first temporal box value is less than or equal to the second one. More...
 
Datum tbox_gt (PG_FUNCTION_ARGS)
 Returns true if the first temporal box value is greater than the second one. More...
 
Datum tbox_ge (PG_FUNCTION_ARGS)
 Returns true if the first temporal box value is greater than or equal to the second one. More...
 
Datum tbox_eq (PG_FUNCTION_ARGS)
 Returns true if the two temporal boxes are equal. More...
 
Datum tbox_ne (PG_FUNCTION_ARGS)
 Returns true if the two temporal boxes are different. More...
 
int tbox_cmp_internal (const TBOX *box1, const TBOX *box2)
 Returns -1, 0, or 1 depending on whether the first temporal box value is less than, equal to, or greater than the second one (internal function). More...
 
bool tbox_eq_internal (const TBOX *box1, const TBOX *box2)
 Returns true if the two temporal boxes are equal (internal function) More...
 

Detailed Description

Functions for temporal bounding boxes.