MobilityDB  1.0
Functions
tsequence.h File Reference

Basic functions for temporal sequences. More...

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

Go to the source code of this file.

Functions

const TInstanttsequence_inst_n (const TSequence *seq, int index)
 Returns the n-th instant of the temporal value. More...
 
TSequencetsequence_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. More...
 
TSequencetsequence_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 the instants after the creation. More...
 
TSequencetsequence_copy (const TSequence *seq)
 Returns a copy of the temporal value. More...
 
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 search. More...
 
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. More...
 
TSequence ** tsequencearr_normalize (const TSequence **sequences, int count, int *newcount)
 Normalize the array of temporal sequence values. More...
 
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. More...
 
bool intersection_tsequence_tinstant (const TSequence *seq, const TInstant *inst, TInstant **inter1, TInstant **inter2)
 Temporally intersect the two temporal values. More...
 
bool intersection_tinstant_tsequence (const TInstant *inst, const TSequence *seq, TInstant **inter1, TInstant **inter2)
 Temporally intersect the two temporal values. More...
 
bool intersection_tsequence_tinstantset (const TSequence *seq, const TInstantSet *ti, TInstantSet **inter1, TInstantSet **inter2)
 Temporally intersect the two temporal values. More...
 
bool intersection_tinstantset_tsequence (const TInstantSet *ti, const TSequence *seq, TInstantSet **inter1, TInstantSet **inter2)
 Temporally intersect the two temporal values. More...
 
bool synchronize_tsequence_tsequence (const TSequence *seq1, const TSequence *seq2, TSequence **sync1, TSequence **sync2, bool interpoint)
 Synchronize the two temporal values. More...
 
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. More...
 
bool tlinearseq_intersection_value1 (const TInstant *inst1, const TInstant *inst2, Datum value, Oid basetypid, TimestampTz *t)
 
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. More...
 
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. More...
 
char * tsequence_to_string (const TSequence *seq, bool component, char *(*value_out)(Oid, Datum))
 Returns the string representation of the temporal value. More...
 
void tsequence_write (const TSequence *seq, StringInfo buf)
 Write the binary representation of the temporal value into the buffer. More...
 
TSequencetsequence_read (StringInfo buf, Oid basetypid)
 Returns a new temporal value from its binary representation read from the buffer (dispatch function) More...
 
TSequencetsequence_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) More...
 
Datum tsequence_from_base (PG_FUNCTION_ARGS)
 Construct a temporal sequence value from a base value and a period. More...
 
Temporaltsequence_append_tinstant (const TSequence *seq, const TInstant *inst)
 Append an instant to the temporal value. More...
 
Temporaltsequence_merge (const TSequence *seq1, const TSequence *seq2)
 Merge the two temporal values. More...
 
TSequence ** tsequence_merge_array1 (const TSequence **sequences, int count, int *totalcount)
 Merge the array of temporal sequence values. More...
 
Temporaltsequence_merge_array (const TSequence **sequences, int count)
 Merge the array of temporal sequence values. More...
 
TSequencetintseq_to_tfloatseq (const TSequence *seq)
 Cast the temporal integer value as a temporal float value. More...
 
TSequencetfloatseq_to_tintseq (const TSequence *seq)
 Cast the temporal float value as a temporal integer value. More...
 
TSequencetinstant_to_tsequence (const TInstant *inst, bool linear)
 Transform the temporal instant value into a temporal sequence value. More...
 
TSequencetinstantset_to_tsequence (const TInstantSet *ti, bool linear)
 Transform the temporal instant set value into a temporal sequence value. More...
 
TSequencetsequenceset_to_tsequence (const TSequenceSet *ts)
 Transform the temporal sequence set value into a temporal sequence value. More...
 
int tstepseq_to_linear1 (TSequence **result, const TSequence *seq)
 Transform the temporal sequence value with continuous base type from stepwise to linear interpolation. More...
 
TSequenceSettstepseq_to_linear (const TSequence *seq)
 Transform the temporal sequence value with continuous base type from stepwise to linear interpolation. More...
 
