X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-writer%2Fwriter.h;h=82719c66aebdf09f9e1cea56c224ec78a902837a;hb=7e69c04f557e46fb50e5a888a3bc3451afbd3b8e;hp=f189ab5cb2656d5b586ea31b717a51ea2af346cb;hpb=c35a1669cedba73681bd259ea7945aa55643e158;p=babeltrace.git diff --git a/include/babeltrace/ctf-writer/writer.h b/include/babeltrace/ctf-writer/writer.h index f189ab5c..82719c66 100644 --- a/include/babeltrace/ctf-writer/writer.h +++ b/include/babeltrace/ctf-writer/writer.h @@ -2,8 +2,6 @@ #define BABELTRACE_CTF_WRITER_WRITER_H /* - * BabelTrace - CTF Writer: Writer - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,8 +28,10 @@ * http://www.efficios.com/ctf */ -#include -#include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { @@ -95,6 +95,23 @@ extern int bt_ctf_writer_add_environment_field(struct bt_ctf_writer *writer, const char *name, const char *value); +/* + * bt_ctf_writer_add_environment_field_int64: add an environment field to the trace. + * + * Add an environment field to the trace. The name and value parameters are + * copied. + * + * @param writer Writer instance. + * @param name Name of the environment field (will be copied). + * @param value Value of the environment field. + * + * Returns 0 on success, a negative value on error. + */ +extern int bt_ctf_writer_add_environment_field_int64( + struct bt_ctf_writer *writer, + const char *name, + int64_t value); + /* * bt_ctf_writer_add_clock: add a clock to the trace. * @@ -153,6 +170,8 @@ extern int bt_ctf_writer_set_byte_order(struct bt_ctf_writer *writer, * bt_ctf_writer_get and bt_ctf_writer_put: increment and decrement the * writer's reference count. * + * You may also use bt_ctf_get() and bt_ctf_put() with writer objects. + * * These functions ensure that the writer 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 @@ -163,8 +182,20 @@ extern int bt_ctf_writer_set_byte_order(struct bt_ctf_writer *writer, * * @param writer Writer instance. */ -extern void bt_ctf_writer_get(struct bt_ctf_writer *writer); -extern void bt_ctf_writer_put(struct bt_ctf_writer *writer); + +/* Pre-2.0 CTF writer compatibility */ +static inline +void bt_ctf_writer_get(struct bt_ctf_writer *writer) +{ + bt_ctf_object_get_ref(writer); +} + +/* Pre-2.0 CTF writer compatibility */ +static inline +void bt_ctf_writer_put(struct bt_ctf_writer *writer) +{ + bt_ctf_object_put_ref(writer); +} #ifdef __cplusplus }