MobilityDB 1.3
Loading...
Searching...
No Matches
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-2025, 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-2025, 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 <meos.h>
41#include "temporal/meos_catalog.h"
42
43/*****************************************************************************/
44
50#define TEMPORAL_MAX_HEADER_SIZE \
51 DOUBLE_PAD(Max(Max(sizeof(TInstant), sizeof(TSequence)), \
52 sizeof(TSequenceSet))) + DOUBLE_PAD(sizeof(bboxunion))
53
54/*****************************************************************************/
55
56/* Functions on generic bounding boxes of temporal types */
57
58extern bool bbox_type(meosType bboxtype);
59extern size_t bbox_get_size(meosType bboxtype);
60extern int bbox_max_dims(meosType bboxtype);
61extern bool temporal_bbox_eq(const void *box1, const void *box2,
62 meosType temptype);
63extern int temporal_bbox_cmp(const void *box1, const void *box2,
64 meosType temptype);
65
66/* Compute the bounding box at the creation of temporal values */
67
68extern size_t temporal_bbox_size(meosType tempype);
69extern void tinstant_set_bbox(const TInstant *inst, void *bbox);
70extern void tinstarr_set_bbox(const TInstant **instants, int count,
71 bool lower_inc, bool upper_inc, interpType interp, void *bbox);
72extern void tsequence_compute_bbox(TSequence *seq);
73extern void tseqarr_compute_bbox(const TSequence **seqs, int count,
74 void *bbox);
76
77/* Bounding box operators for temporal types */
78
79extern bool boxop_temporal_tstzspan(const Temporal *temp, const Span *s,
80 bool (*func)(const Span *, const Span *), bool invert);
81extern bool boxop_temporal_temporal(const Temporal *temp1,
82 const Temporal *temp2, bool (*func)(const Span *, const Span *));
83
84extern bool boxop_tnumber_numspan(const Temporal *temp, const Span *span,
85 bool (*func)(const Span *, const Span *), bool invert);
86extern bool boxop_tnumber_tbox(const Temporal *temp, const TBox *box,
87 bool (*func)(const TBox *, const TBox *), bool invert);
88extern bool boxop_tnumber_tnumber(const Temporal *temp1, const Temporal *temp2,
89 bool (*func)(const TBox *, const TBox *));
90
91/*****************************************************************************/
92
93#endif /* __TEMPORAL_BOXOPS_H__ */
void tinstant_set_bbox(const TInstant *inst, void *bbox)
Return in the last argument the bounding box of a temporal instant.
Definition: temporal_boxops.c:212
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:55
bool boxop_tnumber_numspan(const Temporal *temp, const Span *span, bool(*func)(const Span *, const Span *), bool invert)
Generic bounding box function for a temporal number and a span.
Definition: temporal_boxops.c:1759
bool boxop_temporal_tstzspan(const Temporal *temp, const Span *s, bool(*func)(const Span *, const Span *), bool invert)
Generic bounding box function for a temporal value and a timestamptz span.
Definition: temporal_boxops.c:1727
bool temporal_bbox_eq(const void *box1, const void *box2, meosType temptype)
Return true if two bounding boxes are equal.
Definition: temporal_boxops.c:113
bool boxop_tnumber_tbox(const Temporal *temp, const TBox *box, bool(*func)(const TBox *, const TBox *), bool invert)
Generic bounding box function for a temporal number and a temporal box.
Definition: temporal_boxops.c:1773
void tsequenceset_compute_bbox(TSequenceSet *ss)
(Re)compute the bounding box of a temporal sequence set
Definition: temporal_boxops.c:571
int bbox_max_dims(meosType bboxtype)
Return the maximum number of dimensions of a bounding box type.
Definition: temporal_boxops.c:96
void tsequence_compute_bbox(TSequence *seq)
Recompute the bounding box of a temporal sequence.
Definition: temporal_boxops.c:553
void tinstarr_set_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:390
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:142
bool bbox_type(meosType bboxtype)
Return true if the type is a bounding box type.
Definition: temporal_boxops.c:70
size_t bbox_get_size(meosType bboxtype)
Return the size of a bounding box type.
Definition: temporal_boxops.c:81
size_t temporal_bbox_size(meosType tempype)
Return the size of a bounding box of a temporal type.
Definition: temporal_boxops.c:166
bool boxop_tnumber_tnumber(const Temporal *temp1, const Temporal *temp2, bool(*func)(const TBox *, const TBox *))
Generic bounding box function for two temporal numbers.
Definition: temporal_boxops.c:1786
void tseqarr_compute_bbox(const TSequence **seqs, int count, void *bbox)
Return in the last argument a bounding box constructed from an array of temporal sequences.
Definition: temporal_boxops.c:528
bool boxop_temporal_temporal(const Temporal *temp1, const Temporal *temp2, bool(*func)(const Span *, const Span *))
Generic bounding box function for two temporal values.
Definition: temporal_boxops.c:1741
interpType
Enumeration that defines the interpolation types used in MEOS.
Definition: meos.h:161
External API of the Mobility Engine Open Source (MEOS) library.
Structure to represent spans (a.k.a.
Definition: meos.h:94
Structure to represent temporal boxes.
Definition: meos.h:124
Structure to represent temporal values of instant subtype.
Definition: meos.h:185
Structure to represent temporal values of sequence set subtype.
Definition: meos.h:224
Structure to represent temporal values of sequence subtype.
Definition: meos.h:202
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:173