2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to you under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
* implied. See the License for the specific language governing
15
* permissions and limitations under the License.
20
#include <avro/platform.h>
21
#include "avro/basics.h"
22
#include "avro/data.h"
23
#include "avro/legacy.h"
24
#include "avro/schema.h"
25
#include "avro_private.h"
28
struct avro_string_datum_t {
29
struct avro_obj_t obj;
32
avro_free_func_t free;
35
struct avro_bytes_datum_t {
36
struct avro_obj_t obj;
39
avro_free_func_t free;
42
struct avro_int32_datum_t {
43
struct avro_obj_t obj;
47
struct avro_int64_datum_t {
48
struct avro_obj_t obj;
52
struct avro_float_datum_t {
53
struct avro_obj_t obj;
57
struct avro_double_datum_t {
58
struct avro_obj_t obj;
62
struct avro_boolean_datum_t {
63
struct avro_obj_t obj;
67
struct avro_fixed_datum_t {
68
struct avro_obj_t obj;
72
avro_free_func_t free;
75
struct avro_map_datum_t {
76
struct avro_obj_t obj;
79
st_table *indices_by_key;
80
st_table *keys_by_index;
83
struct avro_record_datum_t {
84
struct avro_obj_t obj;
86
st_table *field_order;
87
st_table *fields_byname;
90
struct avro_enum_datum_t {
91
struct avro_obj_t obj;
96
struct avro_array_datum_t {
97
struct avro_obj_t obj;
102
struct avro_union_datum_t {
103
struct avro_obj_t obj;
104
avro_schema_t schema;
105
int64_t discriminant;
109
#define avro_datum_to_string(datum_) (container_of(datum_, struct avro_string_datum_t, obj))
110
#define avro_datum_to_bytes(datum_) (container_of(datum_, struct avro_bytes_datum_t, obj))
111
#define avro_datum_to_int32(datum_) (container_of(datum_, struct avro_int32_datum_t, obj))
112
#define avro_datum_to_int64(datum_) (container_of(datum_, struct avro_int64_datum_t, obj))
113
#define avro_datum_to_float(datum_) (container_of(datum_, struct avro_float_datum_t, obj))
114
#define avro_datum_to_double(datum_) (container_of(datum_, struct avro_double_datum_t, obj))
115
#define avro_datum_to_boolean(datum_) (container_of(datum_, struct avro_boolean_datum_t, obj))
116
#define avro_datum_to_fixed(datum_) (container_of(datum_, struct avro_fixed_datum_t, obj))
117
#define avro_datum_to_map(datum_) (container_of(datum_, struct avro_map_datum_t, obj))
118
#define avro_datum_to_record(datum_) (container_of(datum_, struct avro_record_datum_t, obj))
119
#define avro_datum_to_enum(datum_) (container_of(datum_, struct avro_enum_datum_t, obj))
120
#define avro_datum_to_array(datum_) (container_of(datum_, struct avro_array_datum_t, obj))
121
#define avro_datum_to_union(datum_) (container_of(datum_, struct avro_union_datum_t, obj))