CTF writer is not part of the Babeltrace library.
With this patch, `include/babeltrace2` contains only the Babeltrace
library public headers, and `include/babeltrace2-ctf-writer` contains
only the Babeltrace CTF writer library public headers.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I605ef01e1afbf0188f1ba5b094aed48717d46aff
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1675
Tested-by: jenkins <jenkins@lttng.org>
babeltrace2/version.h
# CTF writer API
-babeltrace2ctfwriterincludedir = "$(includedir)/babeltrace2/ctf-writer"
+babeltrace2ctfwriterincludedir = "$(includedir)/babeltrace2-ctf-writer"
babeltrace2ctfwriterinclude_HEADERS = \
- babeltrace2/ctf-writer/clock-class.h \
- babeltrace2/ctf-writer/clock.h \
- babeltrace2/ctf-writer/event-fields.h \
- babeltrace2/ctf-writer/event-types.h \
- babeltrace2/ctf-writer/event.h \
- babeltrace2/ctf-writer/field-types.h \
- babeltrace2/ctf-writer/fields.h \
- babeltrace2/ctf-writer/object.h \
- babeltrace2/ctf-writer/stream-class.h \
- babeltrace2/ctf-writer/stream.h \
- babeltrace2/ctf-writer/trace.h \
- babeltrace2/ctf-writer/types.h \
- babeltrace2/ctf-writer/utils.h \
- babeltrace2/ctf-writer/visitor.h \
- babeltrace2/ctf-writer/writer.h
+ babeltrace2-ctf-writer/clock-class.h \
+ babeltrace2-ctf-writer/clock.h \
+ babeltrace2-ctf-writer/event-fields.h \
+ babeltrace2-ctf-writer/event-types.h \
+ babeltrace2-ctf-writer/event.h \
+ babeltrace2-ctf-writer/field-types.h \
+ babeltrace2-ctf-writer/fields.h \
+ babeltrace2-ctf-writer/object.h \
+ babeltrace2-ctf-writer/stream-class.h \
+ babeltrace2-ctf-writer/stream.h \
+ babeltrace2-ctf-writer/trace.h \
+ babeltrace2-ctf-writer/types.h \
+ babeltrace2-ctf-writer/utils.h \
+ babeltrace2-ctf-writer/visitor.h \
+ babeltrace2-ctf-writer/writer.h
# Trace IR API
babeltrace2traceirincludedir = "$(includedir)/babeltrace2/trace-ir"
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_CLOCK_CLASS_H
+#define BABELTRACE2_CTF_WRITER_CLOCK_CLASS_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_clock_class;
+
+extern struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name,
+ uint64_t freq);
+
+extern const char *bt_ctf_clock_class_get_name(
+ struct bt_ctf_clock_class *clock_class);
+
+extern int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class,
+ const char *name);
+
+extern const char *bt_ctf_clock_class_get_description(
+ struct bt_ctf_clock_class *clock_class);
+
+extern int bt_ctf_clock_class_set_description(
+ struct bt_ctf_clock_class *clock_class,
+ const char *desc);
+
+extern uint64_t bt_ctf_clock_class_get_frequency(
+ struct bt_ctf_clock_class *clock_class);
+
+extern int bt_ctf_clock_class_set_frequency(
+ struct bt_ctf_clock_class *clock_class, uint64_t freq);
+
+extern uint64_t bt_ctf_clock_class_get_precision(
+ struct bt_ctf_clock_class *clock_class);
+
+extern int bt_ctf_clock_class_set_precision(
+ struct bt_ctf_clock_class *clock_class, uint64_t precision);
+
+extern int bt_ctf_clock_class_get_offset_s(
+ struct bt_ctf_clock_class *clock_class, int64_t *seconds);
+
+extern int bt_ctf_clock_class_set_offset_s(
+ struct bt_ctf_clock_class *clock_class, int64_t seconds);
+
+extern int bt_ctf_clock_class_get_offset_cycles(
+ struct bt_ctf_clock_class *clock_class, int64_t *cycles);
+
+extern int bt_ctf_clock_class_set_offset_cycles(
+ struct bt_ctf_clock_class *clock_class, int64_t cycles);
+
+extern bt_ctf_bool bt_ctf_clock_class_is_absolute(
+ struct bt_ctf_clock_class *clock_class);
+
+extern int bt_ctf_clock_class_set_is_absolute(
+ struct bt_ctf_clock_class *clock_class, bt_ctf_bool is_absolute);
+
+extern const uint8_t *bt_ctf_clock_class_get_uuid(
+ struct bt_ctf_clock_class *clock_class);
+
+extern int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class,
+ const uint8_t *uuid);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_CLOCK_CLASS_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_CLOCK_H
+#define BABELTRACE2_CTF_WRITER_CLOCK_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_clock;
+struct bt_ctf_clock_class;
+
+/*
+ * bt_ctf_clock_create: create a clock.
+ *
+ * Allocate a new clock setting its reference count to 1.
+ *
+ * @param name Name of the clock (will be copied); can be set to NULL
+ * for nameless clocks.
+ *
+ * Returns an allocated clock on success, NULL on error.
+ */
+extern struct bt_ctf_clock *bt_ctf_clock_create(const char *name);
+
+/*
+ * bt_ctf_clock_get_name: get a clock's name.
+ *
+ * Get the clock's name.
+ *
+ * @param clock Clock instance.
+ *
+ * Returns the clock's name, NULL on error.
+ */
+extern const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock);
+
+/*
+ * bt_ctf_clock_get_description: get a clock's description.
+ *
+ * Get the clock's description.
+ *
+ * @param clock Clock instance.
+ *
+ * Returns the clock's description, NULL if unset.
+ */
+extern const char *bt_ctf_clock_get_description(struct bt_ctf_clock *clock);
+
+/*
+ * bt_ctf_clock_set_description: set a clock's description.
+ *
+ * Set the clock's description. The description appears in the clock's TSDL
+ * meta-data.
+ *
+ * @param clock Clock instance.
+ * @param desc Description of the clock.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_description(struct bt_ctf_clock *clock,
+ const char *desc);
+
+/*
+ * bt_ctf_clock_get_frequency: get a clock's frequency.
+ *
+ * Get the clock's frequency (Hz).
+ *
+ * @param clock Clock instance.
+ *
+ * Returns the clock's frequency, -1ULL on error.
+ */
+extern uint64_t bt_ctf_clock_get_frequency(struct bt_ctf_clock *clock);
+
+/*
+ * bt_ctf_clock_set_frequency: set a clock's frequency.
+ *
+ * Set the clock's frequency (Hz).
+ *
+ * @param clock Clock instance.
+ * @param freq Clock's frequency in Hz, defaults to 1 000 000 000 Hz (1ns).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_frequency(struct bt_ctf_clock *clock,
+ uint64_t freq);
+
+/*
+ * bt_ctf_clock_get_precision: get a clock's precision.
+ *
+ * Get the clock's precision (in clock ticks).
+ *
+ * @param clock Clock instance.
+ *
+ * Returns the clock's precision, -1ULL on error.
+ */
+extern uint64_t bt_ctf_clock_get_precision(struct bt_ctf_clock *clock);
+
+/*
+ * bt_ctf_clock_set_precision: set a clock's precision.
+ *
+ * Set the clock's precision.
+ *
+ * @param clock Clock instance.
+ * @param precision Clock's precision in clock ticks, defaults to 1.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_precision(struct bt_ctf_clock *clock,
+ uint64_t precision);
+
+/*
+ * bt_ctf_clock_get_offset_s: get a clock's offset in seconds.
+ *
+ * Get the clock's offset in seconds from POSIX.1 Epoch, 1970-01-01.
+ *
+ * @param clock Clock instance.
+ * @param offset_s Pointer to clock offset in seconds (output).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock,
+ int64_t *offset_s);
+
+/*
+ * bt_ctf_clock_set_offset_s: set a clock's offset in seconds.
+ *
+ * Set the clock's offset in seconds from POSIX.1 Epoch, 1970-01-01,
+ * defaults to 0.
+ *
+ * @param clock Clock instance.
+ * @param offset_s Clock's offset in seconds, defaults to 0.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_offset_s(struct bt_ctf_clock *clock,
+ int64_t offset_s);
+
+/*
+ * bt_ctf_clock_get_offset: get a clock's offset in ticks.
+ *
+ * Get the clock's offset in ticks from Epoch + offset_t.
+ *
+ * @param clock Clock instance.
+ * @param offset Clock offset in ticks from Epoch + offset_s (output).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_get_offset(struct bt_ctf_clock *clock,
+ int64_t *offset);
+
+/*
+ * bt_ctf_clock_set_offset: set a clock's offset in ticks.
+ *
+ * Set the clock's offset in ticks from Epoch + offset_s.
+ *
+ * @param clock Clock instance.
+ * @param offset Clock's offset in ticks from Epoch + offset_s, defaults to 0.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_offset(struct bt_ctf_clock *clock,
+ int64_t offset);
+
+/*
+ * bt_ctf_clock_get_is_absolute: get a clock's absolute attribute.
+ *
+ * Get the clock's absolute attribute. A clock is absolute if the clock is a
+ * global reference across the trace's other clocks.
+ *
+ * @param clock Clock instance.
+ *
+ * Returns the clock's absolute attribute, a negative value on error.
+ */
+extern int bt_ctf_clock_get_is_absolute(struct bt_ctf_clock *clock);
+
+/*
+ * bt_ctf_clock_set_is_absolute: set a clock's absolute attribute.
+ *
+ * Set the clock's absolute attribute. A clock is absolute if the clock is a
+ * global reference across the trace's other clocks.
+ *
+ * @param clock Clock instance.
+ * @param is_absolute Clock's absolute attribute, defaults to FALSE.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_is_absolute(struct bt_ctf_clock *clock,
+ int is_absolute);
+
+/*
+ * bt_ctf_clock_get_uuid: get a clock's UUID.
+ *
+ * Get the clock's UUID.
+ *
+ * @param clock Clock instance.
+ *
+ * Returns a pointer to the clock's UUID (16 byte array) on success,
+ * NULL on error.
+ */
+extern const uint8_t *bt_ctf_clock_get_uuid(struct bt_ctf_clock *clock);
+
+/*
+ * bt_ctf_clock_set_uuid: set a clock's UUID.
+ *
+ * Set a clock's UUID.
+ *
+ * @param clock Clock instance.
+ * @param uuid A 16-byte array containing a UUID.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_uuid(struct bt_ctf_clock *clock,
+ const uint8_t *uuid);
+
+/*
+ * bt_ctf_clock_set_time: set a clock's current time value.
+ *
+ * Set the current time in nanoseconds since the clock's origin (offset and
+ * offset_s attributes). Defaults to 0.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_clock_set_time(struct bt_ctf_clock *clock,
+ int64_t time);
+
+/*
+ * bt_ctf_clock_get and bt_ctf_clock_put: increment and decrement the
+ * refcount of the clock
+ *
+ * You may also use bt_ctf_get() and bt_ctf_put() with clock objects.
+ *
+ * These functions ensure that the clock won't be destroyed when it
+ * is in use. The same number of get and put (plus one extra put to
+ * release the initial reference done at creation) has to be done to
+ * destroy a clock.
+ *
+ * When the clock refcount is decremented to 0 by a bt_ctf_clock_put,
+ * the clock is freed.
+ *
+ * @param clock Clock instance.
+ */
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_clock_get(struct bt_ctf_clock *clock)
+{
+ bt_ctf_object_get_ref(clock);
+}
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_clock_put(struct bt_ctf_clock *clock)
+{
+ bt_ctf_object_put_ref(clock);
+}
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_CLOCK_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H
+#define BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/fields.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * bt_ctf_field_get and bt_ctf_field_put: increment and decrement the
+ * field's reference count.
+ *
+ * You may also use bt_ctf_object_get_ref() and bt_ctf_object_put_ref() with field objects.
+ *
+ * These functions ensure that the field won't be destroyed when 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.
+ *
+ * When the field's reference count is decremented to 0 by a bt_ctf_field_put,
+ * the field is freed.
+ *
+ * @param field Field instance.
+ */
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_field_get(struct bt_ctf_field *field)
+{
+ bt_ctf_object_get_ref(field);
+}
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_field_put(struct bt_ctf_field *field)
+{
+ bt_ctf_object_put_ref(field);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_EVENT_TYPES_H
+#define BABELTRACE2_CTF_WRITER_EVENT_TYPES_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+
+#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 /* BABELTRACE2_CTF_WRITER_EVENT_TYPES_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_EVENT_H
+#define BABELTRACE2_CTF_WRITER_EVENT_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace2-ctf-writer/object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_event;
+struct bt_ctf_event_class;
+struct bt_ctf_stream;
+struct bt_ctf_field;
+struct bt_ctf_field_type;
+
+enum bt_ctf_event_class_log_level {
+ /// Unknown, used for errors.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1,
+
+ /// Unspecified log level.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255,
+
+ /// System is unusable.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0,
+
+ /// Action must be taken immediately.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1,
+
+ /// Critical conditions.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2,
+
+ /// Error conditions.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3,
+
+ /// Warning conditions.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4,
+
+ /// Normal, but significant, condition.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5,
+
+ /// Informational message.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6,
+
+ /// Debug information with system-level scope (set of programs).
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7,
+
+ /// Debug information with program-level scope (set of processes).
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8,
+
+ /// Debug information with process-level scope (set of modules).
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9,
+
+ /// Debug information with module (executable/library) scope (set of units).
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10,
+
+ /// Debug information with compilation unit scope (set of functions).
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11,
+
+ /// Debug information with function-level scope.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12,
+
+ /// Debug information with line-level scope (default log level).
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13,
+
+ /// Debug-level message.
+ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14,
+};
+
+extern struct bt_ctf_event *bt_ctf_event_create(
+ struct bt_ctf_event_class *event_class);
+
+extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event,
+ const char *name);
+
+extern int bt_ctf_event_set_payload(struct bt_ctf_event *event,
+ const char *name, struct bt_ctf_field *field);
+
+extern struct bt_ctf_field *bt_ctf_event_get_payload_field(
+ struct bt_ctf_event *event);
+
+extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
+ struct bt_ctf_field *field);
+
+extern int bt_ctf_event_set_context(struct bt_ctf_event *event,
+ struct bt_ctf_field *field);
+
+extern struct bt_ctf_field *bt_ctf_event_get_context(
+ struct bt_ctf_event *event);
+
+extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event,
+ struct bt_ctf_field *field);
+
+extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context(
+ struct bt_ctf_event *event);
+
+extern int bt_ctf_event_set_header(struct bt_ctf_event *event,
+ struct bt_ctf_field *field);
+
+extern struct bt_ctf_field *bt_ctf_event_get_header(
+ struct bt_ctf_event *event);
+
+extern struct bt_ctf_stream *bt_ctf_event_get_stream(
+ struct bt_ctf_event *event);
+
+extern struct bt_ctf_event_class *bt_ctf_event_get_class(
+ struct bt_ctf_event *event);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_event_get(struct bt_ctf_event *event)
+{
+ bt_ctf_object_get_ref(event);
+}
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_event_put(struct bt_ctf_event *event)
+{
+ bt_ctf_object_put_ref(event);
+}
+
+extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name);
+
+extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
+ struct bt_ctf_event_class *event_class);
+
+extern const char *bt_ctf_event_class_get_name(
+ struct bt_ctf_event_class *event_class);
+
+extern int64_t bt_ctf_event_class_get_id(
+ struct bt_ctf_event_class *event_class);
+
+extern int bt_ctf_event_class_set_id(
+ struct bt_ctf_event_class *event_class, uint64_t id);
+
+extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
+ struct bt_ctf_event_class *event_class);
+
+extern int bt_ctf_event_class_set_log_level(
+ struct bt_ctf_event_class *event_class,
+ enum bt_ctf_event_class_log_level log_level);
+
+extern const char *bt_ctf_event_class_get_emf_uri(
+ struct bt_ctf_event_class *event_class);
+
+extern int bt_ctf_event_class_set_emf_uri(
+ struct bt_ctf_event_class *event_class,
+ const char *emf_uri);
+
+extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type(
+ struct bt_ctf_event_class *event_class);
+
+extern int bt_ctf_event_class_set_context_field_type(
+ struct bt_ctf_event_class *event_class,
+ struct bt_ctf_field_type *context_type);
+
+extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type(
+ struct bt_ctf_event_class *event_class);
+
+extern int bt_ctf_event_class_set_payload_field_type(
+ struct bt_ctf_event_class *event_class,
+ struct bt_ctf_field_type *payload_type);
+
+extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class,
+ struct bt_ctf_field_type *field_type,
+ const char *name);
+
+extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
+ struct bt_ctf_event_class *event_class, const char *name);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class)
+{
+ bt_ctf_object_get_ref(event_class);
+}
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class)
+{
+ bt_ctf_object_put_ref(event_class);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_EVENT_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_FIELD_TYPES_H
+#define BABELTRACE2_CTF_WRITER_FIELD_TYPES_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+#include <babeltrace2-ctf-writer/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_field;
+struct bt_ctf_field_type;
+
+enum bt_ctf_scope {
+ /// Unknown, used for errors.
+ BT_CTF_SCOPE_UNKNOWN = -1,
+
+ /// Trace packet header.
+ BT_CTF_SCOPE_TRACE_PACKET_HEADER = 1,
+
+ /// Stream packet context.
+ BT_CTF_SCOPE_STREAM_PACKET_CONTEXT = 2,
+
+ /// Stream event header.
+ BT_CTF_SCOPE_STREAM_EVENT_HEADER = 3,
+
+ /// Stream event context.
+ BT_CTF_SCOPE_STREAM_EVENT_CONTEXT = 4,
+
+ /// Event context.
+ BT_CTF_SCOPE_EVENT_CONTEXT = 5,
+
+ /// Event payload.
+ BT_CTF_SCOPE_EVENT_PAYLOAD = 6,
+
+ /// @cond DOCUMENT
+ BT_CTF_SCOPE_ENV = 0,
+ BT_CTF_SCOPE_EVENT_FIELDS = 6,
+ /// @endcond
+};
+
+enum bt_ctf_field_type_id {
+ BT_CTF_FIELD_TYPE_ID_UNKNOWN = -1,
+ BT_CTF_FIELD_TYPE_ID_INTEGER = 0,
+ BT_CTF_FIELD_TYPE_ID_FLOAT = 1,
+ BT_CTF_FIELD_TYPE_ID_ENUM = 2,
+ BT_CTF_FIELD_TYPE_ID_STRING = 3,
+ BT_CTF_FIELD_TYPE_ID_STRUCT = 4,
+ BT_CTF_FIELD_TYPE_ID_ARRAY = 5,
+ BT_CTF_FIELD_TYPE_ID_SEQUENCE = 6,
+ BT_CTF_FIELD_TYPE_ID_VARIANT = 7,
+ BT_CTF_FIELD_TYPE_ID_NR,
+};
+
+extern enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id(
+ struct bt_ctf_field_type *field_type);
+
+enum bt_ctf_byte_order {
+ BT_CTF_BYTE_ORDER_UNKNOWN = -1,
+ BT_CTF_BYTE_ORDER_NATIVE = 0,
+ BT_CTF_BYTE_ORDER_UNSPECIFIED,
+ BT_CTF_BYTE_ORDER_LITTLE_ENDIAN,
+ BT_CTF_BYTE_ORDER_BIG_ENDIAN,
+ BT_CTF_BYTE_ORDER_NETWORK,
+};
+
+enum bt_ctf_string_encoding {
+ BT_CTF_STRING_ENCODING_UNKNOWN = -1,
+ BT_CTF_STRING_ENCODING_NONE,
+ BT_CTF_STRING_ENCODING_UTF8,
+ BT_CTF_STRING_ENCODING_ASCII,
+};
+
+/* Pre-2.0 CTF writer compatibility */
+#define ctf_string_encoding bt_ctf_string_encoding
+
+extern int bt_ctf_field_type_get_alignment(
+ struct bt_ctf_field_type *field_type);
+
+extern int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *field_type,
+ unsigned int alignment);
+
+extern enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order(
+ struct bt_ctf_field_type *field_type);
+
+extern int bt_ctf_field_type_set_byte_order(
+ struct bt_ctf_field_type *field_type,
+ enum bt_ctf_byte_order byte_order);
+
+enum bt_ctf_integer_base {
+ /// Unknown, used for errors.
+ BT_CTF_INTEGER_BASE_UNKNOWN = -1,
+
+ /// Unspecified by the tracer.
+ BT_CTF_INTEGER_BASE_UNSPECIFIED = 0,
+
+ /// Binary.
+ BT_CTF_INTEGER_BASE_BINARY = 2,
+
+ /// Octal.
+ BT_CTF_INTEGER_BASE_OCTAL = 8,
+
+ /// Decimal.
+ BT_CTF_INTEGER_BASE_DECIMAL = 10,
+
+ /// Hexadecimal.
+ BT_CTF_INTEGER_BASE_HEXADECIMAL = 16,
+};
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_integer_create(
+ unsigned int size);
+
+extern int bt_ctf_field_type_integer_get_size(
+ struct bt_ctf_field_type *int_field_type);
+
+extern int bt_ctf_field_type_integer_set_size(
+ struct bt_ctf_field_type *int_field_type, unsigned int size);
+
+extern bt_ctf_bool bt_ctf_field_type_integer_is_signed(
+ struct bt_ctf_field_type *int_field_type);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+int bt_ctf_field_type_integer_get_signed(
+ struct bt_ctf_field_type *int_field_type)
+{
+ return bt_ctf_field_type_integer_is_signed(int_field_type) ? 1 : 0;
+}
+
+extern int bt_ctf_field_type_integer_set_is_signed(
+ struct bt_ctf_field_type *int_field_type, bt_ctf_bool is_signed);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+int bt_ctf_field_type_integer_set_signed(
+ struct bt_ctf_field_type *int_field_type, int is_signed)
+{
+ return bt_ctf_field_type_integer_set_is_signed(int_field_type,
+ is_signed ? BT_CTF_TRUE : BT_CTF_FALSE);
+}
+
+extern enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base(
+ struct bt_ctf_field_type *int_field_type);
+
+extern int bt_ctf_field_type_integer_set_base(
+ struct bt_ctf_field_type *int_field_type,
+ enum bt_ctf_integer_base base);
+
+extern enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
+ struct bt_ctf_field_type *int_field_type);
+
+extern int bt_ctf_field_type_integer_set_encoding(
+ struct bt_ctf_field_type *int_field_type,
+ enum bt_ctf_string_encoding encoding);
+
+extern struct bt_ctf_clock_class *bt_ctf_field_type_integer_get_mapped_clock_class(
+ struct bt_ctf_field_type *int_field_type);
+
+extern int bt_ctf_field_type_integer_set_mapped_clock_class(
+ struct bt_ctf_field_type *int_field_type,
+ struct bt_ctf_clock_class *clock_class);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void);
+
+extern int bt_ctf_field_type_floating_point_get_exponent_digits(
+ struct bt_ctf_field_type *float_field_type);
+
+extern int bt_ctf_field_type_floating_point_set_exponent_digits(
+ struct bt_ctf_field_type *float_field_type,
+ unsigned int exponent_size);
+
+extern int bt_ctf_field_type_floating_point_get_mantissa_digits(
+ struct bt_ctf_field_type *float_field_type);
+
+extern int bt_ctf_field_type_floating_point_set_mantissa_digits(
+ struct bt_ctf_field_type *float_field_type,
+ unsigned int mantissa_sign_size);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create(
+ struct bt_ctf_field_type *int_field_type);
+
+extern
+struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_field_type(
+ struct bt_ctf_field_type *enum_field_type);
+
+extern int64_t bt_ctf_field_type_enumeration_get_mapping_count(
+ struct bt_ctf_field_type *enum_field_type);
+
+extern int bt_ctf_field_type_enumeration_signed_get_mapping_by_index(
+ struct bt_ctf_field_type *enum_field_type, uint64_t index,
+ const char **name, int64_t *range_begin, int64_t *range_end);
+
+extern int bt_ctf_field_type_enumeration_unsigned_get_mapping_by_index(
+ struct bt_ctf_field_type *enum_field_type, uint64_t index,
+ const char **name, uint64_t *range_begin,
+ uint64_t *range_end);
+
+extern int bt_ctf_field_type_enumeration_signed_add_mapping(
+ struct bt_ctf_field_type *enum_field_type,
+ const char *name, int64_t range_begin, int64_t range_end);
+
+extern int bt_ctf_field_type_enumeration_unsigned_add_mapping(
+ struct bt_ctf_field_type *enum_field_type,
+ const char *name, uint64_t range_begin, uint64_t range_end);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+int bt_ctf_field_type_enumeration_add_mapping(
+ struct bt_ctf_field_type *enumeration, const char *name,
+ int64_t range_start, int64_t range_end)
+{
+ return bt_ctf_field_type_enumeration_signed_add_mapping(enumeration,
+ name, range_start, range_end);
+}
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_string_create(void);
+
+extern enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
+ struct bt_ctf_field_type *string_field_type);
+
+extern int bt_ctf_field_type_string_set_encoding(
+ struct bt_ctf_field_type *string_field_type,
+ enum bt_ctf_string_encoding encoding);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void);
+
+extern int64_t bt_ctf_field_type_structure_get_field_count(
+ struct bt_ctf_field_type *struct_field_type);
+
+extern int bt_ctf_field_type_structure_get_field_by_index(
+ struct bt_ctf_field_type *struct_field_type,
+ const char **field_name, struct bt_ctf_field_type **field_type,
+ uint64_t index);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+int bt_ctf_field_type_structure_get_field(struct bt_ctf_field_type *structure,
+ const char **field_name, struct bt_ctf_field_type **field_type,
+ int index)
+{
+ return bt_ctf_field_type_structure_get_field_by_index(structure,
+ field_name, field_type, (uint64_t) index);
+}
+
+extern
+struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name(
+ struct bt_ctf_field_type *struct_field_type,
+ const char *field_name);
+
+extern int bt_ctf_field_type_structure_add_field(
+ struct bt_ctf_field_type *struct_field_type,
+ struct bt_ctf_field_type *field_type,
+ const char *field_name);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_array_create(
+ struct bt_ctf_field_type *element_field_type,
+ unsigned int length);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_field_type(
+ struct bt_ctf_field_type *array_field_type);
+
+extern int64_t bt_ctf_field_type_array_get_length(
+ struct bt_ctf_field_type *array_field_type);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_create(
+ struct bt_ctf_field_type *element_field_type,
+ const char *length_name);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_field_type(
+ struct bt_ctf_field_type *sequence_field_type);
+
+extern const char *bt_ctf_field_type_sequence_get_length_field_name(
+ struct bt_ctf_field_type *sequence_field_type);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_variant_create(
+ struct bt_ctf_field_type *tag_field_type,
+ const char *tag_name);
+
+extern struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_field_type(
+ struct bt_ctf_field_type *variant_field_type);
+
+extern const char *bt_ctf_field_type_variant_get_tag_name(
+ struct bt_ctf_field_type *variant_field_type);
+
+extern int bt_ctf_field_type_variant_set_tag_name(
+ struct bt_ctf_field_type *variant_field_type,
+ const char *tag_name);
+
+extern int64_t bt_ctf_field_type_variant_get_field_count(
+ struct bt_ctf_field_type *variant_field_type);
+
+extern int bt_ctf_field_type_variant_get_field_by_index(
+ struct bt_ctf_field_type *variant_field_type,
+ const char **field_name,
+ struct bt_ctf_field_type **field_type, uint64_t index);
+
+extern
+struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name(
+ struct bt_ctf_field_type *variant_field_type,
+ const char *field_name);
+
+extern
+struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag(
+ struct bt_ctf_field_type *variant_field_type,
+ struct bt_ctf_field *tag_field);
+
+extern int bt_ctf_field_type_variant_add_field(
+ struct bt_ctf_field_type *variant_field_type,
+ struct bt_ctf_field_type *field_type,
+ const char *field_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_FIELD_TYPES_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_FIELDS_H
+#define BABELTRACE2_CTF_WRITER_FIELDS_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_field;
+struct bt_ctf_event_class;
+struct bt_ctf_event;
+struct bt_ctf_field_type;
+struct bt_ctf_field_type_enumeration_mapping_iterator;
+
+extern struct bt_ctf_field *bt_ctf_field_create(
+ struct bt_ctf_field_type *field_type);
+
+extern struct bt_ctf_field_type *bt_ctf_field_get_type(
+ struct bt_ctf_field *field);
+
+extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(
+ struct bt_ctf_field *field);
+
+extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field);
+
+extern int bt_ctf_field_integer_signed_get_value(
+ struct bt_ctf_field *integer_field, int64_t *value);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+int bt_ctf_field_signed_integer_set_value(
+ struct bt_ctf_field *integer_field, int64_t *value)
+{
+ return bt_ctf_field_integer_signed_get_value(integer_field, value);
+}
+
+extern int bt_ctf_field_integer_signed_set_value(
+ struct bt_ctf_field *integer_field, int64_t value);
+
+extern int bt_ctf_field_integer_unsigned_get_value(
+ struct bt_ctf_field *integer_field, uint64_t *value);
+
+extern int bt_ctf_field_integer_unsigned_set_value(
+ struct bt_ctf_field *integer_field, uint64_t value);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+int bt_ctf_field_unsigned_integer_set_value(
+ struct bt_ctf_field *integer_field, uint64_t *value)
+{
+ return bt_ctf_field_integer_unsigned_get_value(integer_field, value);
+}
+
+extern int bt_ctf_field_floating_point_get_value(
+ struct bt_ctf_field *float_field, double *value);
+
+extern int bt_ctf_field_floating_point_set_value(
+ struct bt_ctf_field *float_field, double value);
+
+extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container(
+ struct bt_ctf_field *enum_field);
+
+extern const char *bt_ctf_field_string_get_value(
+ struct bt_ctf_field *string_field);
+
+extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field,
+ const char *value);
+
+extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field,
+ const char *value);
+
+extern int bt_ctf_field_string_append_len(
+ struct bt_ctf_field *string_field, const char *value,
+ unsigned int length);
+
+extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
+ struct bt_ctf_field *struct_field, const char *name);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+struct bt_ctf_field *bt_ctf_field_structure_get_field(
+ struct bt_ctf_field *structure, const char *name)
+{
+ return bt_ctf_field_structure_get_field_by_name(structure, name);
+}
+
+extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
+ struct bt_ctf_field *struct_field, uint64_t index);
+
+extern struct bt_ctf_field *bt_ctf_field_array_get_field(
+ struct bt_ctf_field *array_field, uint64_t index);
+
+extern struct bt_ctf_field *bt_ctf_field_sequence_get_field(
+ struct bt_ctf_field *sequence_field, uint64_t index);
+
+extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field,
+ struct bt_ctf_field *length_field);
+
+extern struct bt_ctf_field *bt_ctf_field_variant_get_field(
+ struct bt_ctf_field *variant_field,
+ struct bt_ctf_field *tag_field);
+
+extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field(
+ struct bt_ctf_field *variant_field);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_FIELDS_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_OBJECT_H
+#define BABELTRACE2_CTF_WRITER_OBJECT_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+@defgroup refs Reference counting management
+@ingroup apiref
+@brief Common reference counting management for all Babeltrace objects.
+
+@code
+#include <babeltrace2-ctf-writer/object.h>
+@endcode
+
+The macros and functions of this module are everything that is needed
+to handle the <strong><em>reference counting</em></strong> of
+Babeltrace objects.
+
+Any Babeltrace object can be shared by multiple owners thanks to
+<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
+counting</a>.
+
+The Babeltrace C API complies with the following key principles:
+
+1. When you call an API function which accepts a Babeltrace object
+ pointer as a parameter, the API function <strong>borrows the
+ reference</strong> for the <strong>duration of the function</strong>.
+
+ @image html ref-count-user-calls.png
+
+ The API function can also get a new reference if the system needs a
+ more persistent reference, but the ownership is <strong>never
+ transferred</strong> from the caller to the API function.
+
+ In other words, the caller still owns the object after calling any
+ API function: no function "steals" the user's reference (except
+ bt_ctf_object_put_ref()).
+
+2. An API function which \em returns a Babeltrace object pointer to the
+ user returns a <strong>new reference</strong>. The caller becomes an
+ owner of the object.
+
+ @image html ref-count-api-returns.png
+
+ It is your responsibility to discard the object when you don't
+ need it anymore with bt_ctf_object_put_ref().
+
+ For example, see bt_ctf_value_array_get().
+
+3. A Babeltrace object pointer received as a parameter in a user
+ function called back from an API function is a
+ <strong>borrowed</strong>, or <strong>weak reference</strong>: if you
+ need a reference which is more persistent than the duration of the
+ user function, call bt_ctf_object_get_ref() on the pointer.
+
+ @image html ref-count-callback.png
+
+ For example, see bt_ctf_value_map_foreach_entry().
+
+The two macros BT_CTF_OBJECT_PUT_REF_AND_RESET() and BT_CTF_OBJECT_MOVE_REF() operate on \em variables rather
+than pointer values. You should use BT_CTF_OBJECT_PUT_REF_AND_RESET() instead of bt_ctf_object_put_ref() when
+possible to avoid "double puts". For the same reason, you should use use
+BT_CTF_OBJECT_MOVE_REF() instead of performing manual reference moves between
+variables.
+
+@file
+@brief Reference counting management macros and functions.
+@sa refs
+
+@addtogroup refs
+@{
+*/
+
+/**
+@brief Calls bt_ctf_object_put_ref() on a variable named \p _var, then
+ sets \p _var to \c NULL.
+
+Using this macro is considered safer than calling bt_ctf_object_put_ref() because it
+makes sure that the variable which used to contain a reference to a
+Babeltrace object is set to \c NULL so that a future BT_CTF_OBJECT_PUT_REF_AND_RESET() or
+bt_ctf_object_put_ref() call will not cause another, unwanted reference decrementation.
+
+@param[in,out] _var Name of a variable containing a
+ Babeltrace object's address (this address
+ can be \c NULL).
+
+@post <strong>If \p _var does not contain \p NULL</strong>,
+ its reference count is decremented.
+@post \p _var contains \c NULL.
+
+@sa BT_CTF_OBJECT_MOVE_REF(): Transfers the ownership of a Babeltrace object from a
+ variable to another.
+*/
+#define BT_CTF_OBJECT_PUT_REF_AND_RESET(_var) \
+ do { \
+ bt_ctf_object_put_ref(_var); \
+ (_var) = NULL; \
+ } while (0)
+
+/**
+@brief Transfers the ownership of a Babeltrace object from a variable
+ named \p _var_src to a variable named \p _var_dst.
+
+This macro implements the following common pattern:
+
+ 1. Call bt_ctf_object_put_ref() on \p _var_dst to make sure the previous reference
+ held by \p _var_dst is discarded.
+ 2. Assign \p _var_src to \p _var_dst.
+ 3. Set \p _var_src to \c NULL to avoid future, unwanted reference
+ decrementation of \p _var_src.
+
+@warning
+You must \em not use this macro when both \p _var_dst and
+\p _var_src contain the same Babeltrace object address and the reference
+count of this object is 1. The initial call to bt_ctf_object_put_ref() on \p _var_dst
+would destroy the object and leave a dangling pointer in \p _var_dst.
+
+@param[in,out] _var_dst Name of the destination variable, containing
+ either the address of a Babeltrace object to
+ put first, or \c NULL.
+@param[in,out] _var_src Name of the source variable, containing
+ either the address of a Babeltrace object to
+ move, or \c NULL.
+
+@pre <strong>If \p _var_dst and \p _var_src contain the same
+ value which is not \c NULL</strong>, this object's reference
+ count is greater than 1.
+@post <strong>If \c _var_dst is not \c NULL</strong>, its reference
+ count is decremented.
+@post \p _var_dst is equal to the value of \p _var_src \em before
+ you called this macro.
+@post \p _var_src is \c NULL.
+
+@sa BT_CTF_OBJECT_PUT_REF_AND_RESET(): Calls bt_ctf_object_put_ref() on a variable, then sets it to \c NULL.
+*/
+#define BT_CTF_OBJECT_MOVE_REF(_var_dst, _var_src) \
+ do { \
+ bt_ctf_object_put_ref(_var_dst); \
+ (_var_dst) = (_var_src); \
+ (_var_src) = NULL; \
+ } while (0)
+
+/**
+@brief Increments the reference count of the Babeltrace object \p obj.
+
+@param[in] obj Babeltrace object of which to get a new reference
+ (can be \c NULL).
+@returns \p obj
+
+@post <strong>If \c obj is not \c NULL</strong>, its reference
+ count is incremented.
+
+@sa bt_ctf_object_put_ref(): Decrements the reference count of a Babeltrace object.
+*/
+void *bt_ctf_object_get_ref(void *obj);
+
+/**
+@brief Decrements the reference count of the Babeltrace object
+ \p obj.
+
+When the object's reference count reaches 0, the object can no longer
+be accessed and is considered \em destroyed.
+
+@remarks
+You should use the BT_CTF_OBJECT_PUT_REF_AND_RESET() macro instead of calling bt_ctf_object_put_ref() since the
+former is generally safer.
+
+@param[in] obj Babeltrace object of which to drop a reference
+ (can be \c NULL).
+
+@post <strong>If \c obj is not \c NULL</strong>, its reference
+ count is decremented.
+
+@sa BT_CTF_OBJECT_PUT_REF_AND_RESET(): Calls bt_ctf_object_put_ref() on a variable, then sets it to \c NULL.
+@sa BT_CTF_OBJECT_MOVE_REF(): Transfers the ownership of a Babeltrace object from a
+ variable to another.
+@sa bt_ctf_object_get_ref(): Increments the reference count of a Babeltrace object.
+*/
+void bt_ctf_object_put_ref(void *obj);
+
+/**
+@}
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_OBJECT_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_STREAM_CLASS_H
+#define BABELTRACE2_CTF_WRITER_STREAM_CLASS_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace2-ctf-writer/object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_stream_class;
+struct bt_ctf_trace;
+struct bt_ctf_event_class;
+struct bt_ctf_field_type;
+struct bt_ctf_clock;
+
+extern struct bt_ctf_stream_class *bt_ctf_stream_class_create(
+ const char *name);
+
+extern struct bt_ctf_trace *bt_ctf_stream_class_get_trace(
+ struct bt_ctf_stream_class *stream_class);
+
+extern const char *bt_ctf_stream_class_get_name(
+ struct bt_ctf_stream_class *stream_class);
+
+extern int bt_ctf_stream_class_set_name(
+ struct bt_ctf_stream_class *stream_class, const char *name);
+
+extern int64_t bt_ctf_stream_class_get_id(
+ struct bt_ctf_stream_class *stream_class);
+
+extern int bt_ctf_stream_class_set_id(
+ struct bt_ctf_stream_class *stream_class, uint64_t id);
+
+extern struct bt_ctf_field_type *bt_ctf_stream_class_get_packet_context_type(
+ struct bt_ctf_stream_class *stream_class);
+
+extern int bt_ctf_stream_class_set_packet_context_type(
+ struct bt_ctf_stream_class *stream_class,
+ struct bt_ctf_field_type *packet_context_type);
+
+extern struct bt_ctf_field_type *
+bt_ctf_stream_class_get_event_header_type(
+ struct bt_ctf_stream_class *stream_class);
+
+extern int bt_ctf_stream_class_set_event_header_type(
+ struct bt_ctf_stream_class *stream_class,
+ struct bt_ctf_field_type *event_header_type);
+
+extern struct bt_ctf_field_type *
+bt_ctf_stream_class_get_event_context_type(
+ struct bt_ctf_stream_class *stream_class);
+
+extern int bt_ctf_stream_class_set_event_context_type(
+ struct bt_ctf_stream_class *stream_class,
+ struct bt_ctf_field_type *event_context_type);
+
+extern int64_t bt_ctf_stream_class_get_event_class_count(
+ struct bt_ctf_stream_class *stream_class);
+
+extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index(
+ struct bt_ctf_stream_class *stream_class, uint64_t index);
+
+extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id(
+ struct bt_ctf_stream_class *stream_class, uint64_t id);
+
+extern int bt_ctf_stream_class_add_event_class(
+ struct bt_ctf_stream_class *stream_class,
+ struct bt_ctf_event_class *event_class);
+
+extern int bt_ctf_stream_class_set_clock(
+ struct bt_ctf_stream_class *ctf_stream_class,
+ struct bt_ctf_clock *clock);
+
+extern struct bt_ctf_clock *bt_ctf_stream_class_get_clock(
+ struct bt_ctf_stream_class *stream_class);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_stream_class_get(struct bt_ctf_stream_class *stream_class)
+{
+ bt_ctf_object_get_ref(stream_class);
+}
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_stream_class_put(struct bt_ctf_stream_class *stream_class)
+{
+ bt_ctf_object_put_ref(stream_class);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_STREAM_CLASS_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_STREAM_H
+#define BABELTRACE2_CTF_WRITER_STREAM_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_stream;
+struct bt_ctf_event;
+
+/*
+ * bt_ctf_stream_get_discarded_events_count: get the number of discarded
+ * events associated with this stream.
+ *
+ * Note that discarded events are not stored if the stream's packet
+ * context has no "events_discarded" field. An error will be returned
+ * in that case.
+ *
+ * @param stream Stream instance.
+ *
+ * Returns the number of discarded events, a negative value on error.
+ */
+extern int bt_ctf_stream_get_discarded_events_count(
+ struct bt_ctf_stream *stream, uint64_t *count);
+
+/*
+ * bt_ctf_stream_append_discarded_events: increment discarded events count.
+ *
+ * Increase the current packet's discarded event count. Has no effect if the
+ * stream class' packet context has no "events_discarded" field.
+ *
+ * @param stream Stream instance.
+ * @param event_count Number of discarded events to add to the stream's current
+ * packet.
+ */
+extern void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream,
+ uint64_t event_count);
+
+/*
+ * bt_ctf_stream_append_event: append an event to the stream.
+ *
+ * Append "event" to the stream's current packet. The stream's associated clock
+ * will be sampled during this call. The event shall not be modified after
+ * being appended to a stream. The stream will share the event's ownership by
+ * incrementing its reference count. The current packet is not flushed to disk
+ * until the next call to bt_ctf_stream_flush.
+ *
+ * The stream event context will be sampled for every appended event if
+ * a stream event context was defined.
+ *
+ * @param stream Stream instance.
+ * @param event Event instance to append to the stream's current packet.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_stream_append_event(struct bt_ctf_stream *stream,
+ struct bt_ctf_event *event);
+
+/*
+ * bt_ctf_stream_get_packet_header: get a stream's packet header.
+ *
+ * @param stream Stream instance.
+ *
+ * Returns a field instance on success, NULL on error.
+ */
+extern struct bt_ctf_field *bt_ctf_stream_get_packet_header(
+ struct bt_ctf_stream *stream);
+
+/*
+ * bt_ctf_stream_set_packet_header: set a stream's packet header.
+ *
+ * The packet header's type must match the trace's packet header
+ * type.
+ *
+ * @param stream Stream instance.
+ * @param packet_header Packet header instance.
+ *
+ * Returns a field instance on success, NULL on error.
+ */
+extern int bt_ctf_stream_set_packet_header(
+ struct bt_ctf_stream *stream,
+ struct bt_ctf_field *packet_header);
+
+/*
+ * bt_ctf_stream_get_packet_context: get a stream's packet context.
+ *
+ * @param stream Stream instance.
+ *
+ * Returns a field instance on success, NULL on error.
+ */
+extern struct bt_ctf_field *bt_ctf_stream_get_packet_context(
+ struct bt_ctf_stream *stream);
+
+/*
+ * bt_ctf_stream_set_packet_context: set a stream's packet context.
+ *
+ * The packet context's type must match the stream class' packet
+ * context type.
+ *
+ * @param stream Stream instance.
+ * @param packet_context Packet context field instance.
+ *
+ * Returns a field instance on success, NULL on error.
+ */
+extern int bt_ctf_stream_set_packet_context(
+ struct bt_ctf_stream *stream,
+ struct bt_ctf_field *packet_context);
+
+/*
+ * bt_ctf_stream_flush: flush a stream.
+ *
+ * The stream's current packet's events will be flushed, thus closing the
+ * current packet. Events subsequently appended to the stream will be
+ * added to a new packet.
+ *
+ * Flushing will also set the packet context's default attributes if
+ * they remained unset while populating the current packet. These default
+ * attributes, along with their expected types, are detailed in stream-class.h.
+ *
+ * @param stream Stream instance.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_stream_flush(struct bt_ctf_stream *stream);
+
+extern int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream);
+
+extern
+struct bt_ctf_stream *bt_ctf_stream_create(
+ struct bt_ctf_stream_class *stream_class,
+ const char *name, uint64_t id);
+
+extern struct bt_ctf_stream_class *bt_ctf_stream_get_class(
+ struct bt_ctf_stream *stream);
+
+extern const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream);
+
+extern int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream);
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_stream_get(struct bt_ctf_stream *stream)
+{
+ bt_ctf_object_get_ref(stream);
+}
+
+/* Pre-2.0 CTF writer compatibility */
+static inline
+void bt_ctf_stream_put(struct bt_ctf_stream *stream)
+{
+ bt_ctf_object_put_ref(stream);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_STREAM_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_TRACE_H
+#define BABELTRACE2_CTF_WRITER_TRACE_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_trace;
+struct bt_ctf_stream_class;
+struct bt_ctf_stream;
+
+extern enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order(
+ struct bt_ctf_trace *trace);
+
+extern int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace,
+ enum bt_ctf_byte_order native_byte_order);
+
+extern const uint8_t *bt_ctf_trace_get_uuid(
+ struct bt_ctf_trace *trace);
+
+extern int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace,
+ const uint8_t *uuid);
+
+extern int bt_ctf_trace_set_environment_field_integer(
+ struct bt_ctf_trace *trace, const char *name,
+ int64_t value);
+
+extern int bt_ctf_trace_set_environment_field_string(
+ struct bt_ctf_trace *trace, const char *name,
+ const char *value);
+
+extern struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_field_type(
+ struct bt_ctf_trace *trace);
+
+extern int bt_ctf_trace_set_packet_header_field_type(struct bt_ctf_trace *trace,
+ struct bt_ctf_field_type *packet_header_type);
+
+extern int64_t bt_ctf_trace_get_stream_class_count(
+ struct bt_ctf_trace *trace);
+
+extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
+ struct bt_ctf_trace *trace, uint64_t index);
+
+extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
+ struct bt_ctf_trace *trace, uint64_t id);
+
+extern int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
+ struct bt_ctf_stream_class *stream_class);
+
+extern int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace);
+
+extern struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
+ struct bt_ctf_trace *trace, uint64_t index);
+
+extern const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_TRACE_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_TYPES_H
+#define BABELTRACE2_CTF_WRITER_TYPES_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// False boolean value for the #bt_ctf_bool type.
+#define BT_CTF_FALSE 0
+
+/// True boolean value for the #bt_ctf_bool type.
+#define BT_CTF_TRUE 1
+
+typedef int bt_ctf_bool;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_TYPES_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_UTILS_H
+#define BABELTRACE2_CTF_WRITER_UTILS_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_ctf_bool */
+#include <babeltrace2-ctf-writer/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern bt_ctf_bool bt_ctf_identifier_is_valid(const char *identifier);
+
+static inline
+int bt_ctf_validate_identifier(const char *identifier)
+{
+ return bt_ctf_identifier_is_valid(identifier) ? 1 : 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_UTILS_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_VISITOR_H
+#define BABELTRACE2_CTF_WRITER_VISITOR_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+@defgroup ctfirvisitor CTF IR visitor
+@ingroup ctfir
+@brief CTF IR visitor.
+
+@code
+#include <babeltrace2/trace-ir/visitor.h>
+@endcode
+
+A CTF IR <strong><em>visitor</em></strong> is a function that you
+can use to visit the hierarchy of a
+\link ctfirtraceclass CTF IR trace class\endlink with
+bt_ctf_trace_visit() or of a
+\link ctfirstreamclass CTF IR stream class\endlink with
+bt_ctf_stream_class_visit().
+
+The traversal of the object's hierarchy is always done in a
+pre-order fashion.
+
+@sa ctfirstreamclass
+@sa ctfirtraceclass
+
+@file
+@brief CTF IR visitor types and functions.
+@sa ctfirvisitor
+
+@addtogroup ctfirvisitor
+@{
+*/
+
+/**
+@struct bt_ctf_object
+@brief A CTF IR object wrapper.
+
+This structure wraps both a CTF IR object and its type
+(see #bt_ctf_object_type). It is used in the visiting function.
+
+You can use the bt_ctf_object_get_type() and
+bt_ctf_object_get_object() accessors to get the type and wrapped
+CTF IR object of a CTF IR object wrapper.
+
+A CTF IR object wrapper has <strong>no reference count</strong>: do \em
+not use bt_ctf_object_put_ref() or bt_ctf_object_get_ref() on it.
+
+@sa ctfirvisitor
+*/
+struct bt_ctf_visitor_object;
+
+/**
+@brief CTF IR object wrapper type.
+*/
+enum bt_ctf_visitor_object_type {
+ /// Unknown (used for errors).
+ BT_CTF_VISITOR_OBJECT_TYPE_UNKNOWN = -1,
+
+ /// \ref ctfirtraceclass.
+ BT_CTF_VISITOR_OBJECT_TYPE_TRACE = 0,
+
+ /// \ref ctfirstreamclass.
+ BT_CTF_VISITOR_OBJECT_TYPE_STREAM_CLASS = 1,
+
+ /// \ref ctfirstream.
+ BT_CTF_VISITOR_OBJECT_TYPE_STREAM = 2,
+
+ /// \ref ctfireventclass.
+ BT_CTF_VISITOR_OBJECT_TYPE_EVENT_CLASS = 3,
+
+ /// \ref ctfirevent.
+ BT_CTF_VISITOR_OBJECT_TYPE_EVENT = 4,
+
+ /// Number of entries in this enumeration.
+ BT_CTF_VISITOR_OBJECT_TYPE_NR,
+};
+
+/**
+@brief Visting function type.
+
+A function of this type is called by bt_ctf_trace_visit() or
+bt_ctf_stream_class_visit() when visiting the CTF IR object wrapper
+\p object.
+
+\p object has <strong>no reference count</strong>: do \em not use
+bt_ctf_object_put_ref() or bt_ctf_object_get_ref() on it.
+
+@param[in] object Currently visited CTF IR object wrapper.
+@param[in] data User data.
+@returns 0 on success, or a negative value on error.
+
+@prenotnull{object}
+
+@sa bt_ctf_trace_visit(): Accepts a visitor to visit a trace class.
+@sa bt_ctf_stream_class_visit(): Accepts a visitor to visit a stream
+ class.
+*/
+typedef int (*bt_ctf_visitor)(struct bt_ctf_visitor_object *object,
+ void *data);
+
+/**
+@brief Returns the type of the CTF IR object wrapped by the CTF IR
+ object wrapper \p object.
+
+@param[in] object Object wrapper of which to get the type.
+@returns Type of \p object.
+
+@prenotnull{object}
+
+@sa bt_ctf_visitor_object_get_object(): Returns the object wrapped by a given
+ CTF IR object wrapper.
+*/
+enum bt_ctf_visitor_object_type bt_ctf_visitor_object_get_type(
+ struct bt_ctf_visitor_object *object);
+
+/**
+@brief Returns the CTF IR object wrapped by the CTF IR object
+ wrapper \p object.
+
+The reference count of \p object is \em not incremented by this
+function. On success, you must call bt_ctf_object_get_ref() on the return value to
+have your own reference.
+
+@param[in] object Object wrapper of which to get the wrapped
+ CTF IR object.
+@returns CTF IR object wrapped by \p object.
+
+@prenotnull{object}
+@post The reference count of the returned object is not modified.
+
+@sa bt_ctf_visitor_object_get_type(): Returns the type of a given
+ CTF IR object wrapper.
+*/
+void *bt_ctf_visitor_object_get_object(struct bt_ctf_visitor_object *object);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_VISITOR_H */
--- /dev/null
+#ifndef BABELTRACE2_CTF_WRITER_WRITER_H
+#define BABELTRACE2_CTF_WRITER_WRITER_H
+
+/*
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/trace.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_ctf_writer;
+struct bt_ctf_stream;
+struct bt_ctf_stream_class;
+struct bt_ctf_clock;
+
+/*
+ * bt_ctf_writer_create: create a writer instance.
+ *
+ * Allocate a new writer that will produce a trace in the given path.
+ * The creation of a writer sets its reference count to 1.
+ *
+ * @param path Path to the trace's containing folder (string is copied).
+ *
+ * Returns an allocated writer on success, NULL on error.
+ */
+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.
+ *
+ * Allocate a new stream instance and register it to the writer. The creation of
+ * a stream sets its reference count to 1.
+ *
+ * @param writer Writer instance.
+ * @param stream_class Stream class to instantiate.
+ *
+ * Returns an allocated stream on success, NULL on error.
+ */
+extern struct bt_ctf_stream *bt_ctf_writer_create_stream(
+ struct bt_ctf_writer *writer,
+ struct bt_ctf_stream_class *stream_class);
+
+/*
+ * bt_ctf_writer_add_environment_field: 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 (will be copied).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+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.
+ *
+ * Add a clock to the trace. Clocks assigned to stream classes must be
+ * registered to the writer.
+ *
+ * @param writer Writer instance.
+ * @param clock Clock to add to the trace.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_writer_add_clock(struct bt_ctf_writer *writer,
+ struct bt_ctf_clock *clock);
+
+/*
+ * bt_ctf_writer_get_metadata_string: get meta-data string.
+ *
+ * Get the trace's TSDL meta-data. The caller assumes the ownership of the
+ * returned string.
+ *
+ * @param writer Writer instance.
+ *
+ * Returns the metadata string on success, NULL on error.
+ */
+extern char *bt_ctf_writer_get_metadata_string(struct bt_ctf_writer *writer);
+
+/*
+ * bt_ctf_writer_flush_metadata: flush the trace's metadata to disk.
+ *
+ * Flush the trace's metadata to the metadata file. Note that the metadata will
+ * be flushed automatically when the Writer instance is released (last call to
+ * bt_ctf_writer_put).
+ *
+ * @param writer Writer instance.
+ */
+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 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);
+
+/*
+ * 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
+ * destroy a writer.
+ *
+ * When the writer's reference count is decremented to 0 by a
+ * bt_ctf_writer_put, the writer is freed.
+ *
+ * @param writer Writer instance.
+ */
+
+/* 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
+}
+#endif
+
+#endif /* BABELTRACE2_CTF_WRITER_WRITER_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_CLOCK_CLASS_H
-#define BABELTRACE2_CTF_WRITER_CLOCK_CLASS_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_clock_class;
-
-extern struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name,
- uint64_t freq);
-
-extern const char *bt_ctf_clock_class_get_name(
- struct bt_ctf_clock_class *clock_class);
-
-extern int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class,
- const char *name);
-
-extern const char *bt_ctf_clock_class_get_description(
- struct bt_ctf_clock_class *clock_class);
-
-extern int bt_ctf_clock_class_set_description(
- struct bt_ctf_clock_class *clock_class,
- const char *desc);
-
-extern uint64_t bt_ctf_clock_class_get_frequency(
- struct bt_ctf_clock_class *clock_class);
-
-extern int bt_ctf_clock_class_set_frequency(
- struct bt_ctf_clock_class *clock_class, uint64_t freq);
-
-extern uint64_t bt_ctf_clock_class_get_precision(
- struct bt_ctf_clock_class *clock_class);
-
-extern int bt_ctf_clock_class_set_precision(
- struct bt_ctf_clock_class *clock_class, uint64_t precision);
-
-extern int bt_ctf_clock_class_get_offset_s(
- struct bt_ctf_clock_class *clock_class, int64_t *seconds);
-
-extern int bt_ctf_clock_class_set_offset_s(
- struct bt_ctf_clock_class *clock_class, int64_t seconds);
-
-extern int bt_ctf_clock_class_get_offset_cycles(
- struct bt_ctf_clock_class *clock_class, int64_t *cycles);
-
-extern int bt_ctf_clock_class_set_offset_cycles(
- struct bt_ctf_clock_class *clock_class, int64_t cycles);
-
-extern bt_ctf_bool bt_ctf_clock_class_is_absolute(
- struct bt_ctf_clock_class *clock_class);
-
-extern int bt_ctf_clock_class_set_is_absolute(
- struct bt_ctf_clock_class *clock_class, bt_ctf_bool is_absolute);
-
-extern const uint8_t *bt_ctf_clock_class_get_uuid(
- struct bt_ctf_clock_class *clock_class);
-
-extern int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class,
- const uint8_t *uuid);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_CLOCK_CLASS_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_CLOCK_H
-#define BABELTRACE2_CTF_WRITER_CLOCK_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_clock;
-struct bt_ctf_clock_class;
-
-/*
- * bt_ctf_clock_create: create a clock.
- *
- * Allocate a new clock setting its reference count to 1.
- *
- * @param name Name of the clock (will be copied); can be set to NULL
- * for nameless clocks.
- *
- * Returns an allocated clock on success, NULL on error.
- */
-extern struct bt_ctf_clock *bt_ctf_clock_create(const char *name);
-
-/*
- * bt_ctf_clock_get_name: get a clock's name.
- *
- * Get the clock's name.
- *
- * @param clock Clock instance.
- *
- * Returns the clock's name, NULL on error.
- */
-extern const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock);
-
-/*
- * bt_ctf_clock_get_description: get a clock's description.
- *
- * Get the clock's description.
- *
- * @param clock Clock instance.
- *
- * Returns the clock's description, NULL if unset.
- */
-extern const char *bt_ctf_clock_get_description(struct bt_ctf_clock *clock);
-
-/*
- * bt_ctf_clock_set_description: set a clock's description.
- *
- * Set the clock's description. The description appears in the clock's TSDL
- * meta-data.
- *
- * @param clock Clock instance.
- * @param desc Description of the clock.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_description(struct bt_ctf_clock *clock,
- const char *desc);
-
-/*
- * bt_ctf_clock_get_frequency: get a clock's frequency.
- *
- * Get the clock's frequency (Hz).
- *
- * @param clock Clock instance.
- *
- * Returns the clock's frequency, -1ULL on error.
- */
-extern uint64_t bt_ctf_clock_get_frequency(struct bt_ctf_clock *clock);
-
-/*
- * bt_ctf_clock_set_frequency: set a clock's frequency.
- *
- * Set the clock's frequency (Hz).
- *
- * @param clock Clock instance.
- * @param freq Clock's frequency in Hz, defaults to 1 000 000 000 Hz (1ns).
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_frequency(struct bt_ctf_clock *clock,
- uint64_t freq);
-
-/*
- * bt_ctf_clock_get_precision: get a clock's precision.
- *
- * Get the clock's precision (in clock ticks).
- *
- * @param clock Clock instance.
- *
- * Returns the clock's precision, -1ULL on error.
- */
-extern uint64_t bt_ctf_clock_get_precision(struct bt_ctf_clock *clock);
-
-/*
- * bt_ctf_clock_set_precision: set a clock's precision.
- *
- * Set the clock's precision.
- *
- * @param clock Clock instance.
- * @param precision Clock's precision in clock ticks, defaults to 1.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_precision(struct bt_ctf_clock *clock,
- uint64_t precision);
-
-/*
- * bt_ctf_clock_get_offset_s: get a clock's offset in seconds.
- *
- * Get the clock's offset in seconds from POSIX.1 Epoch, 1970-01-01.
- *
- * @param clock Clock instance.
- * @param offset_s Pointer to clock offset in seconds (output).
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock,
- int64_t *offset_s);
-
-/*
- * bt_ctf_clock_set_offset_s: set a clock's offset in seconds.
- *
- * Set the clock's offset in seconds from POSIX.1 Epoch, 1970-01-01,
- * defaults to 0.
- *
- * @param clock Clock instance.
- * @param offset_s Clock's offset in seconds, defaults to 0.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_offset_s(struct bt_ctf_clock *clock,
- int64_t offset_s);
-
-/*
- * bt_ctf_clock_get_offset: get a clock's offset in ticks.
- *
- * Get the clock's offset in ticks from Epoch + offset_t.
- *
- * @param clock Clock instance.
- * @param offset Clock offset in ticks from Epoch + offset_s (output).
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_get_offset(struct bt_ctf_clock *clock,
- int64_t *offset);
-
-/*
- * bt_ctf_clock_set_offset: set a clock's offset in ticks.
- *
- * Set the clock's offset in ticks from Epoch + offset_s.
- *
- * @param clock Clock instance.
- * @param offset Clock's offset in ticks from Epoch + offset_s, defaults to 0.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_offset(struct bt_ctf_clock *clock,
- int64_t offset);
-
-/*
- * bt_ctf_clock_get_is_absolute: get a clock's absolute attribute.
- *
- * Get the clock's absolute attribute. A clock is absolute if the clock is a
- * global reference across the trace's other clocks.
- *
- * @param clock Clock instance.
- *
- * Returns the clock's absolute attribute, a negative value on error.
- */
-extern int bt_ctf_clock_get_is_absolute(struct bt_ctf_clock *clock);
-
-/*
- * bt_ctf_clock_set_is_absolute: set a clock's absolute attribute.
- *
- * Set the clock's absolute attribute. A clock is absolute if the clock is a
- * global reference across the trace's other clocks.
- *
- * @param clock Clock instance.
- * @param is_absolute Clock's absolute attribute, defaults to FALSE.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_is_absolute(struct bt_ctf_clock *clock,
- int is_absolute);
-
-/*
- * bt_ctf_clock_get_uuid: get a clock's UUID.
- *
- * Get the clock's UUID.
- *
- * @param clock Clock instance.
- *
- * Returns a pointer to the clock's UUID (16 byte array) on success,
- * NULL on error.
- */
-extern const uint8_t *bt_ctf_clock_get_uuid(struct bt_ctf_clock *clock);
-
-/*
- * bt_ctf_clock_set_uuid: set a clock's UUID.
- *
- * Set a clock's UUID.
- *
- * @param clock Clock instance.
- * @param uuid A 16-byte array containing a UUID.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_uuid(struct bt_ctf_clock *clock,
- const uint8_t *uuid);
-
-/*
- * bt_ctf_clock_set_time: set a clock's current time value.
- *
- * Set the current time in nanoseconds since the clock's origin (offset and
- * offset_s attributes). Defaults to 0.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_clock_set_time(struct bt_ctf_clock *clock,
- int64_t time);
-
-/*
- * bt_ctf_clock_get and bt_ctf_clock_put: increment and decrement the
- * refcount of the clock
- *
- * You may also use bt_ctf_get() and bt_ctf_put() with clock objects.
- *
- * These functions ensure that the clock won't be destroyed when it
- * is in use. The same number of get and put (plus one extra put to
- * release the initial reference done at creation) has to be done to
- * destroy a clock.
- *
- * When the clock refcount is decremented to 0 by a bt_ctf_clock_put,
- * the clock is freed.
- *
- * @param clock Clock instance.
- */
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_clock_get(struct bt_ctf_clock *clock)
-{
- bt_ctf_object_get_ref(clock);
-}
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_clock_put(struct bt_ctf_clock *clock)
-{
- bt_ctf_object_put_ref(clock);
-}
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_CLOCK_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H
-#define BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/fields.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * bt_ctf_field_get and bt_ctf_field_put: increment and decrement the
- * field's reference count.
- *
- * You may also use bt_ctf_object_get_ref() and bt_ctf_object_put_ref() with field objects.
- *
- * These functions ensure that the field won't be destroyed when 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.
- *
- * When the field's reference count is decremented to 0 by a bt_ctf_field_put,
- * the field is freed.
- *
- * @param field Field instance.
- */
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_field_get(struct bt_ctf_field *field)
-{
- bt_ctf_object_get_ref(field);
-}
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_field_put(struct bt_ctf_field *field)
-{
- bt_ctf_object_put_ref(field);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_EVENT_FIELDS_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_EVENT_TYPES_H
-#define BABELTRACE2_CTF_WRITER_EVENT_TYPES_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-
-#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 /* BABELTRACE2_CTF_WRITER_EVENT_TYPES_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_EVENT_H
-#define BABELTRACE2_CTF_WRITER_EVENT_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace2/ctf-writer/object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_event;
-struct bt_ctf_event_class;
-struct bt_ctf_stream;
-struct bt_ctf_field;
-struct bt_ctf_field_type;
-
-enum bt_ctf_event_class_log_level {
- /// Unknown, used for errors.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1,
-
- /// Unspecified log level.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255,
-
- /// System is unusable.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0,
-
- /// Action must be taken immediately.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1,
-
- /// Critical conditions.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2,
-
- /// Error conditions.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3,
-
- /// Warning conditions.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4,
-
- /// Normal, but significant, condition.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5,
-
- /// Informational message.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6,
-
- /// Debug information with system-level scope (set of programs).
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7,
-
- /// Debug information with program-level scope (set of processes).
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8,
-
- /// Debug information with process-level scope (set of modules).
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9,
-
- /// Debug information with module (executable/library) scope (set of units).
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10,
-
- /// Debug information with compilation unit scope (set of functions).
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11,
-
- /// Debug information with function-level scope.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12,
-
- /// Debug information with line-level scope (default log level).
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13,
-
- /// Debug-level message.
- BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14,
-};
-
-extern struct bt_ctf_event *bt_ctf_event_create(
- struct bt_ctf_event_class *event_class);
-
-extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event,
- const char *name);
-
-extern int bt_ctf_event_set_payload(struct bt_ctf_event *event,
- const char *name, struct bt_ctf_field *field);
-
-extern struct bt_ctf_field *bt_ctf_event_get_payload_field(
- struct bt_ctf_event *event);
-
-extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
- struct bt_ctf_field *field);
-
-extern int bt_ctf_event_set_context(struct bt_ctf_event *event,
- struct bt_ctf_field *field);
-
-extern struct bt_ctf_field *bt_ctf_event_get_context(
- struct bt_ctf_event *event);
-
-extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event,
- struct bt_ctf_field *field);
-
-extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context(
- struct bt_ctf_event *event);
-
-extern int bt_ctf_event_set_header(struct bt_ctf_event *event,
- struct bt_ctf_field *field);
-
-extern struct bt_ctf_field *bt_ctf_event_get_header(
- struct bt_ctf_event *event);
-
-extern struct bt_ctf_stream *bt_ctf_event_get_stream(
- struct bt_ctf_event *event);
-
-extern struct bt_ctf_event_class *bt_ctf_event_get_class(
- struct bt_ctf_event *event);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_event_get(struct bt_ctf_event *event)
-{
- bt_ctf_object_get_ref(event);
-}
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_event_put(struct bt_ctf_event *event)
-{
- bt_ctf_object_put_ref(event);
-}
-
-extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name);
-
-extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
- struct bt_ctf_event_class *event_class);
-
-extern const char *bt_ctf_event_class_get_name(
- struct bt_ctf_event_class *event_class);
-
-extern int64_t bt_ctf_event_class_get_id(
- struct bt_ctf_event_class *event_class);
-
-extern int bt_ctf_event_class_set_id(
- struct bt_ctf_event_class *event_class, uint64_t id);
-
-extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
- struct bt_ctf_event_class *event_class);
-
-extern int bt_ctf_event_class_set_log_level(
- struct bt_ctf_event_class *event_class,
- enum bt_ctf_event_class_log_level log_level);
-
-extern const char *bt_ctf_event_class_get_emf_uri(
- struct bt_ctf_event_class *event_class);
-
-extern int bt_ctf_event_class_set_emf_uri(
- struct bt_ctf_event_class *event_class,
- const char *emf_uri);
-
-extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type(
- struct bt_ctf_event_class *event_class);
-
-extern int bt_ctf_event_class_set_context_field_type(
- struct bt_ctf_event_class *event_class,
- struct bt_ctf_field_type *context_type);
-
-extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type(
- struct bt_ctf_event_class *event_class);
-
-extern int bt_ctf_event_class_set_payload_field_type(
- struct bt_ctf_event_class *event_class,
- struct bt_ctf_field_type *payload_type);
-
-extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class,
- struct bt_ctf_field_type *field_type,
- const char *name);
-
-extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
- struct bt_ctf_event_class *event_class, const char *name);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class)
-{
- bt_ctf_object_get_ref(event_class);
-}
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class)
-{
- bt_ctf_object_put_ref(event_class);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_EVENT_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_FIELD_TYPES_H
-#define BABELTRACE2_CTF_WRITER_FIELD_TYPES_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <babeltrace2/ctf-writer/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_field;
-struct bt_ctf_field_type;
-
-enum bt_ctf_scope {
- /// Unknown, used for errors.
- BT_CTF_SCOPE_UNKNOWN = -1,
-
- /// Trace packet header.
- BT_CTF_SCOPE_TRACE_PACKET_HEADER = 1,
-
- /// Stream packet context.
- BT_CTF_SCOPE_STREAM_PACKET_CONTEXT = 2,
-
- /// Stream event header.
- BT_CTF_SCOPE_STREAM_EVENT_HEADER = 3,
-
- /// Stream event context.
- BT_CTF_SCOPE_STREAM_EVENT_CONTEXT = 4,
-
- /// Event context.
- BT_CTF_SCOPE_EVENT_CONTEXT = 5,
-
- /// Event payload.
- BT_CTF_SCOPE_EVENT_PAYLOAD = 6,
-
- /// @cond DOCUMENT
- BT_CTF_SCOPE_ENV = 0,
- BT_CTF_SCOPE_EVENT_FIELDS = 6,
- /// @endcond
-};
-
-enum bt_ctf_field_type_id {
- BT_CTF_FIELD_TYPE_ID_UNKNOWN = -1,
- BT_CTF_FIELD_TYPE_ID_INTEGER = 0,
- BT_CTF_FIELD_TYPE_ID_FLOAT = 1,
- BT_CTF_FIELD_TYPE_ID_ENUM = 2,
- BT_CTF_FIELD_TYPE_ID_STRING = 3,
- BT_CTF_FIELD_TYPE_ID_STRUCT = 4,
- BT_CTF_FIELD_TYPE_ID_ARRAY = 5,
- BT_CTF_FIELD_TYPE_ID_SEQUENCE = 6,
- BT_CTF_FIELD_TYPE_ID_VARIANT = 7,
- BT_CTF_FIELD_TYPE_ID_NR,
-};
-
-extern enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id(
- struct bt_ctf_field_type *field_type);
-
-enum bt_ctf_byte_order {
- BT_CTF_BYTE_ORDER_UNKNOWN = -1,
- BT_CTF_BYTE_ORDER_NATIVE = 0,
- BT_CTF_BYTE_ORDER_UNSPECIFIED,
- BT_CTF_BYTE_ORDER_LITTLE_ENDIAN,
- BT_CTF_BYTE_ORDER_BIG_ENDIAN,
- BT_CTF_BYTE_ORDER_NETWORK,
-};
-
-enum bt_ctf_string_encoding {
- BT_CTF_STRING_ENCODING_UNKNOWN = -1,
- BT_CTF_STRING_ENCODING_NONE,
- BT_CTF_STRING_ENCODING_UTF8,
- BT_CTF_STRING_ENCODING_ASCII,
-};
-
-/* Pre-2.0 CTF writer compatibility */
-#define ctf_string_encoding bt_ctf_string_encoding
-
-extern int bt_ctf_field_type_get_alignment(
- struct bt_ctf_field_type *field_type);
-
-extern int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *field_type,
- unsigned int alignment);
-
-extern enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order(
- struct bt_ctf_field_type *field_type);
-
-extern int bt_ctf_field_type_set_byte_order(
- struct bt_ctf_field_type *field_type,
- enum bt_ctf_byte_order byte_order);
-
-enum bt_ctf_integer_base {
- /// Unknown, used for errors.
- BT_CTF_INTEGER_BASE_UNKNOWN = -1,
-
- /// Unspecified by the tracer.
- BT_CTF_INTEGER_BASE_UNSPECIFIED = 0,
-
- /// Binary.
- BT_CTF_INTEGER_BASE_BINARY = 2,
-
- /// Octal.
- BT_CTF_INTEGER_BASE_OCTAL = 8,
-
- /// Decimal.
- BT_CTF_INTEGER_BASE_DECIMAL = 10,
-
- /// Hexadecimal.
- BT_CTF_INTEGER_BASE_HEXADECIMAL = 16,
-};
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_integer_create(
- unsigned int size);
-
-extern int bt_ctf_field_type_integer_get_size(
- struct bt_ctf_field_type *int_field_type);
-
-extern int bt_ctf_field_type_integer_set_size(
- struct bt_ctf_field_type *int_field_type, unsigned int size);
-
-extern bt_ctf_bool bt_ctf_field_type_integer_is_signed(
- struct bt_ctf_field_type *int_field_type);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-int bt_ctf_field_type_integer_get_signed(
- struct bt_ctf_field_type *int_field_type)
-{
- return bt_ctf_field_type_integer_is_signed(int_field_type) ? 1 : 0;
-}
-
-extern int bt_ctf_field_type_integer_set_is_signed(
- struct bt_ctf_field_type *int_field_type, bt_ctf_bool is_signed);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-int bt_ctf_field_type_integer_set_signed(
- struct bt_ctf_field_type *int_field_type, int is_signed)
-{
- return bt_ctf_field_type_integer_set_is_signed(int_field_type,
- is_signed ? BT_CTF_TRUE : BT_CTF_FALSE);
-}
-
-extern enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base(
- struct bt_ctf_field_type *int_field_type);
-
-extern int bt_ctf_field_type_integer_set_base(
- struct bt_ctf_field_type *int_field_type,
- enum bt_ctf_integer_base base);
-
-extern enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
- struct bt_ctf_field_type *int_field_type);
-
-extern int bt_ctf_field_type_integer_set_encoding(
- struct bt_ctf_field_type *int_field_type,
- enum bt_ctf_string_encoding encoding);
-
-extern struct bt_ctf_clock_class *bt_ctf_field_type_integer_get_mapped_clock_class(
- struct bt_ctf_field_type *int_field_type);
-
-extern int bt_ctf_field_type_integer_set_mapped_clock_class(
- struct bt_ctf_field_type *int_field_type,
- struct bt_ctf_clock_class *clock_class);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void);
-
-extern int bt_ctf_field_type_floating_point_get_exponent_digits(
- struct bt_ctf_field_type *float_field_type);
-
-extern int bt_ctf_field_type_floating_point_set_exponent_digits(
- struct bt_ctf_field_type *float_field_type,
- unsigned int exponent_size);
-
-extern int bt_ctf_field_type_floating_point_get_mantissa_digits(
- struct bt_ctf_field_type *float_field_type);
-
-extern int bt_ctf_field_type_floating_point_set_mantissa_digits(
- struct bt_ctf_field_type *float_field_type,
- unsigned int mantissa_sign_size);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create(
- struct bt_ctf_field_type *int_field_type);
-
-extern
-struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_field_type(
- struct bt_ctf_field_type *enum_field_type);
-
-extern int64_t bt_ctf_field_type_enumeration_get_mapping_count(
- struct bt_ctf_field_type *enum_field_type);
-
-extern int bt_ctf_field_type_enumeration_signed_get_mapping_by_index(
- struct bt_ctf_field_type *enum_field_type, uint64_t index,
- const char **name, int64_t *range_begin, int64_t *range_end);
-
-extern int bt_ctf_field_type_enumeration_unsigned_get_mapping_by_index(
- struct bt_ctf_field_type *enum_field_type, uint64_t index,
- const char **name, uint64_t *range_begin,
- uint64_t *range_end);
-
-extern int bt_ctf_field_type_enumeration_signed_add_mapping(
- struct bt_ctf_field_type *enum_field_type,
- const char *name, int64_t range_begin, int64_t range_end);
-
-extern int bt_ctf_field_type_enumeration_unsigned_add_mapping(
- struct bt_ctf_field_type *enum_field_type,
- const char *name, uint64_t range_begin, uint64_t range_end);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-int bt_ctf_field_type_enumeration_add_mapping(
- struct bt_ctf_field_type *enumeration, const char *name,
- int64_t range_start, int64_t range_end)
-{
- return bt_ctf_field_type_enumeration_signed_add_mapping(enumeration,
- name, range_start, range_end);
-}
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_string_create(void);
-
-extern enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
- struct bt_ctf_field_type *string_field_type);
-
-extern int bt_ctf_field_type_string_set_encoding(
- struct bt_ctf_field_type *string_field_type,
- enum bt_ctf_string_encoding encoding);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void);
-
-extern int64_t bt_ctf_field_type_structure_get_field_count(
- struct bt_ctf_field_type *struct_field_type);
-
-extern int bt_ctf_field_type_structure_get_field_by_index(
- struct bt_ctf_field_type *struct_field_type,
- const char **field_name, struct bt_ctf_field_type **field_type,
- uint64_t index);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-int bt_ctf_field_type_structure_get_field(struct bt_ctf_field_type *structure,
- const char **field_name, struct bt_ctf_field_type **field_type,
- int index)
-{
- return bt_ctf_field_type_structure_get_field_by_index(structure,
- field_name, field_type, (uint64_t) index);
-}
-
-extern
-struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name(
- struct bt_ctf_field_type *struct_field_type,
- const char *field_name);
-
-extern int bt_ctf_field_type_structure_add_field(
- struct bt_ctf_field_type *struct_field_type,
- struct bt_ctf_field_type *field_type,
- const char *field_name);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_array_create(
- struct bt_ctf_field_type *element_field_type,
- unsigned int length);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_field_type(
- struct bt_ctf_field_type *array_field_type);
-
-extern int64_t bt_ctf_field_type_array_get_length(
- struct bt_ctf_field_type *array_field_type);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_create(
- struct bt_ctf_field_type *element_field_type,
- const char *length_name);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_field_type(
- struct bt_ctf_field_type *sequence_field_type);
-
-extern const char *bt_ctf_field_type_sequence_get_length_field_name(
- struct bt_ctf_field_type *sequence_field_type);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_variant_create(
- struct bt_ctf_field_type *tag_field_type,
- const char *tag_name);
-
-extern struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_field_type(
- struct bt_ctf_field_type *variant_field_type);
-
-extern const char *bt_ctf_field_type_variant_get_tag_name(
- struct bt_ctf_field_type *variant_field_type);
-
-extern int bt_ctf_field_type_variant_set_tag_name(
- struct bt_ctf_field_type *variant_field_type,
- const char *tag_name);
-
-extern int64_t bt_ctf_field_type_variant_get_field_count(
- struct bt_ctf_field_type *variant_field_type);
-
-extern int bt_ctf_field_type_variant_get_field_by_index(
- struct bt_ctf_field_type *variant_field_type,
- const char **field_name,
- struct bt_ctf_field_type **field_type, uint64_t index);
-
-extern
-struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name(
- struct bt_ctf_field_type *variant_field_type,
- const char *field_name);
-
-extern
-struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag(
- struct bt_ctf_field_type *variant_field_type,
- struct bt_ctf_field *tag_field);
-
-extern int bt_ctf_field_type_variant_add_field(
- struct bt_ctf_field_type *variant_field_type,
- struct bt_ctf_field_type *field_type,
- const char *field_name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_FIELD_TYPES_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_FIELDS_H
-#define BABELTRACE2_CTF_WRITER_FIELDS_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_field;
-struct bt_ctf_event_class;
-struct bt_ctf_event;
-struct bt_ctf_field_type;
-struct bt_ctf_field_type_enumeration_mapping_iterator;
-
-extern struct bt_ctf_field *bt_ctf_field_create(
- struct bt_ctf_field_type *field_type);
-
-extern struct bt_ctf_field_type *bt_ctf_field_get_type(
- struct bt_ctf_field *field);
-
-extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(
- struct bt_ctf_field *field);
-
-extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field);
-
-extern int bt_ctf_field_integer_signed_get_value(
- struct bt_ctf_field *integer_field, int64_t *value);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-int bt_ctf_field_signed_integer_set_value(
- struct bt_ctf_field *integer_field, int64_t *value)
-{
- return bt_ctf_field_integer_signed_get_value(integer_field, value);
-}
-
-extern int bt_ctf_field_integer_signed_set_value(
- struct bt_ctf_field *integer_field, int64_t value);
-
-extern int bt_ctf_field_integer_unsigned_get_value(
- struct bt_ctf_field *integer_field, uint64_t *value);
-
-extern int bt_ctf_field_integer_unsigned_set_value(
- struct bt_ctf_field *integer_field, uint64_t value);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-int bt_ctf_field_unsigned_integer_set_value(
- struct bt_ctf_field *integer_field, uint64_t *value)
-{
- return bt_ctf_field_integer_unsigned_get_value(integer_field, value);
-}
-
-extern int bt_ctf_field_floating_point_get_value(
- struct bt_ctf_field *float_field, double *value);
-
-extern int bt_ctf_field_floating_point_set_value(
- struct bt_ctf_field *float_field, double value);
-
-extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container(
- struct bt_ctf_field *enum_field);
-
-extern const char *bt_ctf_field_string_get_value(
- struct bt_ctf_field *string_field);
-
-extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field,
- const char *value);
-
-extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field,
- const char *value);
-
-extern int bt_ctf_field_string_append_len(
- struct bt_ctf_field *string_field, const char *value,
- unsigned int length);
-
-extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
- struct bt_ctf_field *struct_field, const char *name);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-struct bt_ctf_field *bt_ctf_field_structure_get_field(
- struct bt_ctf_field *structure, const char *name)
-{
- return bt_ctf_field_structure_get_field_by_name(structure, name);
-}
-
-extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
- struct bt_ctf_field *struct_field, uint64_t index);
-
-extern struct bt_ctf_field *bt_ctf_field_array_get_field(
- struct bt_ctf_field *array_field, uint64_t index);
-
-extern struct bt_ctf_field *bt_ctf_field_sequence_get_field(
- struct bt_ctf_field *sequence_field, uint64_t index);
-
-extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field,
- struct bt_ctf_field *length_field);
-
-extern struct bt_ctf_field *bt_ctf_field_variant_get_field(
- struct bt_ctf_field *variant_field,
- struct bt_ctf_field *tag_field);
-
-extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field(
- struct bt_ctf_field *variant_field);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_FIELDS_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_OBJECT_H
-#define BABELTRACE2_CTF_WRITER_OBJECT_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
-@defgroup refs Reference counting management
-@ingroup apiref
-@brief Common reference counting management for all Babeltrace objects.
-
-@code
-#include <babeltrace2/ctf-writer/object.h>
-@endcode
-
-The macros and functions of this module are everything that is needed
-to handle the <strong><em>reference counting</em></strong> of
-Babeltrace objects.
-
-Any Babeltrace object can be shared by multiple owners thanks to
-<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
-counting</a>.
-
-The Babeltrace C API complies with the following key principles:
-
-1. When you call an API function which accepts a Babeltrace object
- pointer as a parameter, the API function <strong>borrows the
- reference</strong> for the <strong>duration of the function</strong>.
-
- @image html ref-count-user-calls.png
-
- The API function can also get a new reference if the system needs a
- more persistent reference, but the ownership is <strong>never
- transferred</strong> from the caller to the API function.
-
- In other words, the caller still owns the object after calling any
- API function: no function "steals" the user's reference (except
- bt_ctf_object_put_ref()).
-
-2. An API function which \em returns a Babeltrace object pointer to the
- user returns a <strong>new reference</strong>. The caller becomes an
- owner of the object.
-
- @image html ref-count-api-returns.png
-
- It is your responsibility to discard the object when you don't
- need it anymore with bt_ctf_object_put_ref().
-
- For example, see bt_ctf_value_array_get().
-
-3. A Babeltrace object pointer received as a parameter in a user
- function called back from an API function is a
- <strong>borrowed</strong>, or <strong>weak reference</strong>: if you
- need a reference which is more persistent than the duration of the
- user function, call bt_ctf_object_get_ref() on the pointer.
-
- @image html ref-count-callback.png
-
- For example, see bt_ctf_value_map_foreach_entry().
-
-The two macros BT_CTF_OBJECT_PUT_REF_AND_RESET() and BT_CTF_OBJECT_MOVE_REF() operate on \em variables rather
-than pointer values. You should use BT_CTF_OBJECT_PUT_REF_AND_RESET() instead of bt_ctf_object_put_ref() when
-possible to avoid "double puts". For the same reason, you should use use
-BT_CTF_OBJECT_MOVE_REF() instead of performing manual reference moves between
-variables.
-
-@file
-@brief Reference counting management macros and functions.
-@sa refs
-
-@addtogroup refs
-@{
-*/
-
-/**
-@brief Calls bt_ctf_object_put_ref() on a variable named \p _var, then
- sets \p _var to \c NULL.
-
-Using this macro is considered safer than calling bt_ctf_object_put_ref() because it
-makes sure that the variable which used to contain a reference to a
-Babeltrace object is set to \c NULL so that a future BT_CTF_OBJECT_PUT_REF_AND_RESET() or
-bt_ctf_object_put_ref() call will not cause another, unwanted reference decrementation.
-
-@param[in,out] _var Name of a variable containing a
- Babeltrace object's address (this address
- can be \c NULL).
-
-@post <strong>If \p _var does not contain \p NULL</strong>,
- its reference count is decremented.
-@post \p _var contains \c NULL.
-
-@sa BT_CTF_OBJECT_MOVE_REF(): Transfers the ownership of a Babeltrace object from a
- variable to another.
-*/
-#define BT_CTF_OBJECT_PUT_REF_AND_RESET(_var) \
- do { \
- bt_ctf_object_put_ref(_var); \
- (_var) = NULL; \
- } while (0)
-
-/**
-@brief Transfers the ownership of a Babeltrace object from a variable
- named \p _var_src to a variable named \p _var_dst.
-
-This macro implements the following common pattern:
-
- 1. Call bt_ctf_object_put_ref() on \p _var_dst to make sure the previous reference
- held by \p _var_dst is discarded.
- 2. Assign \p _var_src to \p _var_dst.
- 3. Set \p _var_src to \c NULL to avoid future, unwanted reference
- decrementation of \p _var_src.
-
-@warning
-You must \em not use this macro when both \p _var_dst and
-\p _var_src contain the same Babeltrace object address and the reference
-count of this object is 1. The initial call to bt_ctf_object_put_ref() on \p _var_dst
-would destroy the object and leave a dangling pointer in \p _var_dst.
-
-@param[in,out] _var_dst Name of the destination variable, containing
- either the address of a Babeltrace object to
- put first, or \c NULL.
-@param[in,out] _var_src Name of the source variable, containing
- either the address of a Babeltrace object to
- move, or \c NULL.
-
-@pre <strong>If \p _var_dst and \p _var_src contain the same
- value which is not \c NULL</strong>, this object's reference
- count is greater than 1.
-@post <strong>If \c _var_dst is not \c NULL</strong>, its reference
- count is decremented.
-@post \p _var_dst is equal to the value of \p _var_src \em before
- you called this macro.
-@post \p _var_src is \c NULL.
-
-@sa BT_CTF_OBJECT_PUT_REF_AND_RESET(): Calls bt_ctf_object_put_ref() on a variable, then sets it to \c NULL.
-*/
-#define BT_CTF_OBJECT_MOVE_REF(_var_dst, _var_src) \
- do { \
- bt_ctf_object_put_ref(_var_dst); \
- (_var_dst) = (_var_src); \
- (_var_src) = NULL; \
- } while (0)
-
-/**
-@brief Increments the reference count of the Babeltrace object \p obj.
-
-@param[in] obj Babeltrace object of which to get a new reference
- (can be \c NULL).
-@returns \p obj
-
-@post <strong>If \c obj is not \c NULL</strong>, its reference
- count is incremented.
-
-@sa bt_ctf_object_put_ref(): Decrements the reference count of a Babeltrace object.
-*/
-void *bt_ctf_object_get_ref(void *obj);
-
-/**
-@brief Decrements the reference count of the Babeltrace object
- \p obj.
-
-When the object's reference count reaches 0, the object can no longer
-be accessed and is considered \em destroyed.
-
-@remarks
-You should use the BT_CTF_OBJECT_PUT_REF_AND_RESET() macro instead of calling bt_ctf_object_put_ref() since the
-former is generally safer.
-
-@param[in] obj Babeltrace object of which to drop a reference
- (can be \c NULL).
-
-@post <strong>If \c obj is not \c NULL</strong>, its reference
- count is decremented.
-
-@sa BT_CTF_OBJECT_PUT_REF_AND_RESET(): Calls bt_ctf_object_put_ref() on a variable, then sets it to \c NULL.
-@sa BT_CTF_OBJECT_MOVE_REF(): Transfers the ownership of a Babeltrace object from a
- variable to another.
-@sa bt_ctf_object_get_ref(): Increments the reference count of a Babeltrace object.
-*/
-void bt_ctf_object_put_ref(void *obj);
-
-/**
-@}
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_OBJECT_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_STREAM_CLASS_H
-#define BABELTRACE2_CTF_WRITER_STREAM_CLASS_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace2/ctf-writer/object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_stream_class;
-struct bt_ctf_trace;
-struct bt_ctf_event_class;
-struct bt_ctf_field_type;
-struct bt_ctf_clock;
-
-extern struct bt_ctf_stream_class *bt_ctf_stream_class_create(
- const char *name);
-
-extern struct bt_ctf_trace *bt_ctf_stream_class_get_trace(
- struct bt_ctf_stream_class *stream_class);
-
-extern const char *bt_ctf_stream_class_get_name(
- struct bt_ctf_stream_class *stream_class);
-
-extern int bt_ctf_stream_class_set_name(
- struct bt_ctf_stream_class *stream_class, const char *name);
-
-extern int64_t bt_ctf_stream_class_get_id(
- struct bt_ctf_stream_class *stream_class);
-
-extern int bt_ctf_stream_class_set_id(
- struct bt_ctf_stream_class *stream_class, uint64_t id);
-
-extern struct bt_ctf_field_type *bt_ctf_stream_class_get_packet_context_type(
- struct bt_ctf_stream_class *stream_class);
-
-extern int bt_ctf_stream_class_set_packet_context_type(
- struct bt_ctf_stream_class *stream_class,
- struct bt_ctf_field_type *packet_context_type);
-
-extern struct bt_ctf_field_type *
-bt_ctf_stream_class_get_event_header_type(
- struct bt_ctf_stream_class *stream_class);
-
-extern int bt_ctf_stream_class_set_event_header_type(
- struct bt_ctf_stream_class *stream_class,
- struct bt_ctf_field_type *event_header_type);
-
-extern struct bt_ctf_field_type *
-bt_ctf_stream_class_get_event_context_type(
- struct bt_ctf_stream_class *stream_class);
-
-extern int bt_ctf_stream_class_set_event_context_type(
- struct bt_ctf_stream_class *stream_class,
- struct bt_ctf_field_type *event_context_type);
-
-extern int64_t bt_ctf_stream_class_get_event_class_count(
- struct bt_ctf_stream_class *stream_class);
-
-extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index(
- struct bt_ctf_stream_class *stream_class, uint64_t index);
-
-extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id(
- struct bt_ctf_stream_class *stream_class, uint64_t id);
-
-extern int bt_ctf_stream_class_add_event_class(
- struct bt_ctf_stream_class *stream_class,
- struct bt_ctf_event_class *event_class);
-
-extern int bt_ctf_stream_class_set_clock(
- struct bt_ctf_stream_class *ctf_stream_class,
- struct bt_ctf_clock *clock);
-
-extern struct bt_ctf_clock *bt_ctf_stream_class_get_clock(
- struct bt_ctf_stream_class *stream_class);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_stream_class_get(struct bt_ctf_stream_class *stream_class)
-{
- bt_ctf_object_get_ref(stream_class);
-}
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_stream_class_put(struct bt_ctf_stream_class *stream_class)
-{
- bt_ctf_object_put_ref(stream_class);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_STREAM_CLASS_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_STREAM_H
-#define BABELTRACE2_CTF_WRITER_STREAM_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_stream;
-struct bt_ctf_event;
-
-/*
- * bt_ctf_stream_get_discarded_events_count: get the number of discarded
- * events associated with this stream.
- *
- * Note that discarded events are not stored if the stream's packet
- * context has no "events_discarded" field. An error will be returned
- * in that case.
- *
- * @param stream Stream instance.
- *
- * Returns the number of discarded events, a negative value on error.
- */
-extern int bt_ctf_stream_get_discarded_events_count(
- struct bt_ctf_stream *stream, uint64_t *count);
-
-/*
- * bt_ctf_stream_append_discarded_events: increment discarded events count.
- *
- * Increase the current packet's discarded event count. Has no effect if the
- * stream class' packet context has no "events_discarded" field.
- *
- * @param stream Stream instance.
- * @param event_count Number of discarded events to add to the stream's current
- * packet.
- */
-extern void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream,
- uint64_t event_count);
-
-/*
- * bt_ctf_stream_append_event: append an event to the stream.
- *
- * Append "event" to the stream's current packet. The stream's associated clock
- * will be sampled during this call. The event shall not be modified after
- * being appended to a stream. The stream will share the event's ownership by
- * incrementing its reference count. The current packet is not flushed to disk
- * until the next call to bt_ctf_stream_flush.
- *
- * The stream event context will be sampled for every appended event if
- * a stream event context was defined.
- *
- * @param stream Stream instance.
- * @param event Event instance to append to the stream's current packet.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_stream_append_event(struct bt_ctf_stream *stream,
- struct bt_ctf_event *event);
-
-/*
- * bt_ctf_stream_get_packet_header: get a stream's packet header.
- *
- * @param stream Stream instance.
- *
- * Returns a field instance on success, NULL on error.
- */
-extern struct bt_ctf_field *bt_ctf_stream_get_packet_header(
- struct bt_ctf_stream *stream);
-
-/*
- * bt_ctf_stream_set_packet_header: set a stream's packet header.
- *
- * The packet header's type must match the trace's packet header
- * type.
- *
- * @param stream Stream instance.
- * @param packet_header Packet header instance.
- *
- * Returns a field instance on success, NULL on error.
- */
-extern int bt_ctf_stream_set_packet_header(
- struct bt_ctf_stream *stream,
- struct bt_ctf_field *packet_header);
-
-/*
- * bt_ctf_stream_get_packet_context: get a stream's packet context.
- *
- * @param stream Stream instance.
- *
- * Returns a field instance on success, NULL on error.
- */
-extern struct bt_ctf_field *bt_ctf_stream_get_packet_context(
- struct bt_ctf_stream *stream);
-
-/*
- * bt_ctf_stream_set_packet_context: set a stream's packet context.
- *
- * The packet context's type must match the stream class' packet
- * context type.
- *
- * @param stream Stream instance.
- * @param packet_context Packet context field instance.
- *
- * Returns a field instance on success, NULL on error.
- */
-extern int bt_ctf_stream_set_packet_context(
- struct bt_ctf_stream *stream,
- struct bt_ctf_field *packet_context);
-
-/*
- * bt_ctf_stream_flush: flush a stream.
- *
- * The stream's current packet's events will be flushed, thus closing the
- * current packet. Events subsequently appended to the stream will be
- * added to a new packet.
- *
- * Flushing will also set the packet context's default attributes if
- * they remained unset while populating the current packet. These default
- * attributes, along with their expected types, are detailed in stream-class.h.
- *
- * @param stream Stream instance.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_stream_flush(struct bt_ctf_stream *stream);
-
-extern int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream);
-
-extern
-struct bt_ctf_stream *bt_ctf_stream_create(
- struct bt_ctf_stream_class *stream_class,
- const char *name, uint64_t id);
-
-extern struct bt_ctf_stream_class *bt_ctf_stream_get_class(
- struct bt_ctf_stream *stream);
-
-extern const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream);
-
-extern int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream);
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_stream_get(struct bt_ctf_stream *stream)
-{
- bt_ctf_object_get_ref(stream);
-}
-
-/* Pre-2.0 CTF writer compatibility */
-static inline
-void bt_ctf_stream_put(struct bt_ctf_stream *stream)
-{
- bt_ctf_object_put_ref(stream);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_STREAM_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_TRACE_H
-#define BABELTRACE2_CTF_WRITER_TRACE_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_trace;
-struct bt_ctf_stream_class;
-struct bt_ctf_stream;
-
-extern enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order(
- struct bt_ctf_trace *trace);
-
-extern int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace,
- enum bt_ctf_byte_order native_byte_order);
-
-extern const uint8_t *bt_ctf_trace_get_uuid(
- struct bt_ctf_trace *trace);
-
-extern int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace,
- const uint8_t *uuid);
-
-extern int bt_ctf_trace_set_environment_field_integer(
- struct bt_ctf_trace *trace, const char *name,
- int64_t value);
-
-extern int bt_ctf_trace_set_environment_field_string(
- struct bt_ctf_trace *trace, const char *name,
- const char *value);
-
-extern struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_field_type(
- struct bt_ctf_trace *trace);
-
-extern int bt_ctf_trace_set_packet_header_field_type(struct bt_ctf_trace *trace,
- struct bt_ctf_field_type *packet_header_type);
-
-extern int64_t bt_ctf_trace_get_stream_class_count(
- struct bt_ctf_trace *trace);
-
-extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
- struct bt_ctf_trace *trace, uint64_t index);
-
-extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
- struct bt_ctf_trace *trace, uint64_t id);
-
-extern int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
- struct bt_ctf_stream_class *stream_class);
-
-extern int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace);
-
-extern struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
- struct bt_ctf_trace *trace, uint64_t index);
-
-extern const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_TRACE_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_TYPES_H
-#define BABELTRACE2_CTF_WRITER_TYPES_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/// False boolean value for the #bt_ctf_bool type.
-#define BT_CTF_FALSE 0
-
-/// True boolean value for the #bt_ctf_bool type.
-#define BT_CTF_TRUE 1
-
-typedef int bt_ctf_bool;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_TYPES_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_UTILS_H
-#define BABELTRACE2_CTF_WRITER_UTILS_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_ctf_bool */
-#include <babeltrace2/ctf-writer/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern bt_ctf_bool bt_ctf_identifier_is_valid(const char *identifier);
-
-static inline
-int bt_ctf_validate_identifier(const char *identifier)
-{
- return bt_ctf_identifier_is_valid(identifier) ? 1 : 0;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_UTILS_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_VISITOR_H
-#define BABELTRACE2_CTF_WRITER_VISITOR_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
-@defgroup ctfirvisitor CTF IR visitor
-@ingroup ctfir
-@brief CTF IR visitor.
-
-@code
-#include <babeltrace2/trace-ir/visitor.h>
-@endcode
-
-A CTF IR <strong><em>visitor</em></strong> is a function that you
-can use to visit the hierarchy of a
-\link ctfirtraceclass CTF IR trace class\endlink with
-bt_ctf_trace_visit() or of a
-\link ctfirstreamclass CTF IR stream class\endlink with
-bt_ctf_stream_class_visit().
-
-The traversal of the object's hierarchy is always done in a
-pre-order fashion.
-
-@sa ctfirstreamclass
-@sa ctfirtraceclass
-
-@file
-@brief CTF IR visitor types and functions.
-@sa ctfirvisitor
-
-@addtogroup ctfirvisitor
-@{
-*/
-
-/**
-@struct bt_ctf_object
-@brief A CTF IR object wrapper.
-
-This structure wraps both a CTF IR object and its type
-(see #bt_ctf_object_type). It is used in the visiting function.
-
-You can use the bt_ctf_object_get_type() and
-bt_ctf_object_get_object() accessors to get the type and wrapped
-CTF IR object of a CTF IR object wrapper.
-
-A CTF IR object wrapper has <strong>no reference count</strong>: do \em
-not use bt_ctf_object_put_ref() or bt_ctf_object_get_ref() on it.
-
-@sa ctfirvisitor
-*/
-struct bt_ctf_visitor_object;
-
-/**
-@brief CTF IR object wrapper type.
-*/
-enum bt_ctf_visitor_object_type {
- /// Unknown (used for errors).
- BT_CTF_VISITOR_OBJECT_TYPE_UNKNOWN = -1,
-
- /// \ref ctfirtraceclass.
- BT_CTF_VISITOR_OBJECT_TYPE_TRACE = 0,
-
- /// \ref ctfirstreamclass.
- BT_CTF_VISITOR_OBJECT_TYPE_STREAM_CLASS = 1,
-
- /// \ref ctfirstream.
- BT_CTF_VISITOR_OBJECT_TYPE_STREAM = 2,
-
- /// \ref ctfireventclass.
- BT_CTF_VISITOR_OBJECT_TYPE_EVENT_CLASS = 3,
-
- /// \ref ctfirevent.
- BT_CTF_VISITOR_OBJECT_TYPE_EVENT = 4,
-
- /// Number of entries in this enumeration.
- BT_CTF_VISITOR_OBJECT_TYPE_NR,
-};
-
-/**
-@brief Visting function type.
-
-A function of this type is called by bt_ctf_trace_visit() or
-bt_ctf_stream_class_visit() when visiting the CTF IR object wrapper
-\p object.
-
-\p object has <strong>no reference count</strong>: do \em not use
-bt_ctf_object_put_ref() or bt_ctf_object_get_ref() on it.
-
-@param[in] object Currently visited CTF IR object wrapper.
-@param[in] data User data.
-@returns 0 on success, or a negative value on error.
-
-@prenotnull{object}
-
-@sa bt_ctf_trace_visit(): Accepts a visitor to visit a trace class.
-@sa bt_ctf_stream_class_visit(): Accepts a visitor to visit a stream
- class.
-*/
-typedef int (*bt_ctf_visitor)(struct bt_ctf_visitor_object *object,
- void *data);
-
-/**
-@brief Returns the type of the CTF IR object wrapped by the CTF IR
- object wrapper \p object.
-
-@param[in] object Object wrapper of which to get the type.
-@returns Type of \p object.
-
-@prenotnull{object}
-
-@sa bt_ctf_visitor_object_get_object(): Returns the object wrapped by a given
- CTF IR object wrapper.
-*/
-enum bt_ctf_visitor_object_type bt_ctf_visitor_object_get_type(
- struct bt_ctf_visitor_object *object);
-
-/**
-@brief Returns the CTF IR object wrapped by the CTF IR object
- wrapper \p object.
-
-The reference count of \p object is \em not incremented by this
-function. On success, you must call bt_ctf_object_get_ref() on the return value to
-have your own reference.
-
-@param[in] object Object wrapper of which to get the wrapped
- CTF IR object.
-@returns CTF IR object wrapped by \p object.
-
-@prenotnull{object}
-@post The reference count of the returned object is not modified.
-
-@sa bt_ctf_visitor_object_get_type(): Returns the type of a given
- CTF IR object wrapper.
-*/
-void *bt_ctf_visitor_object_get_object(struct bt_ctf_visitor_object *object);
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_VISITOR_H */
+++ /dev/null
-#ifndef BABELTRACE2_CTF_WRITER_WRITER_H
-#define BABELTRACE2_CTF_WRITER_WRITER_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
-#include <babeltrace2/ctf-writer/trace.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_ctf_writer;
-struct bt_ctf_stream;
-struct bt_ctf_stream_class;
-struct bt_ctf_clock;
-
-/*
- * bt_ctf_writer_create: create a writer instance.
- *
- * Allocate a new writer that will produce a trace in the given path.
- * The creation of a writer sets its reference count to 1.
- *
- * @param path Path to the trace's containing folder (string is copied).
- *
- * Returns an allocated writer on success, NULL on error.
- */
-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.
- *
- * Allocate a new stream instance and register it to the writer. The creation of
- * a stream sets its reference count to 1.
- *
- * @param writer Writer instance.
- * @param stream_class Stream class to instantiate.
- *
- * Returns an allocated stream on success, NULL on error.
- */
-extern struct bt_ctf_stream *bt_ctf_writer_create_stream(
- struct bt_ctf_writer *writer,
- struct bt_ctf_stream_class *stream_class);
-
-/*
- * bt_ctf_writer_add_environment_field: 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 (will be copied).
- *
- * Returns 0 on success, a negative value on error.
- */
-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.
- *
- * Add a clock to the trace. Clocks assigned to stream classes must be
- * registered to the writer.
- *
- * @param writer Writer instance.
- * @param clock Clock to add to the trace.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_writer_add_clock(struct bt_ctf_writer *writer,
- struct bt_ctf_clock *clock);
-
-/*
- * bt_ctf_writer_get_metadata_string: get meta-data string.
- *
- * Get the trace's TSDL meta-data. The caller assumes the ownership of the
- * returned string.
- *
- * @param writer Writer instance.
- *
- * Returns the metadata string on success, NULL on error.
- */
-extern char *bt_ctf_writer_get_metadata_string(struct bt_ctf_writer *writer);
-
-/*
- * bt_ctf_writer_flush_metadata: flush the trace's metadata to disk.
- *
- * Flush the trace's metadata to the metadata file. Note that the metadata will
- * be flushed automatically when the Writer instance is released (last call to
- * bt_ctf_writer_put).
- *
- * @param writer Writer instance.
- */
-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 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);
-
-/*
- * 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
- * destroy a writer.
- *
- * When the writer's reference count is decremented to 0 by a
- * bt_ctf_writer_put, the writer is freed.
- *
- * @param writer Writer instance.
- */
-
-/* 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
-}
-#endif
-
-#endif /* BABELTRACE2_CTF_WRITER_WRITER_H */
#include "common/assert.h"
#include "common/macros.h"
#include "compat/string.h"
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/object.h>
#include <inttypes.h>
#include "values.h"
#include "logging.h"
#include "common/uuid.h"
-#include <babeltrace2/ctf-writer/utils.h>
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/object.h>
#include "compat/compiler.h"
#include <babeltrace2/types.h>
#include "compat/string.h"
#include "common/macros.h"
#include "object-pool.h"
#include "common/uuid.h"
-#include <babeltrace2/ctf-writer/types.h>
+#include <babeltrace2-ctf-writer/types.h>
#include <stdbool.h>
#include <stdint.h>
#include <glib.h>
#include "common/assert.h"
#include "common/uuid.h"
#include "compat/compiler.h"
-#include <babeltrace2/ctf-writer/utils.h>
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/object.h>
#include <inttypes.h>
#include "clock-class.h"
* SOFTWARE.
*/
-#include <babeltrace2/ctf-writer/clock.h>
+#include <babeltrace2-ctf-writer/clock.h>
#include "common/macros.h"
#include <glib.h>
#include <inttypes.h>
#include <stdlib.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/utils.h>
#include <babeltrace2/types.h>
#include "common/assert.h"
#include "common/assert.h"
#include "common/macros.h"
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/fields.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/fields.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
#include <glib.h>
#include "object.h"
#include <inttypes.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/fields.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/trace.h>
-#include <babeltrace2/ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/fields.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/utils.h>
#include "common/assert.h"
#include "compat/compiler.h"
#include "common/assert.h"
#include "common/macros.h"
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/fields.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/fields.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
#include "ctfser/ctfser.h"
#include "assert-pre.h"
#include <limits.h>
#include <stdint.h>
-#include <babeltrace2/ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/field-types.h>
#include "common/assert.h"
#include "common/common.h"
#include "common/assert.h"
#include "common/macros.h"
-#include <babeltrace2/ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/field-types.h>
#include <glib.h>
#include "object.h"
#include <inttypes.h>
#include <stdlib.h>
-#include <babeltrace2/ctf-writer/fields.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/fields.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/utils.h>
#include "common/assert.h"
#include "compat/compiler.h"
#include <stdint.h>
#include <stddef.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/types.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/types.h>
#include "common/macros.h"
#include <inttypes.h>
#include <stdlib.h>
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/object.h>
#include "common/align.h"
#include "common/assert.h"
#include <stdint.h>
#include <string.h>
-#include <babeltrace2/ctf-writer/fields.h>
+#include <babeltrace2-ctf-writer/fields.h>
#include <babeltrace2/types.h>
#include "common/macros.h"
#include <limits.h>
#include <stdlib.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
#include <babeltrace2/types.h>
#include "common/macros.h"
* SOFTWARE.
*/
-#include <babeltrace2/ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/field-types.h>
#include "common/macros.h"
#include <glib.h>
#include <stdbool.h>
#include <stdint.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/trace.h>
-#include <babeltrace2/ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/utils.h>
#include "common/align.h"
#include "common/assert.h"
#include "common/assert.h"
#include "common/macros.h"
#include "common/common.h"
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/visitor.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/visitor.h>
#include <inttypes.h>
#include "clock.h"
#include <stdint.h>
#include <unistd.h>
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
-#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/trace.h>
#include "common/align.h"
#include "common/assert.h"
#include "common/assert.h"
#include "common/macros.h"
-#include <babeltrace2/ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/stream.h>
#include "ctfser/ctfser.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/object.h>
-#include <babeltrace2/ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/utils.h>
#include <babeltrace2/types.h>
#include "common/assert.h"
#include "common/macros.h"
#include "common/uuid.h"
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/fields.h>
-#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/fields.h>
+#include <babeltrace2-ctf-writer/trace.h>
#include <babeltrace2/types.h>
#include <glib.h>
#include <sys/types.h>
#include <glib.h>
#include <stdlib.h>
-#include <babeltrace2/ctf-writer/utils.h>
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/utils.h>
+#include <babeltrace2-ctf-writer/object.h>
#include "common/assert.h"
*/
#include "common/macros.h"
-#include <babeltrace2/ctf-writer/field-types.h>
-#include <babeltrace2/ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/field-types.h>
+#include <babeltrace2-ctf-writer/event.h>
#include <stdint.h>
#include "field-path.h"
#define BT_LOG_TAG "CTF-WRITER/VALIDATION"
#include "logging.h"
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/object.h>
#include "common/macros.h"
#include <string.h>
#include <inttypes.h>
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/object.h>
#include <babeltrace2/types.h>
#include "common/assert.h"
* SOFTWARE.
*/
-#include <babeltrace2/ctf-writer/types.h>
+#include <babeltrace2-ctf-writer/types.h>
#include "common/macros.h"
* SOFTWARE.
*/
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/object.h>
#include "common/macros.h"
#include <stdlib.h>
#include <stdint.h>
-#include <babeltrace2/ctf-writer/visitor.h>
+#include <babeltrace2-ctf-writer/visitor.h>
#include "common/macros.h"
typedef void *(*bt_ctf_child_accessor)(void *object, int index);
#include <sys/stat.h>
#include <unistd.h>
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/object.h>
#include "common/assert.h"
#include "compat/compiler.h"
#include <glib.h>
#include <sys/types.h>
-#include <babeltrace2/ctf-writer/trace.h>
-#include <babeltrace2/ctf-writer/writer.h>
+#include <babeltrace2-ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/writer.h>
#include "common/macros.h"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <babeltrace2/ctf-writer/writer.h>
-#include <babeltrace2/ctf-writer/clock.h>
-#include <babeltrace2/ctf-writer/clock-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/event-types.h>
-#include <babeltrace2/ctf-writer/event-fields.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/writer.h>
+#include <babeltrace2-ctf-writer/clock.h>
+#include <babeltrace2-ctf-writer/clock-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/event-types.h>
+#include <babeltrace2-ctf-writer/event-fields.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/trace.h>
#include <babeltrace2/babeltrace.h>
#include <glib.h>
#include <unistd.h>
#include "lib/object.h"
#include "compat/stdlib.h"
#include "common/assert.h"
-#include <babeltrace2/ctf-writer/writer.h>
-#include <babeltrace2/ctf-writer/clock.h>
-#include <babeltrace2/ctf-writer/clock-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/event-types.h>
-#include <babeltrace2/ctf-writer/event-fields.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/writer.h>
+#include <babeltrace2-ctf-writer/clock.h>
+#include <babeltrace2-ctf-writer/clock-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/event-types.h>
+#include <babeltrace2-ctf-writer/event-fields.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/trace.h>
#include "common.h"
#define NR_TESTS 37
*/
#include <stdint.h>
-#include <babeltrace2/ctf-writer/writer.h>
-#include <babeltrace2/ctf-writer/clock.h>
-#include <babeltrace2/ctf-writer/clock-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/event-types.h>
-#include <babeltrace2/ctf-writer/event-fields.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/writer.h>
+#include <babeltrace2-ctf-writer/clock.h>
+#include <babeltrace2-ctf-writer/clock-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/event-types.h>
+#include <babeltrace2-ctf-writer/event-fields.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/trace.h>
#include "common/assert.h"
*/
#include <stdint.h>
-#include <babeltrace2/ctf-writer/writer.h>
-#include <babeltrace2/ctf-writer/clock.h>
-#include <babeltrace2/ctf-writer/clock-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/event-types.h>
-#include <babeltrace2/ctf-writer/event-fields.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/writer.h>
+#include <babeltrace2-ctf-writer/clock.h>
+#include <babeltrace2-ctf-writer/clock-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/event-types.h>
+#include <babeltrace2-ctf-writer/event-fields.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/trace.h>
#include "common/assert.h"
*/
#include <stdint.h>
-#include <babeltrace2/ctf-writer/writer.h>
-#include <babeltrace2/ctf-writer/clock.h>
-#include <babeltrace2/ctf-writer/clock-class.h>
-#include <babeltrace2/ctf-writer/stream.h>
-#include <babeltrace2/ctf-writer/event.h>
-#include <babeltrace2/ctf-writer/event-types.h>
-#include <babeltrace2/ctf-writer/event-fields.h>
-#include <babeltrace2/ctf-writer/stream-class.h>
-#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2-ctf-writer/writer.h>
+#include <babeltrace2-ctf-writer/clock.h>
+#include <babeltrace2-ctf-writer/clock-class.h>
+#include <babeltrace2-ctf-writer/stream.h>
+#include <babeltrace2-ctf-writer/event.h>
+#include <babeltrace2-ctf-writer/event-types.h>
+#include <babeltrace2-ctf-writer/event-fields.h>
+#include <babeltrace2-ctf-writer/stream-class.h>
+#include <babeltrace2-ctf-writer/trace.h>
#include "common/assert.h"