lib: add `bt_field_borrow_class()` function declaration
[babeltrace.git] / include / babeltrace2 / current-thread.h
CommitLineData
924dc299
PP
1#ifndef BABELTRACE2_CURRENT_THREAD_H
2#define BABELTRACE2_CURRENT_THREAD_H
553c4bab
PP
3
4/*
bbb7b5f0 5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
553c4bab
PP
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
4fa90f32
PP
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
29
553c4bab
PP
30#include <stdarg.h>
31
553c4bab
PP
32#include <babeltrace2/types.h>
33
553c4bab
PP
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38extern
39const bt_error *bt_current_thread_take_error(void);
40
41extern
42void bt_current_thread_clear_error(void);
43
44extern
45void bt_current_thread_move_error(const bt_error *error);
46
47typedef enum bt_current_thread_error_append_cause_status {
48 BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
49 BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_STATUS_OK = __BT_FUNC_STATUS_OK,
50} bt_current_thread_error_append_cause_status;
51
52extern
53bt_current_thread_error_append_cause_status
54bt_current_thread_error_append_cause_from_unknown(
55 const char *module_name, const char *file_name,
56 uint64_t line_no, const char *msg_fmt, ...);
57
58extern
59bt_current_thread_error_append_cause_status
60bt_current_thread_error_append_cause_from_component(
61 bt_self_component *self_comp, const char *file_name,
62 uint64_t line_no, const char *msg_fmt, ...);
63
64extern
65bt_current_thread_error_append_cause_status
66bt_current_thread_error_append_cause_from_component_class(
67 bt_self_component_class *self_comp_class, const char *file_name,
68 uint64_t line_no, const char *msg_fmt, ...);
69
70extern
71bt_current_thread_error_append_cause_status
72bt_current_thread_error_append_cause_from_message_iterator(
73 bt_self_message_iterator *self_iter, const char *file_name,
74 uint64_t line_no, const char *msg_fmt, ...);
75
76#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(_module_name, _msg_fmt, ...) \
77 bt_current_thread_error_append_cause_from_unknown( \
78 (_module_name), __FILE__, __LINE__, (_msg_fmt), ##__VA_ARGS__)
79
80#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(_self_comp, _msg_fmt, ...) \
81 bt_current_thread_error_append_cause_from_component( \
82 (_self_comp), __FILE__, __LINE__, (_msg_fmt), ##__VA_ARGS__)
83
84#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT_CLASS(_self_cc, _msg_fmt, ...) \
85 bt_current_thread_error_append_cause_from_component_class( \
86 (_self_cc), __FILE__, __LINE__, (_msg_fmt), ##__VA_ARGS__)
87
88#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_MESSAGE_ITERATOR(_self_iter, _msg_fmt, ...) \
cdbf0f10 89 bt_current_thread_error_append_cause_from_message_iterator( \
553c4bab
PP
90 (_self_iter), __FILE__, __LINE__, (_msg_fmt), ##__VA_ARGS__)
91
ce4923b0
SM
92#define BT_CURRENT_THREAD_MOVE_ERROR_AND_RESET(_var) \
93 do { \
94 bt_current_thread_move_error(_var); \
95 (_var) = NULL; \
96 } while (0)
97
553c4bab
PP
98#ifdef __cplusplus
99}
100#endif
101
924dc299 102#endif /* BABELTRACE2_CURRENT_THREAD_H */
This page took 0.030625 seconds and 4 git commands to generate.