| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation |
| 5 | */ |
| 6 | |
| 7 | #ifndef BABELTRACE2_CTF_WRITER_EVENT_TYPES_H |
| 8 | #define BABELTRACE2_CTF_WRITER_EVENT_TYPES_H |
| 9 | |
| 10 | #include <babeltrace2-ctf-writer/object.h> |
| 11 | #include <babeltrace2-ctf-writer/field-types.h> |
| 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 | * |
| 21 | * You may also use bt_ctf_object_get_ref() and bt_ctf_object_put_ref() with field type objects. |
| 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 | */ |
| 33 | |
| 34 | /* Pre-2.0 CTF writer compatibility */ |
| 35 | static inline |
| 36 | void bt_ctf_field_type_get(struct bt_ctf_field_type *type) |
| 37 | { |
| 38 | bt_ctf_object_get_ref(type); |
| 39 | } |
| 40 | |
| 41 | /* Pre-2.0 CTF writer compatibility */ |
| 42 | static inline |
| 43 | void bt_ctf_field_type_put(struct bt_ctf_field_type *type) |
| 44 | { |
| 45 | bt_ctf_object_put_ref(type); |
| 46 | } |
| 47 | |
| 48 | #ifdef __cplusplus |
| 49 | } |
| 50 | #endif |
| 51 | |
| 52 | #endif /* BABELTRACE2_CTF_WRITER_EVENT_TYPES_H */ |