Commit | Line | Data |
---|---|---|
c4628760 PP |
1 | #ifndef BABELTRACE_VALUES_INTERNAL_H |
2 | #define BABELTRACE_VALUES_INTERNAL_H | |
3 | ||
4 | /* | |
e2f7325d | 5 | * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com> |
c4628760 PP |
6 | * |
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
8 | * of this software and associated documentation files (the "Software"), to deal | |
9 | * in the Software without restriction, including without limitation the rights | |
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
11 | * copies of the Software, and to permit persons to whom the Software is | |
12 | * furnished to do so, subject to the following conditions: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
23 | * SOFTWARE. | |
24 | */ | |
25 | ||
578e048b | 26 | #include "lib/object.h" |
3fadfbc0 MJ |
27 | #include <babeltrace2/value.h> |
28 | #include <babeltrace2/value-const.h> | |
29 | #include <babeltrace2/types.h> | |
f1567d42 | 30 | #include <glib.h> |
91d81473 | 31 | #include "common/macros.h" |
f1567d42 PP |
32 | |
33 | struct bt_value { | |
34 | struct bt_object base; | |
35 | enum bt_value_type type; | |
36 | bt_bool frozen; | |
37 | }; | |
38 | ||
39 | struct bt_value_bool { | |
40 | struct bt_value base; | |
41 | bt_bool value; | |
42 | }; | |
43 | ||
44 | struct bt_value_integer { | |
45 | struct bt_value base; | |
fdd3a2da PP |
46 | union { |
47 | uint64_t i; | |
48 | int64_t u; | |
49 | } value; | |
f1567d42 PP |
50 | }; |
51 | ||
52 | struct bt_value_real { | |
53 | struct bt_value base; | |
54 | double value; | |
55 | }; | |
56 | ||
57 | struct bt_value_string { | |
58 | struct bt_value base; | |
59 | GString *gstr; | |
60 | }; | |
61 | ||
62 | struct bt_value_array { | |
63 | struct bt_value base; | |
64 | GPtrArray *garray; | |
65 | }; | |
66 | ||
67 | struct bt_value_map { | |
68 | struct bt_value base; | |
69 | GHashTable *ght; | |
70 | }; | |
c4628760 | 71 | |
f6ccaed9 | 72 | BT_HIDDEN |
05e21286 | 73 | enum bt_value_status _bt_value_freeze(const struct bt_value *object); |
f6ccaed9 PP |
74 | |
75 | #ifdef BT_DEV_MODE | |
76 | # define bt_value_freeze _bt_value_freeze | |
77 | #else | |
78 | # define bt_value_freeze(_value) | |
79 | #endif /* BT_DEV_MODE */ | |
80 | ||
c4628760 | 81 | #endif /* BABELTRACE_VALUES_INTERNAL_H */ |