doc/api/libbabeltrace2/DoxygenLayout.xml: use `topics` tab
[babeltrace.git] / src / ctf-writer / trace.c
index 804af24dc1819192e9451876f8cec190c828da63..e2e9d4deaba3239902d803f0d991875e065b94e3 100644 (file)
@@ -1,24 +1,8 @@
 /*
+ * SPDX-License-Identifier: MIT
+ *
  * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * 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.
  */
 
 #define BT_LOG_TAG "CTF-WRITER/TRACE"
@@ -33,7 +17,6 @@
 #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 "compat/compiler.h"
@@ -59,7 +42,6 @@
 #define DEFAULT_IDENTIFIER_SIZE                128
 #define DEFAULT_METADATA_STRING_SIZE   4096
 
-BT_HIDDEN
 int bt_ctf_trace_common_initialize(struct bt_ctf_trace_common *trace,
                bt_ctf_object_release_func release_func)
 {
@@ -106,7 +88,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 void bt_ctf_trace_common_finalize(struct bt_ctf_trace_common *trace)
 {
        BT_LOGD("Finalizing common trace object: addr=%p, name=\"%s\"",
@@ -140,7 +121,6 @@ void bt_ctf_trace_common_finalize(struct bt_ctf_trace_common *trace)
        bt_ctf_object_put_ref(trace->packet_header_field_type);
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_set_name(struct bt_ctf_trace_common *trace, const char *name)
 {
        int ret = 0;
@@ -179,7 +159,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_set_uuid(struct bt_ctf_trace_common *trace,
                const uint8_t *uuid)
 {
@@ -216,7 +195,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_set_environment_field(struct bt_ctf_trace_common *trace,
                const char *name, struct bt_ctf_private_value *value)
 {
@@ -303,7 +281,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_set_environment_field_string(struct bt_ctf_trace_common *trace,
                const char *name, const char *value)
 {
@@ -332,7 +309,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_set_environment_field_integer(
                struct bt_ctf_trace_common *trace, const char *name, int64_t value)
 {
@@ -355,7 +331,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_add_clock_class(struct bt_ctf_trace_common *trace,
                struct bt_ctf_clock_class *clock_class)
 {
@@ -600,8 +575,9 @@ end:
 }
 
 static
-bool packet_context_field_type_is_valid(struct bt_ctf_trace_common *trace,
-               struct bt_ctf_stream_class_common *stream_class,
+bool packet_context_field_type_is_valid(
+               struct bt_ctf_trace_common *trace __attribute__((unused)),
+               struct bt_ctf_stream_class_common *stream_class __attribute__((unused)),
                struct bt_ctf_field_type_common *packet_context_type,
                bool check_ts_begin_end_mapped)
 {
@@ -770,7 +746,8 @@ end:
 }
 
 static
-bool event_header_field_type_is_valid(struct bt_ctf_trace_common *trace,
+bool event_header_field_type_is_valid(
+               struct bt_ctf_trace_common *trace __attribute__((unused)),
                struct bt_ctf_stream_class_common *stream_class,
                struct bt_ctf_field_type_common *event_header_type)
 {
@@ -876,7 +853,6 @@ int check_packet_header_type_has_no_clock_class(struct bt_ctf_trace_common *trac
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_add_stream_class(struct bt_ctf_trace_common *trace,
                struct bt_ctf_stream_class_common *stream_class,
                bt_ctf_validation_flag_copy_field_type_func copy_field_type_func,
@@ -1240,7 +1216,9 @@ int bt_ctf_trace_common_add_stream_class(struct bt_ctf_trace_common *trace,
 
 end:
        if (ret) {
-               bt_ctf_object_set_parent(&stream_class->base, NULL);
+               if (stream_class) {
+                       bt_ctf_object_set_parent(&stream_class->base, NULL);
+               }
 
                if (ec_validation_outputs) {
                        for (i = 0; i < event_class_count; i++) {
@@ -1256,7 +1234,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 bt_ctf_bool bt_ctf_trace_common_has_clock_class(struct bt_ctf_trace_common *trace,
                struct bt_ctf_clock_class *clock_class)
 {
@@ -1269,7 +1246,6 @@ bt_ctf_bool bt_ctf_trace_common_has_clock_class(struct bt_ctf_trace_common *trac
        return query.found;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_set_native_byte_order(struct bt_ctf_trace_common *trace,
                enum bt_ctf_byte_order byte_order, bool allow_unspecified)
 {
@@ -1318,7 +1294,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_trace_common_set_packet_header_field_type(struct bt_ctf_trace_common *trace,
                struct bt_ctf_field_type_common *packet_header_type)
 {
@@ -1419,7 +1394,6 @@ void bt_ctf_trace_destroy(struct bt_ctf_object *obj)
        g_free(trace);
 }
 
-BT_HIDDEN
 struct bt_ctf_trace *bt_ctf_trace_create(void)
 {
        struct bt_ctf_trace *trace = NULL;
@@ -1447,17 +1421,20 @@ error:
        return trace;
 }
 
+BT_EXPORT
 const uint8_t *bt_ctf_trace_get_uuid(struct bt_ctf_trace *trace)
 {
        return bt_ctf_trace_common_get_uuid(BT_CTF_TO_COMMON(trace));
 }
 
+BT_EXPORT
 int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace,
                const uint8_t *uuid)
 {
        return bt_ctf_trace_common_set_uuid(BT_CTF_TO_COMMON(trace), uuid);
 }
 
+BT_EXPORT
 int bt_ctf_trace_set_environment_field_string(struct bt_ctf_trace *trace,
                const char *name, const char *value)
 {
@@ -1465,6 +1442,7 @@ int bt_ctf_trace_set_environment_field_string(struct bt_ctf_trace *trace,
                name, value);
 }
 
+BT_EXPORT
 int bt_ctf_trace_set_environment_field_integer(
                struct bt_ctf_trace *trace, const char *name, int64_t value)
 {
@@ -1499,7 +1477,6 @@ struct bt_ctf_value *bt_ctf_trace_get_environment_field_value_by_name(
                BT_CTF_TO_COMMON(trace), name));
 }
 
-BT_HIDDEN
 int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace,
                struct bt_ctf_clock_class *clock_class)
 {
@@ -1507,13 +1484,11 @@ int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace,
                (void *) clock_class);
 }
 
-BT_HIDDEN
 int64_t bt_ctf_trace_get_clock_class_count(struct bt_ctf_trace *trace)
 {
        return bt_ctf_trace_common_get_clock_class_count(BT_CTF_TO_COMMON(trace));
 }
 
-BT_HIDDEN
 struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index(
                struct bt_ctf_trace *trace, uint64_t index)
 {
@@ -1538,6 +1513,7 @@ int map_clock_classes_func(struct bt_ctf_stream_class_common *stream_class,
        return ret;
 }
 
+BT_EXPORT
 int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
                struct bt_ctf_stream_class *stream_class)
 {
@@ -1626,11 +1602,13 @@ end:
        return ret;
 }
 
+BT_EXPORT
 int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace)
 {
        return bt_ctf_trace_common_get_stream_count(BT_CTF_TO_COMMON(trace));
 }
 
+BT_EXPORT
 struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
                struct bt_ctf_trace *trace, uint64_t index)
 {
@@ -1638,11 +1616,13 @@ struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
                BT_CTF_TO_COMMON(trace), index));
 }
 
+BT_EXPORT
 int64_t bt_ctf_trace_get_stream_class_count(struct bt_ctf_trace *trace)
 {
        return bt_ctf_trace_common_get_stream_class_count(BT_CTF_TO_COMMON(trace));
 }
 
+BT_EXPORT
 struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
                struct bt_ctf_trace *trace, uint64_t index)
 {
@@ -1650,6 +1630,7 @@ struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
                BT_CTF_TO_COMMON(trace), index));
 }
 
+BT_EXPORT
 struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
                struct bt_ctf_trace *trace, uint64_t id)
 {
@@ -1657,7 +1638,6 @@ struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
                BT_CTF_TO_COMMON(trace), id));
 }
 
-BT_HIDDEN
 struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_name(
                struct bt_ctf_trace *trace, const char *name)
 {
@@ -1836,12 +1816,14 @@ end:
        return metadata;
 }
 
+BT_EXPORT
 enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order(
                struct bt_ctf_trace *trace)
 {
        return (int) bt_ctf_trace_common_get_native_byte_order(BT_CTF_TO_COMMON(trace));
 }
 
+BT_EXPORT
 int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace,
                enum bt_ctf_byte_order byte_order)
 {
@@ -1849,6 +1831,7 @@ int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace,
                (int) byte_order, false);
 }
 
+BT_EXPORT
 struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_field_type(
                struct bt_ctf_trace *trace)
 {
@@ -1856,6 +1839,7 @@ struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_field_type(
                BT_CTF_TO_COMMON(trace)));
 }
 
+BT_EXPORT
 int bt_ctf_trace_set_packet_header_field_type(struct bt_ctf_trace *trace,
                struct bt_ctf_field_type *packet_header_type)
 {
@@ -1863,6 +1847,7 @@ int bt_ctf_trace_set_packet_header_field_type(struct bt_ctf_trace *trace,
                (void *) packet_header_type);
 }
 
+BT_EXPORT
 const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace)
 {
        return bt_ctf_trace_common_get_name(BT_CTF_TO_COMMON(trace));
This page took 0.026701 seconds and 4 git commands to generate.