MobilityDB 1.3
Loading...
Searching...
No Matches
Functions
spanset.c File Reference

General functions for set of disjoint spans. More...

#include "temporal/spanset.h"
#include <assert.h>
#include <float.h>
#include <limits.h>
#include <postgres.h>
#include "utils/timestamp.h"
#include <meos.h>
#include <meos_internal.h>
#include "temporal/postgres_types.h"
#include "temporal/span.h"
#include "temporal/temporal.h"
#include "temporal/type_parser.h"
#include "temporal/type_inout.h"
#include "temporal/type_util.h"

Functions

bool datespanset_date_n (const SpanSet *ss, int n, DateADT *result)
 Return in the last argument the n-th date of a date span set. More...
 
Setdatespanset_dates (const SpanSet *ss)
 Return the set of dates of a span set. More...
 
Intervaldatespanset_duration (const SpanSet *ss, bool boundspan)
 Return the duration of a date span set. More...
 
DateADT datespanset_end_date (const SpanSet *ss)
 Return the end date of a span set. More...
 
int datespanset_num_dates (const SpanSet *ss)
 Return the number of dates of a span set. More...
 
DateADT datespanset_start_date (const SpanSet *ss)
 Return the start date of a span set. More...
 
SpanSetdatespanset_to_tstzspanset (const SpanSet *ss)
 Convert a date span set into a timestamptz span set. More...
 
bool ensure_same_spanset_span_type (const SpanSet *ss, const Span *s)
 Ensure that a span set and a span value have the same span type. More...
 
bool ensure_same_spanset_type (const SpanSet *ss1, const SpanSet *ss2)
 Ensure that the span set values have the same type. More...
 
bool ensure_spanset_isof_type (const SpanSet *ss, meosType spansettype)
 Ensure that a span set is of a given span set type. More...
 
bool ensure_valid_spanset_span (const SpanSet *ss, const Span *s)
 Ensure that a span set and a span value have the same span type. More...
 
bool ensure_valid_spanset_spanset (const SpanSet *ss1, const SpanSet *ss2)
 Ensure that two span sets are of the same span type. More...
 
SpanSetfloatspanset_ceil (const SpanSet *ss)
 Return a float span set rounded up to the nearest integer. More...
 
SpanSetfloatspanset_degrees (const SpanSet *ss, bool normalize)
 Return a float span set with the values converted to degrees. More...
 
SpanSetfloatspanset_floor (const SpanSet *ss)
 Return a float span set rounded down to the nearest integer. More...
 
SpanSetfloatspanset_radians (const SpanSet *ss)
 Return a float span set with the values converted to radians. More...
 
SpanSetfloatspanset_round (const SpanSet *ss, int maxdd)
 Return a float span set with the precision of the spans set to a number of decimal places. More...
 
SpanSetfloatspanset_to_intspanset (const SpanSet *ss)
 Convert a float span set into an integer span set. More...
 
SpanSetintspanset_to_floatspanset (const SpanSet *ss)
 Convert an integer span set into a float span set. More...
 
SpanSetnumspanset_shift_scale (const SpanSet *ss, Datum shift, Datum width, bool hasshift, bool haswidth)
 Return a number set shifted and/or scaled by two intervals. More...
 
Datum numspanset_width (const SpanSet *ss, bool boundspan)
 Return the width of a span set. More...
 
SpanSetset_spanset (const Set *s)
 Convert a set into a span set. More...
 
SpanSetset_to_spanset (const Set *s)
 Convert a set into a span set. More...
 
static int span_cmp_size (const Span *s1, const Span *s2)
 Return -1, 0, or 1 depending on whether the size of the first span is less than, equal, or greater than the second one. More...
 
SpanSetspan_to_spanset (const Span *s)
 Convert a span into a span set. More...
 
static void spanarr_sort_size (Span *spans, int count)
 Sort function for comparying spans based on their size. More...
 
int spanset_cmp (const SpanSet *ss1, const SpanSet *ss2)
 Return -1, 0, or 1 depending on whether the first span set is less than, equal, or greater than the second one. More...
 
SpanSetspanset_compact (const SpanSet *ss)
 Return a copy of a span set without any extra storage space. More...
 
SpanSetspanset_copy (const SpanSet *ss)
 Return a copy of a span set. More...
 
Spanspanset_end_span (const SpanSet *ss)
 Return a copy of the end span of a span set. More...
 
bool spanset_eq (const SpanSet *ss1, const SpanSet *ss2)
 Return true if the two span sets are equal. More...
 
bool spanset_find_value (const SpanSet *ss, Datum v, int *loc)
 Return the location of a value in a span set using binary search. More...
 
