Commit | Line | Data |
---|---|---|
fb91c0ef | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
fb91c0ef | 3 | * |
0235b0db | 4 | * Copyright 2019 Philippe Proulx <pproulx@efficios.com> |
fb91c0ef PP |
5 | * |
6 | * The Common Trace Format (CTF) Specification is available at | |
7 | * http://www.efficios.com/ctf | |
8 | */ | |
9 | ||
0235b0db MJ |
10 | #ifndef BABELTRACE_INTEGER_RANGE_SET_INTERNAL_H |
11 | #define BABELTRACE_INTEGER_RANGE_SET_INTERNAL_H | |
12 | ||
c4f23e30 | 13 | #include <stdbool.h> |
fb91c0ef PP |
14 | #include <glib.h> |
15 | #include <babeltrace2/babeltrace.h> | |
16 | ||
17 | #include "object.h" | |
18 | ||
19 | #define BT_INTEGER_RANGE_SET_RANGE_AT_INDEX(_rs, _index) \ | |
20 | (&g_array_index((_rs)->ranges, struct bt_integer_range, (_index))) | |
21 | ||
22 | struct bt_integer_range { | |
23 | union { | |
24 | uint64_t u; | |
25 | int64_t i; | |
26 | } lower; | |
27 | union { | |
28 | uint64_t u; | |
29 | int64_t i; | |
30 | } upper; | |
31 | }; | |
32 | ||
33 | struct bt_integer_range_set { | |
34 | struct bt_object base; | |
35 | ||
36 | /* Array of `struct bt_integer_range` */ | |
37 | GArray *ranges; | |
38 | ||
39 | bool frozen; | |
40 | }; | |
41 | ||
42 | BT_HIDDEN | |
43 | void _bt_integer_range_set_freeze(const struct bt_integer_range_set *range_set); | |
44 | ||
45 | #ifdef BT_DEV_MODE | |
46 | # define bt_integer_range_set_freeze _bt_integer_range_set_freeze | |
47 | #else | |
48 | # define bt_integer_range_set_freeze(_sc) | |
49 | #endif | |
50 | ||
51 | BT_HIDDEN | |
52 | bool bt_integer_range_set_unsigned_has_overlaps( | |
53 | const struct bt_integer_range_set *range_set); | |
54 | ||
55 | BT_HIDDEN | |
56 | bool bt_integer_range_set_signed_has_overlaps( | |
57 | const struct bt_integer_range_set *range_set); | |
58 | ||
59 | #endif /* BABELTRACE_INTEGER_RANGE_SET_INTERNAL_H */ |