MobilityDB  1.0
tempcache.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * This MobilityDB code is provided under The PostgreSQL License.
4  *
5  * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB
6  * contributors
7  *
8  * MobilityDB includes portions of PostGIS version 3 source code released
9  * under the GNU General Public License (GPLv2 or later).
10  * Copyright (c) 2001-2021, PostGIS contributors
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation for any purpose, without fee, and without a written
14  * agreement is hereby granted, provided that the above copyright notice and
15  * this paragraph and the following two paragraphs appear in all copies.
16  *
17  * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
18  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
19  * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
20  * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
21  * OF SUCH DAMAGE.
22  *
23  * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
26  * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
27  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
28  *
29  *****************************************************************************/
30 
36 #ifndef TEMPCACHE_H
37 #define TEMPCACHE_H
38 
39 #include <postgres.h>
40 #include <fmgr.h>
41 #include <catalog/pg_type.h>
42 #include "temporal.h"
43 
44 /*****************************************************************************/
45 
49 typedef struct
50 {
51  Oid temptypid;
52  Oid basetypid;
53  int32 basetyplen;
54  bool basebyval;
55  bool basecont;
56  Oid boxtypid;
57  int32 boxtyplen;
59 
60 #define TEMPTYPE_CACHE_MAX_LEN 16
61 
62 /*****************************************************************************/
63 
69 typedef enum
70 {
101 } CachedType;
102 
108 typedef enum
109 {
140 } CachedOp;
141 
142 /* Global variable that states whether the temporal type cache has been filled */
143 extern bool _temptyp_cache_ready;
144 
145 extern Oid temporal_basetypid(Oid temptypid);
146 
151 extern bool _ready;
152 
153 extern Oid type_oid(CachedType t);
154 extern Oid oper_oid(CachedOp op, CachedType lt, CachedType rt);
155 extern Datum fill_opcache(PG_FUNCTION_ARGS);
156 
157 #endif /* TEMPCACHE_H */
158 
159 /*****************************************************************************/
Definition: tempcache.h:80
Definition: tempcache.h:123
Definition: tempcache.h:115
Definition: tempcache.h:81
Definition: tempcache.h:138
Definition: tempcache.h:120
Definition: tempcache.h:88
Oid basetypid
Oid of the base type.
Definition: tempcache.h:52
Oid type_oid(CachedType t)
Fetch from the cache the Oid of a type.
Definition: tempcache.c:362
Definition: tempcache.h:76
Datum fill_opcache(PG_FUNCTION_ARGS)
Function executed during the CREATE EXTENSION to precompute the operator cache and store it as a tabl...
Definition: tempcache.c:390
Definition: tempcache.h:131
Definition: tempcache.h:124
bool basecont
True if the base type is continuous.
Definition: tempcache.h:55
int32 basetyplen
Length of the base type.
Definition: tempcache.h:53
Definition: tempcache.h:74
Definition: tempcache.h:113
Definition: tempcache.h:98
Definition: tempcache.h:78
Definition: tempcache.h:119
Oid boxtypid
Oid of the box type.
Definition: tempcache.h:56
Definition: tempcache.h:137
Oid temporal_basetypid(Oid temptypid)
Returns the Oid of the base type from the Oid of the temporal type.
Definition: tempcache.c:234
Definition: tempcache.h:125
Definition: tempcache.h:111
Basic functions for temporal types of any subtype.
Oid oper_oid(CachedOp op, CachedType lt, CachedType rt)
Fetch from the cache the Oid of an operator.
Definition: tempcache.c:377
Definition: tempcache.h:130
Definition: tempcache.h:95
Definition: tempcache.h:86
Definition: tempcache.h:116
Definition: tempcache.h:93
Definition: tempcache.h:117
int32 boxtyplen
Length of the box type.
Definition: tempcache.h:57
Definition: tempcache.h:72
Definition: tempcache.h:71
Definition: tempcache.h:134
Definition: tempcache.h:84
Definition: tempcache.h:99
Definition: tempcache.h:92
Definition: tempcache.h:75
Definition: tempcache.h:126
bool _ready
Global variable that states whether the type and operator caches has been initialized.
Definition: tempcache.c:258
Definition: tempcache.h:129
Definition: tempcache.h:136
Definition: tempcache.h:110
Definition: tempcache.h:121
Definition: tempcache.h:96
Definition: tempcache.h:100
Definition: tempcache.h:82
Definition: tempcache.h:128
CachedOp
Enumeration that defines the classes of Boolean operators used in MobilityDB.
Definition: tempcache.h:108
bool basebyval
True if the base type is passed by value.
Definition: tempcache.h:54
Definition: tempcache.h:91
Definition: tempcache.h:83
Definition: tempcache.h:135
Definition: tempcache.h:139
Definition: tempcache.h:114
CachedType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: tempcache.h:69
Definition: tempcache.h:118
Definition: tempcache.h:73
Oid temptypid
Oid of the temporal type.
Definition: tempcache.h:51
Definition: tempcache.h:97
Definition: tempcache.h:77
Definition: tempcache.h:133
Definition: tempcache.h:112
Definition: tempcache.h:94
Structure to represent the temporal type cache array.
Definition: tempcache.h:49
Definition: tempcache.h:90
Definition: tempcache.h:85
Definition: tempcache.h:87
Definition: tempcache.h:127
Definition: tempcache.h:79
Definition: tempcache.h:132
bool _temptyp_cache_ready
Definition: tempcache.h:122
Definition: tempcache.h:89