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_FIELDS_H |
8 | #define BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H | |
9 | ||
217cf9d3 PP |
10 | #include <babeltrace2-ctf-writer/object.h> |
11 | #include <babeltrace2-ctf-writer/field-types.h> | |
12 | #include <babeltrace2-ctf-writer/fields.h> | |
8c18d80b PP |
13 | |
14 | #ifdef __cplusplus | |
15 | extern "C" { | |
16 | #endif | |
17 | ||
18 | /* | |
19 | * bt_ctf_field_get and bt_ctf_field_put: increment and decrement the | |
20 | * field's reference count. | |
21 | * | |
e1e02a22 | 22 | * You may also use bt_ctf_object_get_ref() and bt_ctf_object_put_ref() with field objects. |
8c18d80b PP |
23 | * |
24 | * These functions ensure that the field won't be destroyed when it | |
25 | * is in use. The same number of get and put (plus one extra put to | |
26 | * release the initial reference done at creation) have to be done to | |
27 | * destroy a field. | |
28 | * | |
29 | * When the field's reference count is decremented to 0 by a bt_ctf_field_put, | |
30 | * the field is freed. | |
31 | * | |
32 | * @param field Field instance. | |
33 | */ | |
3dca2276 PP |
34 | |
35 | /* Pre-2.0 CTF writer compatibility */ | |
36 | static inline | |
16ca5ff0 | 37 | void bt_ctf_field_get(struct bt_ctf_field *field) |
3dca2276 | 38 | { |
e1e02a22 | 39 | bt_ctf_object_get_ref(field); |
3dca2276 PP |
40 | } |
41 | ||
42 | /* Pre-2.0 CTF writer compatibility */ | |
43 | static inline | |
16ca5ff0 | 44 | void bt_ctf_field_put(struct bt_ctf_field *field) |
3dca2276 | 45 | { |
e1e02a22 | 46 | bt_ctf_object_put_ref(field); |
3dca2276 | 47 | } |
8c18d80b PP |
48 | |
49 | #ifdef __cplusplus | |
50 | } | |
51 | #endif | |
52 | ||
924dc299 | 53 | #endif /* BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H */ |