CTF writer: Add function to add an integer environment field value
[babeltrace.git] / include / babeltrace / ctf-writer / writer.h
index 0705b05f01ed4cf11471b2a03cfb467c54fcf5c0..140bc5fdf6a39ea5ad66f2e597d877b5ff6ac8ff 100644 (file)
@@ -30,7 +30,8 @@
  * http://www.efficios.com/ctf
  */
 
-#include <babeltrace/ctf-ir/event-types.h>
+#include <babeltrace/ctf-ir/field-types.h>
+#include <babeltrace/ctf-ir/trace.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -53,6 +54,16 @@ struct bt_ctf_clock;
  */
 extern struct bt_ctf_writer *bt_ctf_writer_create(const char *path);
 
+/*
+ * bt_ctf_writer_get_trace: Get a writer's associated trace.
+ *
+ * @param writer Writer instance.
+ *
+ * Return the writer's associated instance, NULL on error.
+ */
+extern struct bt_ctf_trace *bt_ctf_writer_get_trace(
+               struct bt_ctf_writer *writer);
+
 /*
  * bt_ctf_writer_create_stream: create a stream instance.
  *
@@ -84,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.
  *
@@ -124,13 +152,16 @@ extern void bt_ctf_writer_flush_metadata(struct bt_ctf_writer *writer);
 /*
  * bt_ctf_writer_set_byte_order: set a field type's byte order.
  *
- * Set the trace's byte order. Defaults to BT_CTF_BYTE_ORDER_NATIVE,
- * the host machine's endianness.
+ * Set the trace's byte order. Defaults to the host machine's endianness.
  *
  * @param writer Writer instance.
  * @param byte_order Trace's byte order.
  *
  * Returns 0 on success, a negative value on error.
+ *
+ * Note: byte_order must not be BT_CTF_BYTE_ORDER_NATIVE since, according
+ * to the CTF specification, is defined as "the byte order described in the
+ * trace description".
  */
 extern int bt_ctf_writer_set_byte_order(struct bt_ctf_writer *writer,
                enum bt_ctf_byte_order byte_order);
@@ -139,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
This page took 0.024362 seconds and 4 git commands to generate.