MobilityDB 1.1
lifting.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
35#ifndef __LIFTING_H__
36#define __LIFTING_H__
37
38/* MEOS */
39#include "general/temporal.h"
40
51#define MAX_PARAMS 3
52
53typedef struct
54{
55 Datum (*func)(Datum, ...);
58 bool args;
59 meosType argtype[2];
61 bool reslinear;
62 bool invert;
63 bool discont;
64 bool (*tpfunc_base)(const TInstant *, const TInstant *, Datum, meosType,
65 Datum *, TimestampTz *);
66 bool (*tpfunc)(const TInstant *, const TInstant *, const TInstant *,
67 const TInstant *, Datum *,
68 TimestampTz *);
70
71/*****************************************************************************/
72
73extern TInstant *tfunc_tinstant(const TInstant *inst,
74 LiftedFunctionInfo *lfinfo);
76 LiftedFunctionInfo *lfinfo);
77extern TSequence *tfunc_tsequence(const TSequence *seq,
78 LiftedFunctionInfo *lfinfo);
80 LiftedFunctionInfo *lfinfo);
81extern Temporal *tfunc_temporal(const Temporal *temp,
82 LiftedFunctionInfo *lfinfo);
83
84extern TInstant *tfunc_tinstant_base(const TInstant *inst, Datum value,
85 LiftedFunctionInfo *lfinfo);
86extern TSequence *tfunc_tsequence_base(const TSequence *seq, Datum value,
87 LiftedFunctionInfo *lfinfo);
89 LiftedFunctionInfo *lfinfo);
90extern Temporal *tfunc_temporal_base(const Temporal *temp, Datum value,
91 LiftedFunctionInfo *lfinfo);
92
93extern TInstant *tfunc_tinstant_tinstant(const TInstant *inst1,
94 const TInstant *inst2, LiftedFunctionInfo *lfinfo);
96 const TSequence *is2, LiftedFunctionInfo *lfinfo);
97extern Temporal *tfunc_temporal_temporal(const Temporal *temp1,
98 const Temporal *temp2, LiftedFunctionInfo *lfinfo);
99
100/*****************************************************************************/
101
102extern int efunc_temporal_temporal(const Temporal *temp1,
103 const Temporal *temp2, LiftedFunctionInfo *lfinfo);
104
105/*****************************************************************************/
106
107#endif
TSequence * tfunc_tsequence(const TSequence *seq, LiftedFunctionInfo *lfinfo)
Apply the function to the temporal value.
Definition: lifting.c:209
TInstant * tfunc_tinstant(const TInstant *inst, LiftedFunctionInfo *lfinfo)
Apply the function with the optional arguments to the temporal value.
Definition: lifting.c:195
TSequenceSet * tfunc_tsequenceset(const TSequenceSet *ss, LiftedFunctionInfo *lfinfo)
Apply the function to the temporal value.
Definition: lifting.c:227
TSequence * tfunc_tdiscseq_tdiscseq(const TSequence *is1, const TSequence *is2, LiftedFunctionInfo *lfinfo)
Synchronize the temporal values and apply to them the function with with optional argument.
Definition: lifting.c:773
Temporal * tfunc_temporal_temporal(const Temporal *temp1, const Temporal *temp2, LiftedFunctionInfo *lfinfo)
Synchronize the temporal values and apply to them the function.
Definition: lifting.c:1419
TSequenceSet * tfunc_tsequenceset_base(const TSequenceSet *ss, Datum value, LiftedFunctionInfo *lfinfo)
Apply the function to the temporal value and the base value.
Definition: lifting.c:568
TSequence * tfunc_tsequence_base(const TSequence *seq, Datum value, LiftedFunctionInfo *lfinfo)
Apply the function to the temporal value and the base value.
Definition: lifting.c:319
TSequence * tfunc_tdiscseq(const TSequence *is, LiftedFunctionInfo *lfinfo)
TInstant * tfunc_tinstant_base(const TInstant *inst, Datum value, LiftedFunctionInfo *lfinfo)
Apply the function to the temporal value and the base value.
Definition: lifting.c:302
#define MAX_PARAMS
Generic functions for lifting functions and operators on temporal types.
Definition: lifting.h:51
int efunc_temporal_temporal(const Temporal *temp1, const Temporal *temp2, LiftedFunctionInfo *lfinfo)
Synchronize the temporal values and apply to them the function.
Definition: lifting.c:1991
Temporal * tfunc_temporal_base(const Temporal *temp, Datum value, LiftedFunctionInfo *lfinfo)
Apply the function to the temporal value and the base value (dispatch function)
Definition: lifting.c:599
Temporal * tfunc_temporal(const Temporal *temp, LiftedFunctionInfo *lfinfo)
Apply the function to the temporal value (dispatch function)
Definition: lifting.c:244
TInstant * tfunc_tinstant_tinstant(const TInstant *inst1, const TInstant *inst2, LiftedFunctionInfo *lfinfo)
Synchronize the temporal values and apply to them the function.
Definition: lifting.c:643
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:53
int64 TimestampTz
Definition: pg_ext_defs.in.h:19
uintptr_t Datum
Definition: pg_ext_defs.in.h:4
bool reslinear
True if the result has linear interpolation.
Definition: lifting.h:61
int numparam
Number of parameters of the function.
Definition: lifting.h:56
bool args
True if the lifted function requires arguments.
Definition: lifting.h:58
bool discont
True if the function has instantaneous discontinuities.
Definition: lifting.h:63
meosType restype
Temporal type of the result of the function.
Definition: lifting.h:60
bool invert
True if the arguments of the function must be inverted.
Definition: lifting.h:62
Definition: lifting.h:54
Structure to represent temporal values of instant subtype.
Definition: meos.h:148
Structure to represent temporal values of sequence set subtype.
Definition: meos.h:186
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