int tsequence_values (Datum *result, const TSequence *seq)
 Returns the distinct base values of the temporal value with stepwise interpolation. More...
 
ArrayType * tsequence_values_array (const TSequence *seq)
 Returns the base values of the temporal value with stepwise interpolation. More...
 
int tfloatseq_ranges1 (RangeType **result, const TSequence *seq)
 Returns the ranges of base values of the temporal float with stepwise interpolation. More...
 
PeriodSettsequence_get_time (const TSequence *seq)
 Returns the time on which the temporal value is defined as a period set. More...
 
void * tsequence_bbox_ptr (const TSequence *seq)
 Returns a pointer to the precomputed bounding box of the temporal value. More...
 
void tsequence_bbox (void *box, const TSequence *seq)
 Copy in the first argument the bounding box of the temporal value. More...
 
RangeType * tfloatseq_range (const TSequence *seq)
 Returns the range of base values of the temporal float. More...
 
ArrayType * tfloatseq_ranges (const TSequence *seq)
 Returns the ranges of base values of the temporal float with stepwise interpolation. More...
 
const TInstanttsequence_min_instant (const TSequence *seq)
 Returns a pointer to the instant with minimum base value of the temporal value. More...
 
Datum tsequence_min_value (const TSequence *seq)
 Returns the minimum base value of the temporal value. More...
 
Datum tsequence_max_value (const TSequence *seq)
 Returns the maximum base value of the temporal value. More...
 
void tsequence_period (Period *p, const TSequence *seq)
 Returns the bounding period on which the temporal value is defined. More...
 
Datum tsequence_duration (const TSequence *seq)
 Returns the duration of the temporal value. More...
 
ArrayType * tsequence_segments_array (const TSequence *seq)
 Returns the segments of the temporal value as a PostgreSQL array. More...
 
int tsequence_segments (TSequence **result, const TSequence *seq)
 Returns the segments of the temporal value as a C array. More...
 
const TInstant ** tsequence_instants (const TSequence *seq, int *count)
 Returns the distinct instants of the temporal value as a C array. More...
 
ArrayType * tsequence_instants_array (const TSequence *seq)
 Returns the distinct instants of the temporal value as a PostgreSQL array. More...
 
TimestampTz tsequence_start_timestamp (const TSequence *seq)
 Returns the start timestamp of the temporal value. More...
 
TimestampTz tsequence_end_timestamp (const TSequence *seq)
 Returns the end timestamp of the temporal value. More...
 
int tsequence_timestamps1 (TimestampTz *result, const TSequence *seq)
 Returns the timestamps of the temporal value as a C array. More...
 
ArrayType * tsequence_timestamps (const TSequence *seq)
 Returns the timestamps of the temporal value as a PostgreSQL array. More...
 
TSequencetsequence_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. More...
 
bool tsequence_ever_eq (const TSequence *seq, Datum value)
 Returns true if the temporal value is ever equal to the base value. More...
 
bool tsequence_ever_lt (const TSequence *seq, Datum value)
 Returns true if the temporal value is ever less than the base value. More...
 
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. More...
 
bool tsequence_always_eq (const TSequence *seq, Datum value)
 Returns true if the temporal value is always equal to the base value. More...
 
bool tsequence_always_lt (const TSequence *seq, Datum value)
 Returns true if the temporal value is always less than the base value. More...
 
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. More...
 
int tsequence_at_value (TSequence **result, const TSequence *seq, Datum value, bool atfunc)
 
int tsequence_minus_value (TSequence **result, const TSequence *seq, Datum value)
 
int tsequence_restrict_value2 (TSequence **result, const TSequence *seq, Datum value, bool atfunc)
 Restricts the temporal value to the base value. More...
 
TSequenceSettsequence_restrict_value (const TSequence *seq, Datum value, bool atfunc)
 Restricts the temporal value to (the complement of) the base value. More...
 
int tsequence_at_values1 (TSequence **result, const TSequence *seq, const Datum *values, int count)
 Restricts the temporal value to the array of base values. More...
 
