MobilityDB  1.0
tnumber_mathfuncs.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 
37 #ifndef __TEMPORAL_MATHFUNCS_H__
38 #define __TEMPORAL_MATHFUNCS_H__
39 
40 #include <postgres.h>
41 #include <fmgr.h>
42 #include <catalog/pg_type.h>
43 
46 typedef enum
47 {
48  ADD,
49  SUB,
51  DIV,
53 } TArithmetic;
54 
55 /*****************************************************************************/
56 
57 extern Datum datum_round(Datum value, Datum prec);
58 
59 extern Datum add_base_temporal(PG_FUNCTION_ARGS);
60 extern Datum add_temporal_base(PG_FUNCTION_ARGS);
61 extern Datum add_temporal_temporal(PG_FUNCTION_ARGS);
62 
63 extern Datum sub_base_temporal(PG_FUNCTION_ARGS);
64 extern Datum sub_temporal_base(PG_FUNCTION_ARGS);
65 extern Datum sub_temporal_temporal(PG_FUNCTION_ARGS);
66 
67 extern Datum mult_base_temporal(PG_FUNCTION_ARGS);
68 extern Datum mult_temporal_base(PG_FUNCTION_ARGS);
69 extern Datum mult_temporal_temporal(PG_FUNCTION_ARGS);
70 
71 extern Datum div_base_temporal(PG_FUNCTION_ARGS);
72 extern Datum div_temporal_base(PG_FUNCTION_ARGS);
73 extern Datum div_temporal_temporal(PG_FUNCTION_ARGS);
74 
75 extern int int_cmp(const void *a, const void *b);
76 
77 /*****************************************************************************/
78 
79 #endif
Datum add_temporal_temporal(PG_FUNCTION_ARGS)
Datum datum_round(Datum value, Datum prec)
Round the number to the number of decimal places.
Definition: tnumber_mathfuncs.c:56
Datum mult_temporal_temporal(PG_FUNCTION_ARGS)
Datum mult_temporal_base(PG_FUNCTION_ARGS)
Datum add_base_temporal(PG_FUNCTION_ARGS)
int int_cmp(const void *a, const void *b)
Returns a negative or a positive value depending on whether the first number is less than or greater ...
Definition: tpoint_analytics.c:1065
Datum add_temporal_base(PG_FUNCTION_ARGS)
Datum sub_temporal_temporal(PG_FUNCTION_ARGS)
Definition: tnumber_mathfuncs.h:48
Datum div_temporal_base(PG_FUNCTION_ARGS)
Datum div_base_temporal(PG_FUNCTION_ARGS)
Definition: tnumber_mathfuncs.h:50
Definition: tnumber_mathfuncs.h:49
Definition: tnumber_mathfuncs.h:52
Datum div_temporal_temporal(PG_FUNCTION_ARGS)
Datum mult_base_temporal(PG_FUNCTION_ARGS)
TArithmetic
Enumeration for the arithmetic functions.
Definition: tnumber_mathfuncs.h:46
Datum sub_temporal_base(PG_FUNCTION_ARGS)
Datum sub_base_temporal(PG_FUNCTION_ARGS)
Definition: tnumber_mathfuncs.h:51