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