bool spanset_ge (const SpanSet *ss1, const SpanSet *ss2)
 Return true if the first span set is greater than or equal to the second one. More...
 
bool spanset_gt (const SpanSet *ss1, const SpanSet *ss2)
 Return true if the first span set is greater than the second one. More...
 
uint32 spanset_hash (const SpanSet *ss)
 Return the 32-bit hash value of a span set. More...
 
uint64 spanset_hash_extended (const SpanSet *ss, uint64 seed)
 Return the 64-bit hash value of a span set using a seed. More...
 
SpanSetspanset_in (const char *str, meosType spansettype)
 Return a span set from its Well-Known Text (WKT) representation. More...
 
bool spanset_le (const SpanSet *ss1, const SpanSet *ss2)
 Return true if the first span set is less than or equal to the second one. More...
 
Datum spanset_lower (const SpanSet *ss)
 Return the lower bound a span set. More...
 
bool spanset_lower_inc (const SpanSet *ss)
 Return true if the lower bound of a span set is inclusive. More...
 
bool spanset_lt (const SpanSet *ss1, const SpanSet *ss2)
 Return true if the first span set is less than the second one. More...
 
SpanSetspanset_make (Span *spans, int count)
 Return a span set from an array of disjoint spans. More...
 
SpanSetspanset_make_exp (Span *spans, int count, int maxcount, bool normalize, bool order)
 Return a span set from an array of disjoint spans enabling the data structure to expand. More...
 
SpanSetspanset_make_free (Span *spans, int count, bool normalize, bool order)
 Return a span set from an array of spans and free the input array of spans after the creation. More...
 
int spanset_mem_size (const SpanSet *ss)
 Return the size in bytes of a span set. More...
 
bool spanset_ne (const SpanSet *ss1, const SpanSet *ss2)
 Return true if the first span set is different from the second one. More...
 
int spanset_num_spans (const SpanSet *ss)
 Return the number of spans of a span set. More...
 
char * spanset_out (const SpanSet *ss, int maxdd)
 Return the Well-Known Text (WKT) representation of a span set. More...
 
Spanspanset_span (const SpanSet *ss)
 Return the bounding span of a span set. More...
 
Spanspanset_span_n (const SpanSet *ss, int n)
 Return a copy of the n-th span of a span set. More...
 
Span ** spanset_spanarr (const SpanSet *ss)
 Return a C array with copies of the spans of a span set. More...
 
Spanspanset_spans (const SpanSet *ss)
 Return the array of spans of a spanset. More...
 
Spanspanset_split_each_n_spans (const SpanSet *ss, int elems_per_span, int *count)
 Return an array of N spans from a spanset obtained by merging consecutive composing spans. More...
 
Spanspanset_split_n_spans (const SpanSet *ss, int span_count, int *count)
 Return an array of N spans from the composing spans of a spanset. More...
 
const Span ** spanset_sps (const SpanSet *ss)
 Return an array of pointers to the spans of a span set. More...
 
Spanspanset_start_span (const SpanSet *ss)
 Return a copy to the the start span of a span set. More...
 
Datum spanset_upper (const SpanSet *ss)
 Return the lower bound a span set. More...
 
bool spanset_upper_inc (const SpanSet *ss)
 Return true if the upper bound of a span set is inclusive. More...
 
Intervaltstzspanset_duration (const SpanSet *ss, bool boundspan)
 Return the duration of a timestamptz span set. More...
 
TimestampTz tstzspanset_end_timestamptz (const SpanSet *ss)
 Return the end timestamptz of a span set. More...
 
bool tstzspanset_find_timestamptz (const SpanSet *ss, TimestampTz t, int *loc)
 
int tstzspanset_num_timestamps (const SpanSet *ss)
 Return the number of timestamps of a span set. More...
 
SpanSettstzspanset_shift_scale (const SpanSet *ss, const Interval *shift, const Interval *duration)
 Return a timestamptz span set shifted and/or scaled by two intervals. More...
 
TimestampTz tstzspanset_start_timestamptz (const SpanSet *ss)
 Return the start timestamptz of a span set. More...
 
Settstzspanset_timestamps (const SpanSet *ss)
 Return the set of timestamps of a span set. More...
 
bool tstzspanset_timestamptz_n (const SpanSet *ss, int n, TimestampTz *result)
 Return in the last argument the n-th timestamptz of a span set. More...
 
SpanSettstzspanset_to_datespanset (const SpanSet *ss)
 Convert a timestamptz span set into a date span set. More...
 
SpanSetvalue_spanset (Datum value, meosType basetype)
 Convert a value into a span set. More...
 

Detailed Description

General functions for set of disjoint spans.