X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-writer%2Fevent-types.h;h=176fbb42eeef92baa50870a8fbfa41b8881166bb;hb=25f741168b45db9dd975136cfd3f66dbd9af39d0;hp=abad28c56928b6fdcf9f8b38a44947723c44a885;hpb=adc315b840e3970b9f6e255c91e38ec29f05adab;p=babeltrace.git diff --git a/include/babeltrace/ctf-writer/event-types.h b/include/babeltrace/ctf-writer/event-types.h index abad28c5..176fbb42 100644 --- a/include/babeltrace/ctf-writer/event-types.h +++ b/include/babeltrace/ctf-writer/event-types.h @@ -1,7 +1,8 @@ +#ifndef BABELTRACE_CTF_WRITER_EVENT_TYPES_H +#define BABELTRACE_CTF_WRITER_EVENT_TYPES_H + /* - * BabelTrace - CTF Writer: Event Types - * - * Copyright 2013 EfficiOS Inc. + * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau * @@ -27,4 +28,46 @@ * http://www.efficios.com/ctf */ -#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * bt_ctf_field_type_get and bt_ctf_field_type_put: increment and decrement + * the field type's reference count. + * + * You may also use bt_ctf_object_get_ref() and bt_ctf_object_put_ref() with field type objects. + * + * These functions ensure that the field type won't be destroyed while it + * is in use. The same number of get and put (plus one extra put to + * release the initial reference done at creation) have to be done to + * destroy a field type. + * + * When the field type's reference count is decremented to 0 by a + * bt_ctf_field_type_put, the field type is freed. + * + * @param type Field type. + */ + +/* Pre-2.0 CTF writer compatibility */ +static inline +void bt_ctf_field_type_get(struct bt_ctf_field_type *type) +{ + bt_ctf_object_get_ref(type); +} + +/* Pre-2.0 CTF writer compatibility */ +static inline +void bt_ctf_field_type_put(struct bt_ctf_field_type *type) +{ + bt_ctf_object_put_ref(type); +} + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_CTF_WRITER_EVENT_TYPES_H */