1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
7 */
8
9#include <stdint.h>
10
11typedef void *(*malloc_function_ptr)(size_t);
12typedef void (*free_function_ptr)(void*);
13
14typedef struct {
15 unsigned char day;
16 unsigned char month;
17 int year;
18} cudf_data_date;
19
20typedef struct {
21 unsigned int ms;
22 unsigned char seconds;
23 unsigned char minutes;
24 unsigned char hours;
25} cudf_data_time;
26
27typedef struct {
28 cudf_data_date date;
29 cudf_data_time time;
30} cudf_data_timestamp;
31
32typedef struct {
33 size_t size;
34 void* data;
35} cudf_data_blob;
36
37#define DEFAULT_STRUCT_DEFINITION(type, typename) \
38 struct cudf_data_struct_##typename \
39 { \
40 type *data; \
41 size_t count; \
42 type null_value; \
43 double scale; \
44 int (*is_null)(type value); \
45 void (*initialize)(void *self, size_t count); \
46 void *bat; \
47 }
48
49DEFAULT_STRUCT_DEFINITION(int8_t, bit);
50DEFAULT_STRUCT_DEFINITION(int8_t, bte);
51DEFAULT_STRUCT_DEFINITION(int16_t, sht);
52DEFAULT_STRUCT_DEFINITION(int, int);
53DEFAULT_STRUCT_DEFINITION(int64_t, lng);
54DEFAULT_STRUCT_DEFINITION(float, flt);
55DEFAULT_STRUCT_DEFINITION(double, dbl);
56DEFAULT_STRUCT_DEFINITION(char*, str);
57DEFAULT_STRUCT_DEFINITION(cudf_data_date, date);
58DEFAULT_STRUCT_DEFINITION(cudf_data_time, time);
59DEFAULT_STRUCT_DEFINITION(cudf_data_timestamp, timestamp);
60DEFAULT_STRUCT_DEFINITION(cudf_data_blob, blob);
61DEFAULT_STRUCT_DEFINITION(size_t, oid);
62