| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef BABELTRACE_VALUES_INTERNAL_H |
| 8 | #define BABELTRACE_VALUES_INTERNAL_H |
| 9 | |
| 10 | #include <glib.h> |
| 11 | #include <babeltrace2/babeltrace.h> |
| 12 | |
| 13 | #include "lib/object.h" |
| 14 | #include "common/macros.h" |
| 15 | |
| 16 | struct bt_value { |
| 17 | struct bt_object base; |
| 18 | enum bt_value_type type; |
| 19 | bt_bool frozen; |
| 20 | }; |
| 21 | |
| 22 | struct bt_value_bool { |
| 23 | struct bt_value base; |
| 24 | bt_bool value; |
| 25 | }; |
| 26 | |
| 27 | struct bt_value_integer { |
| 28 | struct bt_value base; |
| 29 | union { |
| 30 | uint64_t i; |
| 31 | int64_t u; |
| 32 | } value; |
| 33 | }; |
| 34 | |
| 35 | struct bt_value_real { |
| 36 | struct bt_value base; |
| 37 | double value; |
| 38 | }; |
| 39 | |
| 40 | struct bt_value_string { |
| 41 | struct bt_value base; |
| 42 | GString *gstr; |
| 43 | }; |
| 44 | |
| 45 | struct bt_value_array { |
| 46 | struct bt_value base; |
| 47 | GPtrArray *garray; |
| 48 | }; |
| 49 | |
| 50 | struct bt_value_map { |
| 51 | struct bt_value base; |
| 52 | GHashTable *ght; |
| 53 | }; |
| 54 | |
| 55 | BT_HIDDEN |
| 56 | void _bt_value_freeze(const struct bt_value *object); |
| 57 | |
| 58 | #ifdef BT_DEV_MODE |
| 59 | # define bt_value_freeze _bt_value_freeze |
| 60 | #else |
| 61 | # define bt_value_freeze(_value) |
| 62 | #endif /* BT_DEV_MODE */ |
| 63 | |
| 64 | #endif /* BABELTRACE_VALUES_INTERNAL_H */ |