Commit | Line | Data |
---|---|---|
46bd0f2b | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
46bd0f2b | 3 | * |
0235b0db | 4 | * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation |
46bd0f2b JG |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef BABELTRACE2_CTF_WRITER_EVENT_TYPES_H |
8 | #define BABELTRACE2_CTF_WRITER_EVENT_TYPES_H | |
9 | ||
217cf9d3 PP |
10 | #include <babeltrace2-ctf-writer/object.h> |
11 | #include <babeltrace2-ctf-writer/field-types.h> | |
8c18d80b PP |
12 | |
13 | #ifdef __cplusplus | |
14 | extern "C" { | |
15 | #endif | |
16 | ||
17 | /* | |
18 | * bt_ctf_field_type_get and bt_ctf_field_type_put: increment and decrement | |
19 | * the field type's reference count. | |
20 | * | |
e1e02a22 | 21 | * You may also use bt_ctf_object_get_ref() and bt_ctf_object_put_ref() with field type objects. |
8c18d80b PP |
22 | * |
23 | * These functions ensure that the field type won't be destroyed while it | |
24 | * is in use. The same number of get and put (plus one extra put to | |
25 | * release the initial reference done at creation) have to be done to | |
26 | * destroy a field type. | |
27 | * | |
28 | * When the field type's reference count is decremented to 0 by a | |
29 | * bt_ctf_field_type_put, the field type is freed. | |
30 | * | |
31 | * @param type Field type. | |
32 | */ | |
3dca2276 PP |
33 | |
34 | /* Pre-2.0 CTF writer compatibility */ | |
35 | static inline | |
16ca5ff0 | 36 | void bt_ctf_field_type_get(struct bt_ctf_field_type *type) |
3dca2276 | 37 | { |
e1e02a22 | 38 | bt_ctf_object_get_ref(type); |
3dca2276 PP |
39 | } |
40 | ||
41 | /* Pre-2.0 CTF writer compatibility */ | |
42 | static inline | |
16ca5ff0 | 43 | void bt_ctf_field_type_put(struct bt_ctf_field_type *type) |
3dca2276 | 44 | { |
e1e02a22 | 45 | bt_ctf_object_put_ref(type); |
3dca2276 | 46 | } |
8c18d80b PP |
47 | |
48 | #ifdef __cplusplus | |
49 | } | |
50 | #endif | |
51 | ||
924dc299 | 52 | #endif /* BABELTRACE2_CTF_WRITER_EVENT_TYPES_H */ |