TSequenceSettsequence_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. More...
 
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. More...
 
TSequenceSettnumberseq_restrict_range (const TSequence *seq, const RangeType *range, bool atfunc)
 Restricts the temporal number to the (complement of the) range of base values. More...
 
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. More...
 
TSequenceSettnumberseq_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. More...
 
TSequenceSettsequence_restrict_minmax (const TSequence *seq, bool min, bool atfunc)
 Restricts the temporal value to (the complement of) the minimum/maximum base value. More...
 
TInstanttsequence_at_timestamp1 (const TInstant *inst1, const TInstant *inst2, bool linear, TimestampTz t)
 Restricts the segment of a temporal value to the timestamp. More...
 
TInstanttsequence_at_timestamp (const TSequence *seq, TimestampTz t)
 Restricts the temporal value to the timestamp. More...
 
bool tsequence_value_at_timestamp (const TSequence *seq, TimestampTz t, Datum *result)
 Returns the base value of the temporal value at the timestamp. More...
 
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 exclusive bound. More...
 
const TInstanttsequence_inst_at_timestamp_excl (const TSequence *seq, TimestampTz t)
 Returns the temporal instant at the timestamp for timestamps that are at an exclusive bound. More...
 
int tsequence_minus_timestamp1 (TSequence **result, const TSequence *seq, TimestampTz t)
 Restricts the temporal value to the complement of the timestamp. More...
 
TSequenceSettsequence_minus_timestamp (const TSequence *seq, TimestampTz t)
 Restricts the temporal value to the complement of the timestamp. More...
 
TInstantSettsequence_at_timestampset (const TSequence *seq, const TimestampSet *ts)
 Restricts the temporal value to the timestamp set. More...
 
int tsequence_minus_timestampset1 (TSequence **result, const TSequence *seq, const TimestampSet *ts)
 Restricts the temporal value to the complement of the timestamp set. More...
 
TSequenceSettsequence_minus_timestampset (const TSequence *seq, const TimestampSet *ts)
 Restricts the temporal value to the complement of the timestamp set. More...
 
TSequencetsequence_at_period (const TSequence *seq, const Period *p)
 Restricts the temporal value to the period. More...
 
int tsequence_minus_period1 (TSequence **result, const TSequence *seq, const Period *p)
 Restricts the temporal value to the complement of the period. More...
 
TSequenceSettsequence_minus_period (const TSequence *seq, const Period *p)
 Restricts the temporal value to the complement of the period. More...
 
int tsequence_at_periodset (TSequence **result, const TSequence *seq, const PeriodSet *ps)
 Restricts the temporal value to the period set. More...
 
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. More...
 
TSequenceSettsequence_restrict_periodset (const TSequence *seq, const PeriodSet *ps, bool atfunc)
 Restricts the temporal value to the (complement of the) period set. More...
 
bool tsequence_intersects_timestamp (const TSequence *seq, TimestampTz t)
 Returns true if the temporal value intersects the timestamp. More...
 
bool tsequence_intersects_timestampset (const TSequence *seq, const TimestampSet *t)
 Returns true if the temporal value intersects the timestamp set. More...
 
bool tsequence_intersects_period (const TSequence *seq, const Period *p)
 Returns true if the temporal value intersects the period. More...
 
bool tsequence_intersects_periodset (const TSequence *seq, const PeriodSet *ps)
 Returns true if the temporal value intersects the period set. More...
 
double tnumberseq_integral (const TSequence *seq)
 Returns the integral (area under the curve) of the temporal number. More...
 
double tnumberseq_twavg (const TSequence *seq)
 Returns the time-weighted average of the temporal number. More...
 
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. More...
 
bool tsequence_eq (const TSequence *seq1, const TSequence *seq2)
 Returns true if the two temporal sequence values are equal. More...
 
uint32 tsequence_hash (const TSequence *seq)
 Returns the hash value of the temporal value. More...
 

Detailed Description

Basic functions for temporal sequences.