MobilityDB 1.3
Loading...
Searching...
No Matches
temporal_rtree.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_RTREE__
35#define __TEMPORAL_RTREE__
36
37/* MEOS */
38#include <meos.h>
39
40#include "temporal/meos_catalog.h"
41
42/*****************************************************************************
43 * RTree
44 *****************************************************************************/
45
46#define MAXITEMS 64
47#define SEARCH_ARRAY_STARTING_SIZE 64
48#define MINITEMS_PERCENTAGE 10
49#define MINITEMS ((MAXITEMS) * (MINITEMS_PERCENTAGE) / 100 + 1)
50
54typedef enum
55{
59
63typedef struct RTreeNode
64{
65 size_t bboxsize;
66 int count;
68 union
69 {
72 };
73 /* The bounding boxes can be of type Span, TBox, or STBox */
74 char boxes[];
76
85struct RTree
86{
87 size_t bboxsize;
89 int dims;
91 double (*get_axis)(const void *, int, bool);
92 void (*bbox_expand)(const void *, void *);
93 bool (*bbox_contains)(const void *, const void *);
94 bool (*bbox_overlaps)(const void *, const void *);
95 char box[];
96};
97
102#define RTREE_NODE_BBOX_N(node, n) ( (void *)( \
103 ((char *) &((node)->boxes)) + (n) * (node)->bboxsize ) )
104
105/*****************************************************************************/
106
107#endif /* __TEMPORAL_RTREE__ */
unsigned char bool
Definition: c.h:405
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:55
External API of the Mobility Engine Open Source (MEOS) library.
long int int64
Definition: postgres_ext_defs.in.h:12
int count
Number of bouding boxes.
Definition: temporal_rtree.h:66
size_t bboxsize
Size of the bouding box.
Definition: temporal_rtree.h:65
char boxes[]
Definition: temporal_rtree.h:74
RTreeNodeType node_type
Definition: temporal_rtree.h:67
struct RTreeNode * nodes[MAXITEMS]
Definition: temporal_rtree.h:70
int64 ids[MAXITEMS]
Definition: temporal_rtree.h:71
Internal representation of an RTree node.
Definition: temporal_rtree.h:64
char box[]
Definition: temporal_rtree.h:95
size_t bboxsize
Size of the bouding box.
Definition: temporal_rtree.h:87
double(* get_axis)(const void *, int, bool)
Definition: temporal_rtree.h:91
meosType bboxtype
Type of the bouding box.
Definition: temporal_rtree.h:88
int dims
Definition: temporal_rtree.h:89
void(* bbox_expand)(const void *, void *)
Definition: temporal_rtree.h:92
bool(* bbox_contains)(const void *, const void *)
Definition: temporal_rtree.h:93
bool(* bbox_overlaps)(const void *, const void *)
Definition: temporal_rtree.h:94
RTreeNode * root
Definition: temporal_rtree.h:90
Rtree in-memory index basic structure.
Definition: temporal_rtree.h:86
RTreeNodeType
Enumeration that defines the node types for an RTree.
Definition: temporal_rtree.h:55
@ RTREE_LEAF
Definition: temporal_rtree.h:56
@ RTREE_INNER
Definition: temporal_rtree.h:57
#define MAXITEMS
In memory index for STBox based on RTree.
Definition: temporal_rtree.h:46