MobilityDB 1.3
Loading...
Searching...
No Matches
set.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 __SET_H__
35#define __SET_H__
36
37/*****************************************************************************/
38
39/*
40 * fmgr macros for ordered set types
41 */
42
43/* PostgreSQL */
44#include <postgres.h>
45/* MEOS */
46#include <meos.h>
47#include "temporal/meos_catalog.h"
48#include "temporal/temporal.h"
49
50#if MEOS
51 #define DatumGetSetP(X) ((Set *) DatumGetPointer(X))
52#else
53 #define DatumGetSetP(X) ((Set *) PG_DETOAST_DATUM(X))
54#endif /* MEOS */
55#define SetPGetDatum(X) PointerGetDatum(X)
56#define PG_GETARG_SET_P(X) ((Set *) PG_GETARG_VARLENA_P(X))
57#define PG_RETURN_SET_P(X) PG_RETURN_POINTER(X)
58
59#define MINIDX 0
60#define MAXIDX count - 1
61
62/*****************************************************************************
63 * Struct definition for the unnest operation
64 *****************************************************************************/
65
70typedef struct
71{
72 bool done;
73 int i;
74 int count;
75 Set *set; /* Set to unnest */
76 Datum *values; /* Values obtained by getValues(temp) */
78
79/*****************************************************************************/
80
81/* General functions */
82
83extern char *set_out_fn(const Set *s, int maxdd, outfunc value_out);
84
85extern bool ensure_set_isof_type(const Set *s, meosType settype);
86extern bool ensure_valid_set_set(const Set *s1, const Set *s2);
87
88extern bool set_find_value(const Set *s, Datum, int *loc);
89
92
93/*****************************************************************************/
94
95#endif /* __SET_H__ */
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:55
char *(* outfunc)(Datum value, meosType type, int maxdd)
Definition: temporal.h:277
set(CBUFFER_SRCS cbuffer.c tcbuffer.c tcbuffer_boxops.c tcbuffer_compops.c tcbuffer_distance.c tcbuffer_spatialfuncs.c tcbuffer_spatialrels.c tcbuffer_tempspatialrels.c) if(1) list(APPEND CBUFFER_SRCS cbufferset_meos.c) endif() add_library(cbuffer OBJECT $
Definition: CMakeLists.txt:1
External API of the Mobility Engine Open Source (MEOS) library.
uintptr_t Datum
Definition: postgres_ext_defs.in.h:7
bool ensure_set_isof_type(const Set *s, meosType settype)
Ensure that a set is of a given set type.
Definition: set.c:69
bool ensure_valid_set_set(const Set *s1, const Set *s2)
Ensure that a temporal number and a temporal box have the same span type.
Definition: set.c:84
void set_unnest_state_next(SetUnnestState *state)
Increment the current state to the next unnest value.
Definition: set.c:1041
SetUnnestState * set_unnest_state_make(const Set *set)
Create the initial state that persists across multiple calls of the function.
Definition: set.c:1024
bool set_find_value(const Set *s, Datum, int *loc)
Return the location of a value in a set using binary search.
Definition: set.c:127
char * set_out_fn(const Set *s, int maxdd, outfunc value_out)
Return the output representation of a set given by a function.
Definition: set.c:185
int i
Definition: set.h:73
int count
Definition: set.h:74
Datum * values
Definition: set.h:76
Set * set
Definition: set.h:75
bool done
Definition: set.h:72
Structure to represent information about an entry that can be placed to either group without affectin...
Definition: set.h:71
Structure to represent sets of values.
Definition: meos.h:80
Definition: pgtz.h:42