36 #ifndef __TSEQUENCE_H__ 37 #define __TSEQUENCE_H__ 40 #include <catalog/pg_type.h> 41 #include <utils/array.h> 42 #include <utils/rangetypes.h> 56 const TInstant *inst2,
bool linear, TimestampTz t);
58 int count,
int *newcount);
60 int *countseqs,
int count,
int totalseqs);
77 Datum value, Oid basetypid, Datum *inter, TimestampTz *t);
79 Datum value, Oid basetypid, TimestampTz *t);
82 Datum *inter1, Datum *inter2, TimestampTz *t);
85 Datum *value, TimestampTz *t);
143 const Interval *start,
const Interval *duration);
156 Datum value,
bool atfunc);
160 Datum value,
bool atfunc);
162 Datum value,
bool atfunc);
164 const Datum *values,
int count);
166 const Datum *values,
int count,
bool atfunc);
168 const RangeType *range,
bool atfunc);
170 const RangeType *range,
bool atfunc);
172 RangeType **normranges,
int count,
bool atfunc,
bool bboxtest);
174 RangeType **normranges,
int count,
bool atfunc,
bool bboxtest);
176 bool min,
bool atfunc);
178 const TInstant *inst2,
bool linear, TimestampTz t);
bool synchronize_tsequence_tsequence(const TSequence *seq1, const TSequence *seq2, TSequence **sync1, TSequence **sync2, bool interpoint)
Synchronize the two temporal values.
Definition: tsequence.c:1299
TSequence * tsequence_read(StringInfo buf, Oid basetypid)
Returns a new temporal value from its binary representation read from the buffer (dispatch function) ...
Definition: tsequence.c:1491
Temporal * tsequence_append_tinstant(const TSequence *seq, const TInstant *inst)
Append an instant to the temporal value.
Definition: tsequence.c:930
Structure to represent periods.
Definition: timetypes.h:52
int tfloatseq_ranges1(RangeType **result, const TSequence *seq)
Returns the ranges of base values of the temporal float with stepwise interpolation.
Definition: tsequence.c:1755
bool tsequence_intersects_timestampset(const TSequence *seq, const TimestampSet *t)
Returns true if the temporal value intersects the timestamp set.
Definition: tsequence.c:3982
bool tsequence_always_eq(const TSequence *seq, Datum value)
Returns true if the temporal value is always equal to the base value.
Definition: tsequence.c:2148
int tsequence_segments(TSequence **result, const TSequence *seq)
Returns the segments of the temporal value as a C array.
Definition: tsequence.c:1904
bool tnumber_min_dist_at_timestamp(const TInstant *start1, const TInstant *end1, bool linear1, const TInstant *start2, const TInstant *end2, bool linear2, Datum *value, TimestampTz *t)
Returns true if the two segments of the temporal values intersect at the timestamp.
Definition: tsequence.c:285
int tsequence_minus_period1(TSequence **result, const TSequence *seq, const Period *p)
Restricts the temporal value to the complement of the period.
Definition: tsequence.c:3777
int tsequence_timestamps1(TimestampTz *result, const TSequence *seq)
Returns the timestamps of the temporal value as a C array.
Definition: tsequence.c:2009
bool tsequence_ever_le(const TSequence *seq, Datum value)
Returns true if the temporal value is ever less than or equal to the base value.
Definition: tsequence.c:2249
int tsequence_at_periodset(TSequence **result, const TSequence *seq, const PeriodSet *ps)
Restricts the temporal value to the period set.
Definition: tsequence.c:3835
Datum tsequence_max_value(const TSequence *seq)
Returns the maximum base value of the temporal value.
Definition: tsequence.c:1858
TSequence * tinstantset_to_tsequence(const TInstantSet *ti, bool linear)
Transform the temporal instant set value into a temporal sequence value.
Definition: tsequence.c:1568
TSequence ** tsequencearr_normalize(const TSequence **sequences, int count, int *newcount)
Normalize the array of temporal sequence values.
Definition: tsequence.c:829
TimestampTz tsequence_start_timestamp(const TSequence *seq)
Returns the start timestamp of the temporal value.
Definition: tsequence.c:1991
TSequenceSet * tnumberseq_restrict_ranges(const TSequence *seq, RangeType **normranges, int count, bool atfunc, bool bboxtest)
Restricts the temporal number to (the complement of) the array of ranges of base values.
Definition: tsequence.c:3173
TSequence * tsequence_make_free(TInstant **instants, int count, bool lower_inc, bool upper_inc, bool linear, bool normalize)
Construct a temporal sequence value from the array of temporal instant values and free the array and ...
Definition: tsequence.c:720
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: temporal.h:241
TSequenceSet * tstepseq_to_linear(const TSequence *seq)
Transform the temporal sequence value with continuous base type from stepwise to linear interpolation...
Definition: tsequence.c:1647
bool tsequence_always_lt(const TSequence *seq, Datum value)
Returns true if the temporal value is always less than the base value.
Definition: tsequence.c:2289
TimestampTz tsequence_end_timestamp(const TSequence *seq)
Returns the end timestamp of the temporal value.
Definition: tsequence.c:2000
int tsequence_values(Datum *result, const TSequence *seq)
Returns the distinct base values of the temporal value with stepwise interpolation.
Definition: tsequence.c:1667
int tsequence_find_timestamp(const TSequence *seq, TimestampTz t)
Returns the index of the segment of the temporal sequence value containing the timestamp using binary...
Definition: tsequence.c:1126
int tsequence_minus_value(TSequence **result, const TSequence *seq, Datum value)
void normalize(POINT3D *p)
PeriodSet * tsequence_get_time(const TSequence *seq)
Returns the time on which the temporal value is defined as a period set.
Definition: tsequence.c:1796
bool tlinearseq_intersection_value(const TInstant *inst1, const TInstant *inst2, Datum value, Oid basetypid, Datum *inter, TimestampTz *t)
Returns true if the segment of the temporal value intersects the base value at the timestamp...
Definition: tsequence.c:127
TInstantSet * tsequence_at_timestampset(const TSequence *seq, const TimestampSet *ts)
Restricts the temporal value to the timestamp set.
Definition: tsequence.c:3519
bool intersection_tsequence_tinstantset(const TSequence *seq, const TInstantSet *ti, TInstantSet **inter1, TInstantSet **inter2)
Temporally intersect the two temporal values.
Definition: tsequence.c:1229
bool tsequence_always_le(const TSequence *seq, Datum value)
Returns true if the temporal value is always less than or equal to the base value.
Definition: tsequence.c:2330
bool tsequence_intersects_periodset(const TSequence *seq, const PeriodSet *ps)
Returns true if the temporal value intersects the period set.
Definition: tsequence.c:4003
bool tsequence_eq(const TSequence *seq1, const TSequence *seq2)
Returns true if the two temporal sequence values are equal.
Definition: tsequence.c:4074
double tnumberseq_integral(const TSequence *seq)
Returns the integral (area under the curve) of the temporal number.
Definition: tsequence.c:4019
Datum tsequence_duration(const TSequence *seq)
Returns the duration of the temporal value.
Definition: tsequence.c:1884
const TInstant * tsequence_inst_at_timestamp_excl(const TSequence *seq, TimestampTz t)
Returns the temporal instant at the timestamp for timestamps that are at an exclusive bound...
Definition: tsequence.c:3350
int tsequence_at_value(TSequence **result, const TSequence *seq, Datum value, bool atfunc)
TSequenceSet * tsequence_restrict_minmax(const TSequence *seq, bool min, bool atfunc)
Restricts the temporal value to (the complement of) the minimum/maximum base value.
Definition: tsequence.c:3194
bool tsequence_intersects_period(const TSequence *seq, const Period *p)
Returns true if the temporal value intersects the period.
Definition: tsequence.c:3994
TInstant * tsequence_at_timestamp1(const TInstant *inst1, const TInstant *inst2, bool linear, TimestampTz t)
Restricts the segment of a temporal value to the timestamp.
Definition: tsequence.c:3370
TSequenceSet * tsequence_minus_timestamp(const TSequence *seq, TimestampTz t)
Restricts the temporal value to the complement of the timestamp.
Definition: tsequence.c:3500
int tsequence_minus_timestamp1(TSequence **result, const TSequence *seq, TimestampTz t)
Restricts the temporal value to the complement of the timestamp.
Definition: tsequence.c:3419
bool tsequence_value_at_timestamp_inc(const TSequence *seq, TimestampTz t, Datum *result)
Returns the base value of the temporal value at the timestamp when the timestamp may be at an exclusi...
Definition: tsequence.c:3333
Datum tsequence_from_base(PG_FUNCTION_ARGS)
Construct a temporal sequence value from a base value and a period.
Definition: tsequence.c:766
int tsequence_restrict_value2(TSequence **result, const TSequence *seq, Datum value, bool atfunc)
Restricts the temporal value to the base value.
Definition: tsequence.c:2505
TSequence * tsequence_at_period(const TSequence *seq, const Period *p)
Restricts the temporal value to the period.
Definition: tsequence.c:3701
bool intersection_tinstant_tsequence(const TInstant *inst, const TSequence *seq, TInstant **inter1, TInstant **inter2)
Temporally intersect the two temporal values.
Definition: tsequence.c:1215
Basic functions for temporal types of any subtype.
TSequence * tsequenceset_to_tsequence(const TSequenceSet *ts)
Transform the temporal sequence set value into a temporal sequence value.
Definition: tsequence.c:1580
TSequence ** tsequence_merge_array1(const TSequence **sequences, int count, int *totalcount)
Merge the array of temporal sequence values.
Definition: tsequence.c:1033
int tsequence_at_values1(TSequence **result, const TSequence *seq, const Datum *values, int count)
Restricts the temporal value to the array of base values.
Definition: tsequence.c:2589
bool tlinearseq_intersection_value1(const TInstant *inst1, const TInstant *inst2, Datum value, Oid basetypid, TimestampTz *t)
int tsequence_minus_timestampset1(TSequence **result, const TSequence *seq, const TimestampSet *ts)
Restricts the temporal value to the complement of the timestamp set.
Definition: tsequence.c:3575
Structure to represent period sets.
Definition: timetypes.h:84
TSequenceSet * tsequence_restrict_periodset(const TSequence *seq, const PeriodSet *ps, bool atfunc)
Restricts the temporal value to the (complement of the) period set.
Definition: tsequence.c:3940
RangeType * tfloatseq_range(const TSequence *seq)
Returns the range of base values of the temporal float.
Definition: tsequence.c:1701
TSequenceSet * tsequence_minus_period(const TSequence *seq, const Period *p)
Restricts the temporal value to the complement of the period.
Definition: tsequence.c:3808
TSequence * tsequence_copy(const TSequence *seq)
Returns a copy of the temporal value.
Definition: tsequence.c:1096
bool tsequence_intersects_timestamp(const TSequence *seq, TimestampTz t)
Returns true if the temporal value intersects the timestamp.
Definition: tsequence.c:3973
TSequenceSet * tsequence_restrict_values(const TSequence *seq, const Datum *values, int count, bool atfunc)
Restricts the temporal value to (the complement of) the array of base values.
Definition: tsequence.c:2649
bool tsequence_ever_lt(const TSequence *seq, Datum value)
Returns true if the temporal value is ever less than the base value.
Definition: tsequence.c:2229
char * tsequence_to_string(const TSequence *seq, bool component, char *(*value_out)(Oid, Datum))
Returns the string representation of the temporal value.
Definition: tsequence.c:1435
ArrayType * tsequence_values_array(const TSequence *seq)
Returns the base values of the temporal value with stepwise interpolation.
Definition: tsequence.c:1688
const TInstant * tsequence_min_instant(const TSequence *seq)
Returns a pointer to the instant with minimum base value of the temporal value.
Definition: tsequence.c:1812
TSequenceSet * tsequence_restrict_value(const TSequence *seq, Datum value, bool atfunc)
Restricts the temporal value to (the complement of) the base value.
Definition: tsequence.c:2563
Temporal * tsequence_merge_array(const TSequence **sequences, int count)
Merge the array of temporal sequence values.
Definition: tsequence.c:1076
ArrayType * tsequence_segments_array(const TSequence *seq)
Returns the segments of the temporal value as a PostgreSQL array.
Definition: tsequence.c:1951
int tnumberseq_restrict_ranges1(TSequence **result, const TSequence *seq, RangeType **normranges, int count, bool atfunc, bool bboxtest)
Restricts the temporal number to the (complement of the) array of ranges of base values.
Definition: tsequence.c:3053
Structure to represent temporal values of sequence set subtype.
Definition: temporal.h:293
TSequence * tsequence_shift_tscale(const TSequence *seq, const Interval *start, const Interval *duration)
Shift and/or scale the time span of the temporal value by the two intervals.
Definition: tsequence.c:2035
Structure to represent timestamp sets.
Definition: timetypes.h:73
TSequenceSet * tnumberseq_restrict_range(const TSequence *seq, const RangeType *range, bool atfunc)
Restricts the temporal number to the (complement of the) range of base values.
Definition: tsequence.c:3023
int tnumberseq_restrict_range2(TSequence **result, const TSequence *seq, const RangeType *range, bool atfunc)
Restricts the temporal number to the (complement of the) range of base values.
Definition: tsequence.c:2960
bool intersection_tinstantset_tsequence(const TInstantSet *ti, const TSequence *seq, TInstantSet **inter1, TInstantSet **inter2)
Temporally intersect the two temporal values.
Definition: tsequence.c:1272
ArrayType * tsequence_timestamps(const TSequence *seq)
Returns the timestamps of the temporal value as a PostgreSQL array.
Definition: tsequence.c:2020
void tsequence_write(const TSequence *seq, StringInfo buf)
Write the binary representation of the temporal value into the buffer.
Definition: tsequence.c:1466
uint32 tsequence_hash(const TSequence *seq)
Returns the hash value of the temporal value.
Definition: tsequence.c:4147
int tstepseq_to_linear1(TSequence **result, const TSequence *seq)
Transform the temporal sequence value with continuous base type from stepwise to linear interpolation...
Definition: tsequence.c:1598
TSequence * tsequence_make(const TInstant **instants, int count, bool lower_inc, bool upper_inc, bool linear, bool normalize)
Construct a temporal sequence value from the array of temporal instant values.
Definition: tsequence.c:701
Datum tsequence_value_at_timestamp1(const TInstant *inst1, const TInstant *inst2, bool linear, TimestampTz t)
Returns the base value of the segment of the temporal value at the timestamp.
Definition: tsequence.c:3213
ArrayType * tsequence_instants_array(const TSequence *seq)
Returns the distinct instants of the temporal value as a PostgreSQL array.
Definition: tsequence.c:1978
TSequence * tsequence_from_base_internal(Datum value, Oid basetypid, const Period *p, bool linear)
Construct a temporal sequence value from a base value and a period (internal function) ...
Definition: tsequence.c:740
Structure to represent temporal values of instant set subtype.
Definition: temporal.h:266
TSequence * tintseq_to_tfloatseq(const TSequence *seq)
Cast the temporal integer value as a temporal float value.
Definition: tsequence.c:1512
TSequence ** tsequencearr2_to_tsequencearr(TSequence ***sequences, int *countseqs, int count, int totalseqs)
Convert an array of arrays of temporal sequence values into an array of sequence values.
Definition: tsequence.c:1165
TSequenceSet * tsequence_minus_timestampset(const TSequence *seq, const TimestampSet *ts)
Restricts the temporal value to the complement of the timestamp set.
Definition: tsequence.c:3688
double tnumberseq_twavg(const TSequence *seq)
Returns the time-weighted average of the temporal number.
Definition: tsequence.c:4050
int tsequence_minus_periodset(TSequence **result, const TSequence *seq, const PeriodSet *ps, int from)
Restricts the temporal value to the complement of the period set.
Definition: tsequence.c:3888
const TInstant ** tsequence_instants(const TSequence *seq, int *count)
Returns the distinct instants of the temporal value as a C array.
Definition: tsequence.c:1965
TInstant * tsequence_at_timestamp(const TSequence *seq, TimestampTz t)
Restricts the temporal value to the timestamp.
Definition: tsequence.c:3383
int tsequence_cmp(const TSequence *seq1, const TSequence *seq2)
Returns -1, 0, or 1 depending on whether the first temporal value is less than, equal, or greater than the second one.
Definition: tsequence.c:4108
bool upper_inc(RangeType *range)
Returns true if the upper bound of the range value is inclusive.
Definition: rangetypes_ext.c:104
Temporal * tsequence_merge(const TSequence *seq1, const TSequence *seq2)
Merge the two temporal values.
Definition: tsequence.c:1017
ArrayType * tfloatseq_ranges(const TSequence *seq)
Returns the ranges of base values of the temporal float with stepwise interpolation.
Definition: tsequence.c:1781
bool intersection_tsequence_tinstant(const TSequence *seq, const TInstant *inst, TInstant **inter1, TInstant **inter2)
Temporally intersect the two temporal values.
Definition: tsequence.c:1195
bool tsequence_intersection(const TInstant *start1, const TInstant *end1, bool linear1, const TInstant *start2, const TInstant *end2, bool linear2, Datum *inter1, Datum *inter2, TimestampTz *t)
Returns true if the two segments of the temporal values intersect at the timestamp.
Definition: tsequence.c:230
bool tsequence_value_at_timestamp(const TSequence *seq, TimestampTz t, Datum *result)
Returns the base value of the temporal value at the timestamp.
Definition: tsequence.c:3296
const TInstant * tsequence_inst_n(const TSequence *seq, int index)
Returns the n-th instant of the temporal value.
Definition: tsequence.c:507
bool lower_inc(RangeType *range)
Returns true if the lower bound of the range value is inclusive.
Definition: rangetypes_ext.c:91
Datum tsequence_min_value(const TSequence *seq)
Returns the minimum base value of the temporal value.
Definition: tsequence.c:1832
void * tsequence_bbox_ptr(const TSequence *seq)
Returns a pointer to the precomputed bounding box of the temporal value.
Definition: tsequence.c:518
TSequence * tfloatseq_to_tintseq(const TSequence *seq)
Cast the temporal float value as a temporal integer value.
Definition: tsequence.c:1532
TSequence * tinstant_to_tsequence(const TInstant *inst, bool linear)
Transform the temporal instant value into a temporal sequence value.
Definition: tsequence.c:1559
bool tsequence_ever_eq(const TSequence *seq, Datum value)
Returns true if the temporal value is ever equal to the base value.
Definition: tsequence.c:2111
Structure to represent temporal values of sequence subtype.
Definition: temporal.h:279
void tsequence_period(Period *p, const TSequence *seq)
Returns the bounding period on which the temporal value is defined.
Definition: tsequence.c:1894
void tsequence_bbox(void *box, const TSequence *seq)
Copy in the first argument the bounding box of the temporal value.
Definition: tsequence.c:528
Structure to represent temporal values of instant subtype.
Definition: temporal.h:253