36 #ifndef __TSEQUENCESET_H__ 37 #define __TSEQUENCESET_H__ 40 #include <catalog/pg_type.h> 41 #include <utils/array.h> 42 #include <utils/rangetypes.h> 83 char *(*value_out)(Oid, Datum));
90 Oid basetypid,
const PeriodSet *ps,
bool linear);
144 TimestampTz *result);
147 const Interval *start,
const Interval *duration);
160 Datum value,
bool atfunc);
162 const Datum *values,
int count,
bool atfunc);
164 const RangeType *range,
bool atfunc);
166 RangeType **normranges,
int count,
bool atfunc);
168 bool min,
bool atfunc);
171 TimestampTz t, Datum *result);
173 TimestampTz t, Datum *result);
178 TimestampTz t,
bool atfunc);
182 const Period *p,
bool atfunc);
ArrayType * tsequenceset_instants_array(const TSequenceSet *ts)
Returns the distinct instants of the temporal value.
Definition: tsequenceset.c:1227
uint32 tsequenceset_hash(const TSequenceSet *ts)
Returns the hash value of the temporal value.
Definition: tsequenceset.c:2275
int tsequenceset_values(Datum *result, const TSequenceSet *ts)
Returns the distinct base values of the temporal value with stepwise interpolation.
Definition: tsequenceset.c:819
Structure to represent periods.
Definition: timetypes.h:52
char * tsequenceset_to_string(const TSequenceSet *ts, char *(*value_out)(Oid, Datum))
Returns the string representation of the temporal value.
Definition: tsequenceset.c:634
double tsequenceset_interval_double(const TSequenceSet *ts)
Returns the duration of the temporal value as a double.
Definition: tsequenceset.c:1063
TSequenceSet * tinstantset_to_tsequenceset(const TInstantSet *ti, bool linear)
Transform the temporal instant set value into a temporal sequence set value.
Definition: tsequenceset.c:770
bool intersection_tsequence_tsequenceset(const TSequence *seq, const TSequenceSet *ts, TIntersection mode, TSequenceSet **inter1, TSequenceSet **inter2)
Temporally intersect or synchronize the two temporal values.
Definition: tsequenceset.c:557
TIntersection
Enumeration for the intersection/synchronization functions.
Definition: temporal.h:119
bool synchronize_tsequenceset_tsequence(const TSequenceSet *ts, const TSequence *seq, TIntersection mode, TSequenceSet **inter1, TSequenceSet **inter2)
Temporally intersect or synchronize the two temporal values.
Definition: tsequenceset.c:504
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: temporal.h:241
Datum tsequenceset_max_value(const TSequenceSet *ts)
Returns the maximum base value of the temporal value.
Definition: tsequenceset.c:985
bool intersection_tsequenceset_tinstantset(const TSequenceSet *ts, const TInstantSet *ti, TInstantSet **inter1, TInstantSet **inter2)
Temporally intersect the two temporal values.
Definition: tsequenceset.c:434
const TSequence * tsequenceset_seq_n(const TSequenceSet *ts, int index)
Returns the n-th sequence of the temporal value.
Definition: tsequenceset.c:65
bool tsequenceset_always_eq(const TSequenceSet *ts, Datum value)
Returns true if the temporal value is always equal to the base value.
Definition: tsequenceset.c:1441
void normalize(POINT3D *p)
TSequenceSet * tsequenceset_restrict_value(const TSequenceSet *ts, Datum value, bool atfunc)
Restricts the temporal value to the base value.
Definition: tsequenceset.c:1554
TSequenceSet * tsequenceset_restrict_values(const TSequenceSet *ts, const Datum *values, int count, bool atfunc)
Restricts the temporal value to the (complement of the) array of base values.
Definition: tsequenceset.c:1586
const TInstant * tsequenceset_inst_n(const TSequenceSet *ts, int n)
Returns the n-th distinct instant of the temporal value.
Definition: tsequenceset.c:1169
TSequenceSet * tsequenceset_from_base_internal(Datum value, Oid basetypid, const PeriodSet *ps, bool linear)
Construct a temporal sequence set value from from a base value and a timestamp set (internal function...
Definition: tsequenceset.c:227
Datum tsequenceset_duration(const TSequenceSet *ts)
Returns the duration of the temporal value.
Definition: tsequenceset.c:1042
Temporal * tsequenceset_restrict_timestamp(const TSequenceSet *ts, TimestampTz t, bool atfunc)
Restricts the temporal value to the (the complement of) timestamp.
Definition: tsequenceset.c:1708
Datum tsequenceset_min_value(const TSequenceSet *ts)
Returns the minimum base value of the temporal value.
Definition: tsequenceset.c:958
double tnumberseqset_twavg(const TSequenceSet *ts)
Returns the time-weighted average of the temporal number.
Definition: tsequenceset.c:2181
Datum tsequenceset_timespan(const TSequenceSet *ts)
Returns the timespan of the temporal value.
Definition: tsequenceset.c:1029
bool tsequenceset_intersects_timestampset(const TSequenceSet *ts, const TimestampSet *ts1)
Returns true if the temporal value intersect the timestamp set.
Definition: tsequenceset.c:2118
TSequenceSet * tsequenceset_merge(const TSequenceSet *ts1, const TSequenceSet *ts2)
Merge the two temporal values.
Definition: tsequenceset.c:289
ArrayType * tsequenceset_timestamps(const TSequenceSet *ts)
Returns the distinct timestamps of the temporal value as a PostgreSQL array.
Definition: tsequenceset.c:1356
TimestampTz tsequenceset_end_timestamp(const TSequenceSet *ts)
Returns the end timestamp of the temporal value.
Definition: tsequenceset.c:1251
PeriodSet * tsequenceset_get_time(const TSequenceSet *ts)
Returns the time on which the temporal value is defined as a period set.
Definition: tsequenceset.c:1012
TSequenceSet * tstepseqset_to_linear(const TSequenceSet *ts)
Transform the temporal value with continuous base type from stepwise to linear interpolation.
Definition: tsequenceset.c:789
TSequenceSet * tnumberseqset_restrict_range(const TSequenceSet *ts, const RangeType *range, bool atfunc)
Restricts the temporal number to the range of base values.
Definition: tsequenceset.c:1633
bool intersection_tsequenceset_tinstant(const TSequenceSet *ts, const TInstant *inst, TInstant **inter1, TInstant **inter2)
Temporally intersect the two temporal values.
Definition: tsequenceset.c:400
bool tsequenceset_ever_eq(const TSequenceSet *ts, Datum value)
Returns true if the temporal value is ever equal to the base value.
Definition: tsequenceset.c:1425
Basic functions for temporal types of any subtype.
bool tsequenceset_always_le(const TSequenceSet *ts, Datum value)
Returns true if the temporal value is always less than or equal to the base value.
Definition: tsequenceset.c:1523
Datum tsequenceset_from_base(PG_FUNCTION_ARGS)
Construct a temporal sequence set value from from a base value and a timestamp set.
Definition: tsequenceset.c:245
const TInstant ** tsequenceset_instants(const TSequenceSet *ts, int *count)
Returns the distinct instants of the temporal value.
Definition: tsequenceset.c:1209
bool intersection_tinstantset_tsequenceset(const TInstantSet *ti, const TSequenceSet *ts, TInstantSet **inter1, TInstantSet **inter2)
Temporally intersect the two temporal values.
Definition: tsequenceset.c:486
void * tsequenceset_bbox_ptr(const TSequenceSet *ts)
Returns a pointer to the precomputed bounding box of the temporal value.
Definition: tsequenceset.c:76
TSequenceSet * tnumberseqset_restrict_ranges(const TSequenceSet *ts, RangeType **normranges, int count, bool atfunc)
Restricts the temporal number to the (complement of the) array of ranges of base values.
Definition: tsequenceset.c:1669
Structure to represent period sets.
Definition: timetypes.h:84
TSequenceSet * tsequenceset_restrict_period(const TSequenceSet *ts, const Period *p, bool atfunc)
Restricts the temporal value to the (complement of the) period.
Definition: tsequenceset.c:1932
const TInstant * tsequenceset_inst_at_timestamp_excl(const TSequenceSet *ts, TimestampTz t)
Returns the temporal instant at the timestamp when the timestamp is at an exclusive bound...
Definition: tsequenceset.c:1822
bool tsequenceset_intersects_period(const TSequenceSet *ts, const Period *p)
Returns true if the temporal value intersect the period.
Definition: tsequenceset.c:2130
const TInstant * tsequenceset_min_instant(const TSequenceSet *ts)
Returns a pointer to the instant with minimum base value of the temporal value.
Definition: tsequenceset.c:932
void tsequenceset_period(Period *p, const TSequenceSet *ts)
Returns the bounding period on which the temporal value is defined.
Definition: tsequenceset.c:1078
double tnumberseqset_integral(const TSequenceSet *ts)
Returns the integral (area under the curve) of the temporal number.
Definition: tsequenceset.c:2169
ArrayType * tsequenceset_values_array(const TSequenceSet *ts)
Returns the distinct base values of the temporal value with stepwise interpolation as a PostgreSQL ar...
Definition: tsequenceset.c:841
TSequenceSet * tintseqset_to_tfloatseqset(const TSequenceSet *ts)
Cast the temporal integer value as a temporal float value.
Definition: tsequenceset.c:701
Temporal * tsequenceset_restrict_timestampset(const TSequenceSet *ts1, const TimestampSet *ts2, bool atfunc)
Restricts the temporal value to the (complement of the) timestamp set.
Definition: tsequenceset.c:1855
TSequenceSet * tsequenceset_make(const TSequence **sequences, int count, bool normalize)
Construct a temporal sequence set value from the array of temporal sequence values.
Definition: tsequenceset.c:119
Structure to represent temporal values of sequence set subtype.
Definition: temporal.h:293
RangeType * tfloatseqset_to_range(const TSequenceSet *ts)
Cast a temporal float value as a floatrange.
Definition: tsequenceset.c:854
Structure to represent timestamp sets.
Definition: timetypes.h:73
void tsequenceset_bbox(void *box, const TSequenceSet *ts)
Copy in the first argument the bounding box of the temporal value.
Definition: tsequenceset.c:86
bool tsequenceset_always_lt(const TSequenceSet *ts, Datum value)
Returns true if the temporal value is always less than the base value.
Definition: tsequenceset.c:1503
bool synchronize_tsequenceset_tsequenceset(const TSequenceSet *ts1, const TSequenceSet *ts2, TIntersection mode, TSequenceSet **inter1, TSequenceSet **inter2)
Temporally intersect or synchronize the two temporal values.
Definition: tsequenceset.c:572
int tsequenceset_cmp(const TSequenceSet *ts1, const TSequenceSet *ts2)
Returns -1, 0, or 1 depending on whether the first temporal value is less than, equal, or greater than the second one.
Definition: tsequenceset.c:2241
bool tsequenceset_timestamp_n(const TSequenceSet *ts, int n, TimestampTz *result)
Returns the n-th distinct timestamp of the temporal value.
Definition: tsequenceset.c:1285
TSequenceSet * tsequenceset_restrict_periodset(const TSequenceSet *ts, const PeriodSet *ps, bool atfunc)
Restricts the temporal value to the (complement of the) period set.
Definition: tsequenceset.c:2014
Structure to represent temporal values of instant set subtype.
Definition: temporal.h:266
bool tsequenceset_ever_lt(const TSequenceSet *ts, Datum value)
Returns true if the temporal value is ever less than the base value.
Definition: tsequenceset.c:1464
TSequenceSet * tsequenceset_append_tinstant(const TSequenceSet *ts, const TInstant *inst)
Append an instant to the temporal value.
Definition: tsequenceset.c:265
int tsequenceset_num_instants(const TSequenceSet *ts)
Returns the number of distinct instants of the temporal value.
Definition: tsequenceset.c:1145
TSequenceSet * tsequenceset_shift_tscale(const TSequenceSet *ts, const Interval *start, const Interval *duration)
Shift and/or scale the time span of the temporal value by the two intervals.
Definition: tsequenceset.c:1371
TSequenceSet * tsequenceset_merge_array(const TSequenceSet **ts, int count)
Merge the array of temporal sequence set values.
Definition: tsequenceset.c:304
bool tsequenceset_value_at_timestamp(const TSequenceSet *ts, TimestampTz t, Datum *result)
Returns the base value of the temporal value at the timestamp.
Definition: tsequenceset.c:1768
const TSequence ** tsequenceset_sequences(const TSequenceSet *ts)
Returns the sequences of the temporal value as a C array.
Definition: tsequenceset.c:1090
bool tsequenceset_intersects_periodset(const TSequenceSet *ts, const PeriodSet *ps)
Returns true if the temporal value intersect the period set.
Definition: tsequenceset.c:2153
bool tsequenceset_eq(const TSequenceSet *ts1, const TSequenceSet *ts2)
Returns true if the two temporal sequence set values are equal.
Definition: tsequenceset.c:2208
bool tsequenceset_value_at_timestamp_inc(const TSequenceSet *ts, TimestampTz t, Datum *result)
Returns the base value of the temporal value at the timestamp when the timestamp may be at an exclusi...
Definition: tsequenceset.c:1791
TSequenceSet * tsequence_to_tsequenceset(const TSequence *seq)
Construct a temporal sequence set value from the temporal sequence.
Definition: tsequenceset.c:212
bool tsequenceset_find_timestamp(const TSequenceSet *ts, TimestampTz t, int *loc)
Returns the location of the timestamp in the temporal sequence set value using binary search...
Definition: tsequenceset.c:363
ArrayType * tfloatseqset_ranges(const TSequenceSet *ts)
Returns the ranges of base values of the temporal float value as a PostgreSQL array.
Definition: tsequenceset.c:900
TSequenceSet * tsequenceset_restrict_minmax(const TSequenceSet *ts, bool min, bool atfunc)
Restricts the temporal value to (the complement of) the minimum/maximum base value.
Definition: tsequenceset.c:1698
TSequenceSet * tinstant_to_tsequenceset(const TInstant *inst, bool linear)
Transform the temporal instant value into a temporal sequence set value.
Definition: tsequenceset.c:758
TSequenceSet * tsequenceset_copy(const TSequenceSet *ts)
Returns a copy of the temporal value.
Definition: tsequenceset.c:329
bool tsequenceset_ever_le(const TSequenceSet *ts, Datum value)
Returns true if the temporal value is ever less than or equal to the base value.
Definition: tsequenceset.c:1484
ArrayType * tsequenceset_segments_array(const TSequenceSet *ts)
Returns the segments of the temporal value as a PostgreSQL array.
Definition: tsequenceset.c:1129
void tsequenceset_write(const TSequenceSet *ts, StringInfo buf)
Write the binary representation of the temporal value into the buffer.
Definition: tsequenceset.c:661
bool tsequenceset_intersects_timestamp(const TSequenceSet *ts, TimestampTz t)
Returns true if the temporal value intersect the timestamp.
Definition: tsequenceset.c:2106
TSequenceSet * tfloatseqset_to_tintseqset(const TSequenceSet *ts)
Cast the temporal float value as a temporal integer value.
Definition: tsequenceset.c:726
Structure to represent temporal values of sequence subtype.
Definition: temporal.h:279
TSequenceSet * tsequenceset_make_free(TSequence **sequences, int count, bool normalize)
Construct a temporal sequence set value from the array of temporal sequence values and free the array...
Definition: tsequenceset.c:195
bool intersection_tinstant_tsequenceset(const TInstant *inst, const TSequenceSet *ts, TInstant **inter1, TInstant **inter2)
Temporally intersect the two temporal values.
Definition: tsequenceset.c:420
int tsequenceset_num_timestamps(const TSequenceSet *ts)
Returns the number of distinct timestamps of the temporal value.
Definition: tsequenceset.c:1261
TimestampTz tsequenceset_start_timestamp(const TSequenceSet *ts)
Returns the start timestamp of the temporal value.
Definition: tsequenceset.c:1241
TSequenceSet * tsequenceset_read(StringInfo buf, Oid basetypid)
Returns a new temporal value from its binary representation read from the buffer. ...
Definition: tsequenceset.c:683
ArrayType * tsequenceset_sequences_array(const TSequenceSet *ts)
Returns the sequences of the temporal value as a PostgreSQL array.
Definition: tsequenceset.c:1102
Structure to represent temporal values of instant subtype.
Definition: temporal.h:253