MobilityDB  1.0
lifting.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 __LIFTING_H__
37 #define __LIFTING_H__
38 
39 #include <postgres.h>
40 #include <catalog/pg_type.h>
41 #include "temporal.h"
42 
53 #define MAX_PARAMS 3
54 
55 typedef struct
56 {
57  Datum (*func)(Datum, ...);
58  int numparam;
59  Datum param[MAX_PARAMS];
60  bool argoids;
61  Oid argtypid[2];
62  Oid restypid;
63  bool reslinear;
64  bool invert;
65  bool discont;
66  bool (*tpfunc_base)(const TInstant *, const TInstant *, Datum, Oid,
67  Datum *, TimestampTz *);
68  bool (*tpfunc)(const TInstant *, const TInstant *, bool, const TInstant *,
69  const TInstant *, bool, Datum *,
70  TimestampTz *);
72 
73 /*****************************************************************************/
74 
75 extern TInstant *tfunc_tinstant(const TInstant *inst,
76  LiftedFunctionInfo *lfinfo);
77 extern TInstantSet *tfunc_tinstantset(const TInstantSet *ti,
78  LiftedFunctionInfo *lfinfo);
79 extern TSequence *tfunc_tsequence(const TSequence *seq,
80  LiftedFunctionInfo *lfinfo);
82  LiftedFunctionInfo *lfinfo);
83 extern Temporal *tfunc_temporal(const Temporal *temp,
84  LiftedFunctionInfo *lfinfo);
85 
86 extern TInstant *tfunc_tinstant_base(const TInstant *inst, Datum value,
87  LiftedFunctionInfo *lfinfo);
88 extern TInstantSet *tfunc_tinstantset_base(const TInstantSet *ti, Datum value,
89  LiftedFunctionInfo *lfinfo);
90 extern Temporal *tfunc_tsequence_base(const TSequence *seq, Datum value,
91  LiftedFunctionInfo *lfinfo);
92 extern TSequenceSet *tfunc_tsequenceset_base(const TSequenceSet *ts, Datum value,
93  LiftedFunctionInfo *lfinfo);
94 extern Temporal *tfunc_temporal_base(const Temporal *temp, Datum value,
95  LiftedFunctionInfo *lfinfo);
96 
98  const TInstant *inst2, LiftedFunctionInfo *lfinfo);
100  const TInstantSet *ti2, LiftedFunctionInfo *lfinfo);
101 extern Temporal *sync_tfunc_temporal_temporal(const Temporal *temp1,
102  const Temporal *temp2, LiftedFunctionInfo *lfinfo);
103 
104 /*****************************************************************************/
105 
106 #endif
bool invert
True if the arguments of the function must be inverted.
Definition: lifting.h:64
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: temporal.h:241
TSequenceSet * tfunc_tsequenceset(const TSequenceSet *ts, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value.
Definition: lifting.c:245
TInstant * sync_tfunc_tinstant_tinstant(const TInstant *inst1, const TInstant *inst2, LiftedFunctionInfo *lfinfo)
Synchronizes the temporal values and applies to them the function.
Definition: lifting.c:681
#define MAX_PARAMS
Structure to represent the information about lifted functions.
Definition: lifting.h:53
TInstant * tfunc_tinstant_base(const TInstant *inst, Datum value, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value and the base value.
Definition: lifting.c:324
Temporal * tfunc_tsequence_base(const TSequence *seq, Datum value, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value and the base value.
Definition: lifting.c:584
TInstant * tfunc_tinstant(const TInstant *inst, LiftedFunctionInfo *lfinfo)
Applies the function with the optional arguments to the temporal value.
Definition: lifting.c:191
Temporal * sync_tfunc_temporal_temporal(const Temporal *temp1, const Temporal *temp2, LiftedFunctionInfo *lfinfo)
Synchronizes the temporal values and applies to them the function (dispatch function) ...
Definition: lifting.c:1536
Basic functions for temporal types of any subtype.
bool reslinear
True if the result has linear interpolation.
Definition: lifting.h:63
bool discont
True if the function has instantaneous discontinuities.
Definition: lifting.h:65
TInstantSet * tfunc_tinstantset(const TInstantSet *ti, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value.
Definition: lifting.c:206
TInstantSet * sync_tfunc_tinstantset_tinstantset(const TInstantSet *ti1, const TInstantSet *ti2, LiftedFunctionInfo *lfinfo)
Synchronizes the temporal values and applies to them the function with the optional argument...
Definition: lifting.c:830
TInstantSet * tfunc_tinstantset_base(const TInstantSet *ti, Datum value, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value and the base value.
Definition: lifting.c:342
Structure to represent temporal values of sequence set subtype.
Definition: temporal.h:293
Structure to represent temporal values of instant set subtype.
Definition: temporal.h:266
TSequence * tfunc_tsequence(const TSequence *seq, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value.
Definition: lifting.c:224
Definition: lifting.h:55
Oid restypid
Base type of the result of the function.
Definition: lifting.h:62
Temporal * tfunc_temporal(const Temporal *temp, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value (dispatch function)
Definition: lifting.c:263
int numparam
Number of parameters of the function.
Definition: lifting.h:58
Temporal * tfunc_temporal_base(const Temporal *temp, Datum value, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value and the base value (dispatch function) ...
Definition: lifting.c:650
Structure to represent temporal values of sequence subtype.
Definition: temporal.h:279
bool argoids
True if the lifted function requires the Oid of the arguments.
Definition: lifting.h:60
TSequenceSet * tfunc_tsequenceset_base(const TSequenceSet *ts, Datum value, LiftedFunctionInfo *lfinfo)
Applies the function to the temporal value and the base value.
Definition: lifting.c:618
Structure to represent temporal values of instant subtype.
Definition: temporal.h:253