lib: add component descriptor set API
[babeltrace.git] / include / babeltrace2 / integer-range-set-const.h
CommitLineData
fb91c0ef
PP
1#ifndef BABELTRACE2_INTEGER_RANGE_SET_CONST_H
2#define BABELTRACE2_INTEGER_RANGE_SET_CONST_H
3
4/*
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
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
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
29
30#include <stdint.h>
31#include <stddef.h>
32
33#include <babeltrace2/types.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39extern uint64_t bt_integer_range_unsigned_get_lower(
40 const bt_integer_range_unsigned *range);
41
42extern uint64_t bt_integer_range_unsigned_get_upper(
43 const bt_integer_range_unsigned *range);
44
45extern int64_t bt_integer_range_signed_get_lower(
46 const bt_integer_range_signed *range);
47
48extern int64_t bt_integer_range_signed_get_upper(
49 const bt_integer_range_signed *range);
50
51extern bt_bool bt_integer_range_unsigned_compare(
52 const bt_integer_range_unsigned *range_a,
53 const bt_integer_range_unsigned *range_b);
54
55extern bt_bool bt_integer_range_signed_compare(
56 const bt_integer_range_signed *range_a,
57 const bt_integer_range_signed *range_b);
58
59static inline
60const bt_integer_range_set *bt_integer_range_set_unsigned_as_range_set_const(
61 const bt_integer_range_set_unsigned *range_set)
62{
63 return __BT_UPCAST_CONST(bt_integer_range_set, range_set);
64}
65
66static inline
67const bt_integer_range_set *bt_integer_range_set_signed_as_range_set_const(
68 const bt_integer_range_set_signed *range_set)
69{
70 return __BT_UPCAST_CONST(bt_integer_range_set, range_set);
71}
72
73extern uint64_t bt_integer_range_set_get_range_count(const bt_integer_range_set *range_set);
74
75extern const bt_integer_range_unsigned *
76bt_integer_range_set_unsigned_borrow_range_by_index_const(
77 const bt_integer_range_set_unsigned *range_set, uint64_t index);
78
79extern const bt_integer_range_signed *
80bt_integer_range_set_signed_borrow_range_by_index_const(
81 const bt_integer_range_set_signed *range_set, uint64_t index);
82
83extern bt_bool bt_integer_range_set_unsigned_compare(
84 const bt_integer_range_set_unsigned *range_set_a,
85 const bt_integer_range_set_unsigned *range_set_b);
86
87extern bt_bool bt_integer_range_set_signed_compare(
88 const bt_integer_range_set_signed *range_set_a,
89 const bt_integer_range_set_signed *range_set_b);
90
91extern void bt_integer_range_set_unsigned_get_ref(
92 const bt_integer_range_set_unsigned *range_set);
93
94extern void bt_integer_range_set_unsigned_put_ref(
95 const bt_integer_range_set_unsigned *range_set);
96
97#define BT_RANGE_SET_UNSIGNED_PUT_REF_AND_RESET(_var) \
98 do { \
99 bt_integer_range_set_unsigned_put_ref(_var); \
100 (_var) = NULL; \
101 } while (0)
102
103#define BT_RANGE_SET_UNSIGNED_MOVE_REF(_var_dst, _var_src) \
104 do { \
105 bt_integer_range_set_unsigned_put_ref(_var_dst); \
106 (_var_dst) = (_var_src); \
107 (_var_src) = NULL; \
108 } while (0)
109
110extern void bt_integer_range_set_signed_get_ref(
111 const bt_integer_range_set_signed *range_set);
112
113extern void bt_integer_range_set_signed_put_ref(
114 const bt_integer_range_set_signed *range_set);
115
116#define BT_RANGE_SET_SIGNED_PUT_REF_AND_RESET(_var) \
117 do { \
118 bt_integer_range_set_signed_put_ref(_var); \
119 (_var) = NULL; \
120 } while (0)
121
122#define BT_RANGE_SET_SIGNED_MOVE_REF(_var_dst, _var_src) \
123 do { \
124 bt_integer_range_set_signed_put_ref(_var_dst); \
125 (_var_dst) = (_var_src); \
126 (_var_src) = NULL; \
127 } while (0)
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif /* BABELTRACE2_INTEGER_RANGE_SET_CONST_H */
This page took 0.03122 seconds and 4 git commands to generate.