| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (c) 2018 Philippe Proulx <pproulx@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef BABELTRACE_PROPERTY_INTERNAL_H |
| 8 | #define BABELTRACE_PROPERTY_INTERNAL_H |
| 9 | |
| 10 | #include "common/assert.h" |
| 11 | #include <babeltrace2/babeltrace.h> |
| 12 | #include <glib.h> |
| 13 | #include <stdint.h> |
| 14 | #include <string.h> |
| 15 | |
| 16 | struct bt_property { |
| 17 | enum bt_property_availability avail; |
| 18 | }; |
| 19 | |
| 20 | struct bt_property_uint { |
| 21 | struct bt_property base; |
| 22 | uint64_t value; |
| 23 | }; |
| 24 | |
| 25 | static inline |
| 26 | void bt_property_uint_set(struct bt_property_uint *prop, uint64_t value) |
| 27 | { |
| 28 | BT_ASSERT(prop); |
| 29 | prop->base.avail = BT_PROPERTY_AVAILABILITY_AVAILABLE; |
| 30 | prop->value = value; |
| 31 | } |
| 32 | |
| 33 | static inline |
| 34 | void bt_property_uint_init(struct bt_property_uint *prop, |
| 35 | enum bt_property_availability avail, uint64_t value) |
| 36 | { |
| 37 | BT_ASSERT(prop); |
| 38 | prop->base.avail = avail; |
| 39 | prop->value = value; |
| 40 | } |
| 41 | |
| 42 | #endif /* BABELTRACE_PROPERTY_INTERNAL_H */ |