42#include "temporal/temporal.h"
43#include "temporal/meos_catalog.h"
63#define DatumGetSpanP(X) ((Span *) DatumGetPointer(X))
64#define SpanPGetDatum(X) PointerGetDatum(X)
65#define PG_GETARG_SPAN_P(X) DatumGetSpanP(PG_GETARG_DATUM(X))
66#define PG_RETURN_SPAN_P(X) PG_RETURN_POINTER(X)
69 #define DatumGetSpanSetP(X) ((SpanSet *) DatumGetPointer(X))
71 #define DatumGetSpanSetP(X) ((SpanSet *) PG_DETOAST_DATUM(X))
73#define SpanSetPGetDatum(X) PointerGetDatum(X)
74#define PG_GETARG_SPANSET_P(X) ((SpanSet *) PG_GETARG_VARLENA_P(X))
75#define PG_RETURN_SPANSET_P(X) PG_RETURN_POINTER(X)
102 bool hasdelta,
double scale);
106 bool hasshift,
bool haswidth,
Datum *delta,
double *scale);
int mi_span_span(const Span *s1, const Span *s2, Span *result)
Return in the last argument the difference of two spans.
Definition: span_ops.c:762
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:55
int span_upper_cmp(const Span *s1, const Span *s2)
Compare the upper bounds of two spans, returning <0, 0, or >0 according to whether the first bound is...
Definition: span.c:240
void span_bounds_shift_scale_time(const Interval *shift, const Interval *duration, TimestampTz *lower, TimestampTz *upper)
Shift and/or scale period bounds by two intervals.
Definition: span.c:1119
int mi_span_value(const Span *s, Datum value, Span *result)
Return in the last argument the difference of a span and a value.
Definition: span_ops.c:699
bool ensure_span_isof_type(const Span *s, meosType spantype)
Ensure that a span is of a given span type.
Definition: span.c:66
Datum span_decr_bound(Datum upper, meosType basetype)
Return the bound decreased by 1 for accounting for canonicalized spans.
Definition: span.c:286
int span_lower_cmp(const Span *s1, const Span *s2)
Compare the lower bounds of two spans, returning <0, 0, or >0 according to whether the first bound is...
Definition: span.c:214
Datum span_incr_bound(Datum upper, meosType basetype)
Return the bound increased by 1 for accounting for canonicalized spans.
Definition: span.c:262
double dist_double_value_value(Datum l, Datum r, meosType type)
Return the distance between two values as a double for the indexes.
Definition: span_ops.c:856
void numspan_shift_scale_iter(Span *s, Datum shift, Datum width, bool hasshift, bool haswidth, Datum *delta, double *scale)
Return a number span shifted and/or scaled by two values (iterator function)
Definition: span.c:1228
void span_bounds_shift_scale_value(Datum shift, Datum width, meosType type, bool hasshift, bool haswidth, Datum *lower, Datum *upper)
Shift and/or scale the span bounds by two values.
Definition: span.c:1087
void tstzspan_shift_scale1(Span *s, const Interval *shift, const Interval *duration, TimestampTz *delta, double *scale)
Return a timestamptz span shifted and/or scaled by two intervals.
Definition: span.c:1270
void span_deserialize(const Span *s, SpanBound *lower, SpanBound *upper)
Deconstruct a span.
Definition: span.c:125
void floatspan_floor_ceil_iter(Span *s, datum_func1 func)
Round down a span to the nearest integer.
Definition: span.c:852
bool ensure_valid_span_span(const Span *s1, const Span *s2)
Ensure that two span sets are of the same span type.
Definition: span.c:107
void tstzspan_delta_scale_iter(Span *s, TimestampTz origin, TimestampTz delta, double scale)
Shift and/or scale a timestamptz span by a delta and a scale.
Definition: span.c:1186
int span_bound_qsort_cmp(const void *s1, const void *s2)
Comparison function for sorting span bounds.
Definition: span.c:200
bool ensure_same_span_type(const Span *s1, const Span *s2)
Ensure that the spans have the same type.
Definition: span.c:93
bool ensure_span_isof_basetype(const Span *s, meosType basetype)
Ensure that a span is of a given base type.
Definition: span.c:79
void numspan_delta_scale_iter(Span *s, Datum origin, Datum delta, bool hasdelta, double scale)
Shift and/or scale a span by a delta and a scale (iterator function)
Definition: span.c:1143
Span * spanarr_normalize(Span *spans, int count, bool sort, int *newcount)
Normalize an array of spans.
Definition: span.c:317
int span_bound_cmp(const SpanBound *b1, const SpanBound *b2)
Compare two span boundary points, returning <0, 0, or >0 according to whether the first one is less t...
Definition: span.c:165
Datum(* datum_func1)(Datum)
Definition: temporal.h:295
External API of the Mobility Engine Open Source (MEOS) library.
int64 TimestampTz
Definition: postgres_ext_defs.in.h:22
uintptr_t Datum
Definition: postgres_ext_defs.in.h:7
unsigned char uint8
Definition: postgres_ext_defs.in.h:14
Definition: postgres_ext_defs.in.h:27
uint8 basetype
span basetype
Definition: span.h:56
bool lower
this is the lower (vs upper) bound
Definition: span.h:54
Datum val
bound value
Definition: span.h:52
uint8 spantype
span type
Definition: span.h:55
bool inclusive
bound is inclusive (vs exclusive)
Definition: span.h:53
Basic routines for spans (a.k.a.
Definition: span.h:51
Structure to represent spans (a.k.a.
Definition: meos.h:94