MobilityDB 1.1
temporal_boxops.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2023, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2023, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
27 *
28 *****************************************************************************/
29
34#ifndef __TEMPORAL_BOXOPS_H__
35#define __TEMPORAL_BOXOPS_H__
36
37/* PostgreSQL */
38#include <postgres.h>
39/* MEOS */
40#include "general/meos_catalog.h"
41#include "general/temporal.h"
42#include "general/span.h"
43#include "general/tbox.h"
44#include "point/stbox.h"
45
46/*****************************************************************************/
47
48/* Functions on generic bounding boxes of temporal types */
49
50extern bool bbox_type(meosType bboxtype);
51extern void ensure_bbox_type(meosType bboxtype);
52extern size_t bbox_get_size(meosType bboxtype);
53extern int bbox_max_dims(meosType bboxtype);
54extern uint32_t temporal_max_header_size(void);
55extern bool temporal_bbox_eq(const void *box1, const void *box2,
56 meosType temptype);
57extern int temporal_bbox_cmp(const void *box1, const void *box2,
58 meosType temptype);
59extern void temporal_bbox_shift_tscale(void *box, meosType temptype,
60 const Interval *start, const Interval *duration);
61
62/* Compute the bounding box at the creation of temporal values */
63
64extern size_t temporal_bbox_size(meosType tempype);
65extern void tinstant_set_bbox(const TInstant *inst, void *bbox);
66extern void tinstarr_compute_bbox(const TInstant **instants, int count,
67 bool lower_inc, bool upper_inc, interpType interp, void *bbox);
68extern void tsequence_compute_bbox(const TSequence *seq, void *box);
69extern void tsequenceset_compute_bbox(const TSequence **seqs, int count,
70 void *bbox);
71
72/* Bounding box operators for temporal types */
73
75 bool (*func)(const Span *, const Span *), bool invert);
76extern Datum boxop_temporal_timestampset(const Temporal *temp, const Set *ts,
77 bool (*func)(const Span *, const Span *), bool invert);
78extern Datum boxop_temporal_period(const Temporal *temp, const Span *p,
79 bool (*func)(const Span *, const Span *), bool invert);
80extern bool boxop_temporal_periodset(const Temporal *temp, const SpanSet *ps,
81 bool (*func)(const Span *, const Span *), bool invert);
82extern bool boxop_temporal_temporal(const Temporal *temp1,
83 const Temporal *temp2, bool (*func)(const Span *, const Span *));
84
85extern bool boxop_tnumber_number(const Temporal *temp, Datum value,
86 meosType basetype, bool (*func)(const TBox *, const TBox *), bool invert);
87extern bool boxop_tnumber_numspan(const Temporal *temp, const Span *span,
88 bool (*func)(const TBox *, const TBox *), bool invert);
89extern bool boxop_tnumber_numspanset(const Temporal *temp, const SpanSet *ss,
90 bool (*func)(const TBox *, const TBox *), bool invert);
91extern bool boxop_tnumber_tbox(const Temporal *temp, const TBox *box,
92 bool (*func)(const TBox *, const TBox *), bool invert);
93extern bool boxop_tnumber_tnumber(const Temporal *temp1, const Temporal *temp2,
94 bool (*func)(const TBox *, const TBox *));
95
96/*****************************************************************************/
97
98#endif /* __TEMPORAL_BOXOPS_H__ */
void tinstant_set_bbox(const TInstant *inst, void *bbox)
Set the second argument to the bounding box of a temporal instant.
Definition: temporal_boxops.c:227
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:53
bool boxop_tnumber_numspanset(const Temporal *temp, const SpanSet *ss, bool(*func)(const TBox *, const TBox *), bool invert)
bool temporal_bbox_eq(const void *box1, const void *box2, meosType temptype)
Return true if two bounding boxes are equal.
Definition: temporal_boxops.c:118
bool boxop_tnumber_tbox(const Temporal *temp, const TBox *box, bool(*func)(const TBox *, const TBox *), bool invert)
Datum boxop_temporal_period(const Temporal *temp, const Span *p, bool(*func)(const Span *, const Span *), bool invert)
int bbox_max_dims(meosType bboxtype)
Return the maximum number of dimensions of a bounding box type.
Definition: temporal_boxops.c:101
void tsequence_compute_bbox(const TSequence *seq, void *box)
int temporal_bbox_cmp(const void *box1, const void *box2, meosType temptype)
Return -1, 0, or 1 depending on whether the first bounding box is less than, equal,...
Definition: temporal_boxops.c:144
void ensure_bbox_type(meosType bboxtype)
Ensure that the type corresponds to a bounding box type.
Definition: temporal_boxops.c:75
Datum boxop_temporal_timestampset(const Temporal *temp, const Set *ts, bool(*func)(const Span *, const Span *), bool invert)
bool bbox_type(meosType bboxtype)
Bounding box operators for temporal types.
Definition: temporal_boxops.c:64
size_t bbox_get_size(meosType bboxtype)
Return the size of a bounding box type.
Definition: temporal_boxops.c:86
bool boxop_tnumber_number(const Temporal *temp, Datum value, meosType basetype, bool(*func)(const TBox *, const TBox *), bool invert)
size_t temporal_bbox_size(meosType tempype)
Return the size of a bounding box of a temporal type.
Definition: temporal_boxops.c:203
Datum boxop_temporal_timestamp(const Temporal *temp, TimestampTz t, bool(*func)(const Span *, const Span *), bool invert)
void temporal_bbox_shift_tscale(void *box, meosType temptype, const Interval *start, const Interval *duration)
Shift and/or scale the time span of the bounding box by the intervals.
Definition: temporal_boxops.c:165
uint32_t temporal_max_header_size(void)
Bounding box operators for temporal types.
Definition: temporal_boxops.c:67
bool boxop_tnumber_tnumber(const Temporal *temp1, const Temporal *temp2, bool(*func)(const TBox *, const TBox *))
void tsequenceset_compute_bbox(const TSequence **seqs, int count, void *bbox)
Set the bounding box from the array of temporal sequence values.
Definition: temporal_boxops.c:432
bool boxop_tnumber_numspan(const Temporal *temp, const Span *span, bool(*func)(const TBox *, const TBox *), bool invert)
void tinstarr_compute_bbox(const TInstant **instants, int count, bool lower_inc, bool upper_inc, interpType interp, void *bbox)
Set a bounding box from an array of temporal instant values.
Definition: temporal_boxops.c:287
bool boxop_temporal_periodset(const Temporal *temp, const SpanSet *ps, bool(*func)(const Span *, const Span *), bool invert)
bool boxop_temporal_temporal(const Temporal *temp1, const Temporal *temp2, bool(*func)(const Span *, const Span *))
interpType
Enumeration that defines the interpolation types used in MobilityDB.
Definition: meos.h:124
int64 TimestampTz
Definition: pg_ext_defs.in.h:19
uintptr_t Datum
Definition: pg_ext_defs.in.h:4
Definition: pg_ext_defs.in.h:24
API of the Mobility Engine Open Source (MEOS) library.
Definition: meos.h:56
Structure to represent span sets.
Definition: meos.h:83
Structure to represent spans (a.k.a.
Definition: meos.h:70
Structure to represent temporal boxes.
Definition: meos.h:97
Structure to represent temporal values of instant subtype.
Definition: meos.h:148
Structure to represent temporal values of instant set or sequence subtype.
Definition: meos.h:165
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:136