lib: strictly type function return status enumerations
[babeltrace.git] / include / babeltrace2 / types.h
CommitLineData
c55a9f58
PP
1#ifndef BABELTRACE_TYPES_H
2#define BABELTRACE_TYPES_H
3
4/*
5 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
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
44c440bc
PP
26#include <stdint.h>
27
005f1204
PP
28/* Internal use */
29#ifdef __cplusplus
30# define __BT_UPCAST(_type, _p) static_cast<_type *>(static_cast<void *>(_p))
31# define __BT_UPCAST_CONST(_type, _p) static_cast<const _type *>(static_cast<const void *>(_p))
32#else
33# define __BT_UPCAST(_type, _p) ((_type *) (_p))
34# define __BT_UPCAST_CONST(_type, _p) ((const _type *) (_p))
35#endif
36
c55a9f58
PP
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/**
42@defgroup ctypes Babeltrace C types
43@ingroup apiref
44@brief Babeltrace C types.
45
46@code
3fadfbc0 47#include <babeltrace2/types.h>
c55a9f58
PP
48@endcode
49
50This header contains custom type definitions used across the library.
51
52@file
53@brief Babeltrace C types.
54@sa ctypes
55
56@addtogroup ctypes
57@{
58*/
59
60/// False boolean value for the #bt_bool type.
61#define BT_FALSE 0
62
63/// True boolean value for the #bt_bool type.
64#define BT_TRUE 1
65
66/**
67@brief Babeltrace's boolean type.
68
69Use only the #BT_FALSE and #BT_TRUE definitions for #bt_bool parameters.
70It is guaranteed that the library functions which return a #bt_bool
71value return either #BT_FALSE or #BT_TRUE.
72
73You can always test the truthness of a #bt_bool value directly, without
74comparing it to #BT_TRUE directly:
75
76@code
77bt_bool ret = bt_some_function(...);
78
79if (ret) {
80 // ret is true
81}
82@endcode
83*/
84typedef int bt_bool;
85
44c440bc
PP
86typedef const uint8_t *bt_uuid;
87
b19ff26f 88typedef struct bt_clock_class bt_clock_class;
605e1019 89typedef struct bt_clock_snapshot bt_clock_snapshot;
b19ff26f
PP
90typedef struct bt_component bt_component;
91typedef struct bt_component_class bt_component_class;
92typedef struct bt_component_class_filter bt_component_class_filter;
93typedef struct bt_component_class_sink bt_component_class_sink;
94typedef struct bt_component_class_source bt_component_class_source;
95typedef struct bt_component_filter bt_component_filter;
b19ff26f
PP
96typedef struct bt_component_sink bt_component_sink;
97typedef struct bt_component_source bt_component_source;
98typedef struct bt_connection bt_connection;
99typedef struct bt_event bt_event;
100typedef struct bt_event_class bt_event_class;
101typedef struct bt_event_header_field bt_event_header_field;
102typedef struct bt_field bt_field;
103typedef struct bt_field_class bt_field_class;
8f3ccfbc
PP
104typedef struct bt_field_class_enumeration_mapping bt_field_class_enumeration_mapping;
105typedef struct bt_field_class_signed_enumeration_mapping bt_field_class_signed_enumeration_mapping;
106typedef struct bt_field_class_unsigned_enumeration_mapping bt_field_class_unsigned_enumeration_mapping;
1e6fd1d7
PP
107typedef struct bt_field_class_structure_member bt_field_class_structure_member;
108typedef struct bt_field_class_variant_option bt_field_class_variant_option;
b19ff26f 109typedef struct bt_field_path bt_field_path;
66ddcddf 110typedef struct bt_field_path_item bt_field_path_item;
b19ff26f 111typedef struct bt_graph bt_graph;
d6e69534
PP
112typedef struct bt_message bt_message;
113typedef struct bt_message_iterator bt_message_iterator;
b19ff26f
PP
114typedef struct bt_object bt_object;
115typedef struct bt_packet bt_packet;
116typedef struct bt_packet_context_field bt_packet_context_field;
117typedef struct bt_packet_header_field bt_packet_header_field;
118typedef struct bt_plugin bt_plugin;
119typedef struct bt_plugin_set bt_plugin_set;
120typedef struct bt_plugin_so_shared_lib_handle bt_plugin_so_shared_lib_handle;
121typedef struct bt_port bt_port;
122typedef struct bt_port_input bt_port_input;
123typedef struct bt_port_output bt_port_output;
d6e69534 124typedef struct bt_port_output_message_iterator bt_port_output_message_iterator;
b19ff26f
PP
125typedef struct bt_query_executor bt_query_executor;
126typedef struct bt_self_component bt_self_component;
127typedef struct bt_self_component_class_filter bt_self_component_class_filter;
128typedef struct bt_self_component_class_sink bt_self_component_class_sink;
129typedef struct bt_self_component_class_source bt_self_component_class_source;
130typedef struct bt_self_component_filter bt_self_component_filter;
131typedef struct bt_self_component_port bt_self_component_port;
132typedef struct bt_self_component_port_input bt_self_component_port_input;
d6e69534 133typedef struct bt_self_component_port_input_message_iterator bt_self_component_port_input_message_iterator;
b19ff26f
PP
134typedef struct bt_self_component_port_output bt_self_component_port_output;
135typedef struct bt_self_component_sink bt_self_component_sink;
136typedef struct bt_self_component_source bt_self_component_source;
d6e69534 137typedef struct bt_self_message_iterator bt_self_message_iterator;
d24d5663 138typedef struct bt_self_plugin bt_self_plugin;
d6e69534 139typedef struct bt_self_port bt_self_port;
b19ff26f
PP
140typedef struct bt_self_port_input bt_self_port_input;
141typedef struct bt_self_port_output bt_self_port_output;
b19ff26f
PP
142typedef struct bt_stream bt_stream;
143typedef struct bt_stream_class bt_stream_class;
144typedef struct bt_trace bt_trace;
145typedef struct bt_trace_class bt_trace_class;
146typedef struct bt_value bt_value;
147
148typedef const char * const *bt_field_class_enumeration_mapping_label_array;
d6e69534 149typedef const struct bt_message **bt_message_array_const;
b19ff26f 150
c55a9f58
PP
151/** @} */
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* BABELTRACE_TYPES_H */
This page took 0.043708 seconds and 4 git commands to generate.