MobilityDB 1.1
type_out.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 __TYPE_OUT_H__
36#define __TYPE_OUT_H__
37
38/* PostgreSQL */
39#include <postgres.h>
40/* MEOS */
41#include "general/meos_catalog.h"
42
43/*
44 * Export functions
45 */
46
47/*****************************************************************************
48 * Definitions taken from the file liblwgeom_internal.h
49 *****************************************************************************/
50
51/* Any (absolute) values outside this range will be printed in scientific
52 * notation */
53#define OUT_MIN_DOUBLE 1E-8
54#define OUT_MAX_DOUBLE 1E15
55#define OUT_DEFAULT_DECIMAL_DIGITS 15
56
57/* 17 digits are sufficient for round-tripping
58 * Then we might add up to 8 (from OUT_MIN_DOUBLE) max leading zeroes (or
59 * 2 digits for "e+") */
60#define OUT_MAX_DIGITS 17 + 8
61
62/* Limit for the max amount of characters that a double can use, including dot
63 * and sign */
64#define OUT_MAX_BYTES_DOUBLE (1 /* Sign */ + 2 /* 0.x */ + OUT_MAX_DIGITS)
65#define OUT_DOUBLE_BUFFER_SIZE OUT_MAX_BYTES_DOUBLE + 1 /* +1 including NULL */
66
67/*****************************************************************************/
68
69extern uint8_t *datum_as_wkb(Datum value, meosType type, uint8_t variant,
70 size_t *size_out);
71extern char *datum_as_hexwkb(Datum value, meosType type, uint8_t variant,
72 size_t *size);
73
74/*****************************************************************************/
75
76#endif /* __TYPE_OUT_H__ */
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:53
uintptr_t Datum
Definition: pg_ext_defs.in.h:4
uint8_t * datum_as_wkb(Datum value, meosType type, uint8_t variant, size_t *size_out)
Return the WKB representation of a datum value.
Definition: type_out.c:2213
char * datum_as_hexwkb(Datum value, meosType type, uint8_t variant, size_t *size)
Return the HexWKB representation of a datum value.
Definition: type_out.c:2284