Remove unnecessary inclusions of "internal public" headers
[babeltrace.git] / src / ctf-writer / event-class.c
index ac5d89264b886db7d199d374700e7ab65260d590..22053f296a283fb165e8c0a2874b12d786987fb1 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/EVENT-CLASS"
 #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/types.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 "common/assert.h"
 #include "compat/compiler.h"
@@ -52,7 +35,6 @@
 #include "values.h"
 #include "writer.h"
 
-BT_HIDDEN
 void bt_ctf_event_class_common_finalize(struct bt_ctf_object *obj)
 {
        struct bt_ctf_event_class_common *event_class;
@@ -76,7 +58,6 @@ void bt_ctf_event_class_common_finalize(struct bt_ctf_object *obj)
        bt_ctf_object_put_ref(event_class->payload_field_type);
 }
 
-BT_HIDDEN
 int bt_ctf_event_class_common_initialize(struct bt_ctf_event_class_common *event_class,
                const char *name, bt_ctf_object_release_func release_func,
                bt_ctf_field_type_structure_create_func ft_struct_create_func)
@@ -115,10 +96,9 @@ error:
        return ret;
 }
 
-BT_HIDDEN
 void bt_ctf_event_class_common_freeze(struct bt_ctf_event_class_common *event_class)
 {
-       BT_ASSERT(event_class);
+       BT_ASSERT_DBG(event_class);
 
        if (event_class->frozen) {
                return;
@@ -134,15 +114,14 @@ void bt_ctf_event_class_common_freeze(struct bt_ctf_event_class_common *event_cl
        bt_ctf_field_type_common_freeze(event_class->payload_field_type);
 }
 
-BT_HIDDEN
 int bt_ctf_event_class_common_validate_single_clock_class(
                struct bt_ctf_event_class_common *event_class,
                struct bt_ctf_clock_class **expected_clock_class)
 {
        int ret = 0;
 
-       BT_ASSERT(event_class);
-       BT_ASSERT(expected_clock_class);
+       BT_ASSERT_DBG(event_class);
+       BT_ASSERT_DBG(expected_clock_class);
        ret = bt_ctf_field_type_common_validate_single_clock_class(
                event_class->context_field_type,
                expected_clock_class);
@@ -190,6 +169,7 @@ void bt_ctf_event_class_destroy(struct bt_ctf_object *obj)
        g_free(obj);
 }
 
+BT_EXPORT
 struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name)
 {
        struct bt_ctf_event_class *ctf_event_class = NULL;
@@ -225,28 +205,33 @@ end:
        return ctf_event_class;
 }
 
+BT_EXPORT
 const char *bt_ctf_event_class_get_name(struct bt_ctf_event_class *event_class)
 {
        return bt_ctf_event_class_common_get_name(BT_CTF_TO_COMMON(event_class));
 }
 
+BT_EXPORT
 int64_t bt_ctf_event_class_get_id(struct bt_ctf_event_class *event_class)
 {
        return bt_ctf_event_class_common_get_id(BT_CTF_TO_COMMON(event_class));
 }
 
+BT_EXPORT
 int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class,
                uint64_t id)
 {
        return bt_ctf_event_class_common_set_id(BT_CTF_TO_COMMON(event_class), id);
 }
 
+BT_EXPORT
 enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
                struct bt_ctf_event_class *event_class)
 {
        return bt_ctf_event_class_common_get_log_level(BT_CTF_TO_COMMON(event_class));
 }
 
+BT_EXPORT
 int bt_ctf_event_class_set_log_level(struct bt_ctf_event_class *event_class,
                enum bt_ctf_event_class_log_level log_level)
 {
@@ -254,12 +239,14 @@ int bt_ctf_event_class_set_log_level(struct bt_ctf_event_class *event_class,
                log_level);
 }
 
+BT_EXPORT
 const char *bt_ctf_event_class_get_emf_uri(
                struct bt_ctf_event_class *event_class)
 {
        return bt_ctf_event_class_common_get_emf_uri(BT_CTF_TO_COMMON(event_class));
 }
 
+BT_EXPORT
 int bt_ctf_event_class_set_emf_uri(struct bt_ctf_event_class *event_class,
                const char *emf_uri)
 {
@@ -267,6 +254,7 @@ int bt_ctf_event_class_set_emf_uri(struct bt_ctf_event_class *event_class,
                emf_uri);
 }
 
+BT_EXPORT
 struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
                struct bt_ctf_event_class *event_class)
 {
@@ -275,6 +263,7 @@ struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
                BT_CTF_TO_COMMON(event_class)));
 }
 
+BT_EXPORT
 struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type(
                struct bt_ctf_event_class *event_class)
 {
@@ -282,6 +271,7 @@ struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type(
                BT_CTF_TO_COMMON(event_class)));
 }
 
+BT_EXPORT
 int bt_ctf_event_class_set_payload_field_type(
                struct bt_ctf_event_class *event_class,
                struct bt_ctf_field_type *field_type)
@@ -290,6 +280,7 @@ int bt_ctf_event_class_set_payload_field_type(
                BT_CTF_TO_COMMON(event_class), (void *) field_type);
 }
 
+BT_EXPORT
 struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type(
                struct bt_ctf_event_class *event_class)
 {
@@ -297,6 +288,7 @@ struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type(
                BT_CTF_TO_COMMON(event_class)));
 }
 
+BT_EXPORT
 int bt_ctf_event_class_set_context_field_type(
                struct bt_ctf_event_class *event_class,
                struct bt_ctf_field_type *field_type)
@@ -305,6 +297,7 @@ int bt_ctf_event_class_set_context_field_type(
                BT_CTF_TO_COMMON(event_class), (void *) field_type);
 }
 
+BT_EXPORT
 int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class,
                struct bt_ctf_field_type *type,
                const char *name)
@@ -347,7 +340,7 @@ int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class,
                goto end;
        }
 
-       BT_ASSERT(bt_ctf_field_type_common_get_type_id(
+       BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id(
                event_class->common.payload_field_type) ==
                BT_CTF_FIELD_TYPE_ID_STRUCT);
        ret = bt_ctf_field_type_structure_add_field(
@@ -362,6 +355,7 @@ end:
        return ret;
 }
 
+BT_EXPORT
 int64_t bt_ctf_event_class_get_payload_type_field_count(
                struct bt_ctf_event_class *event_class)
 {
@@ -382,7 +376,7 @@ int64_t bt_ctf_event_class_get_payload_type_field_count(
                goto end;
        }
 
-       BT_ASSERT(bt_ctf_field_type_common_get_type_id(
+       BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id(
                event_class->common.payload_field_type) ==
                        BT_CTF_FIELD_TYPE_ID_STRUCT);
        ret = bt_ctf_field_type_common_structure_get_field_count(
@@ -391,6 +385,7 @@ end:
        return ret;
 }
 
+BT_EXPORT
 int bt_ctf_event_class_get_payload_type_field_by_index(
                struct bt_ctf_event_class *event_class,
                const char **field_name, struct bt_ctf_field_type **field_type,
@@ -413,7 +408,7 @@ int bt_ctf_event_class_get_payload_type_field_by_index(
                goto end;
        }
 
-       BT_ASSERT(bt_ctf_field_type_common_get_type_id(
+       BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id(
                event_class->common.payload_field_type) ==
                        BT_CTF_FIELD_TYPE_ID_STRUCT);
        ret = bt_ctf_field_type_structure_get_field_by_index(
@@ -424,6 +419,7 @@ end:
        return ret;
 }
 
+BT_EXPORT
 struct bt_ctf_field_type *
 bt_ctf_event_class_get_payload_type_field_type_by_name(
                struct bt_ctf_event_class *event_class, const char *name)
@@ -446,7 +442,7 @@ bt_ctf_event_class_get_payload_type_field_type_by_name(
                goto end;
        }
 
-       BT_ASSERT(bt_ctf_field_type_common_get_type_id(
+       BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id(
                event_class->common.payload_field_type) ==
                        BT_CTF_FIELD_TYPE_ID_STRUCT);
        name_quark = g_quark_try_string(name);
@@ -467,15 +463,14 @@ end:
        return field_type;
 }
 
-BT_HIDDEN
 int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class,
                struct metadata_context *context)
 {
        int ret = 0;
        struct bt_ctf_value *attr_value = NULL;
 
-       BT_ASSERT(event_class);
-       BT_ASSERT(context);
+       BT_ASSERT_DBG(event_class);
+       BT_ASSERT_DBG(context);
        BT_LOGD("Serializing event class's metadata: "
                "event-class-addr=%p, event-class-name=\"%s\", "
                "event-class-id=%" PRId64 ", metadata-context-addr=%p",
@@ -488,7 +483,7 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class,
        /* Serialize attributes */
        g_string_append_printf(context->string, "\tname = \"%s\";\n",
                event_class->common.name->str);
-       BT_ASSERT(event_class->common.id >= 0);
+       BT_ASSERT_DBG(event_class->common.id >= 0);
        g_string_append_printf(context->string, "\tid = %" PRId64 ";\n",
                event_class->common.id);
        g_string_append_printf(context->string, "\tstream_id = %" PRId64 ";\n",
@@ -545,6 +540,7 @@ end:
        return ret;
 }
 
+BT_EXPORT
 struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
                struct bt_ctf_event_class *event_class, const char *name)
 {
@@ -567,7 +563,7 @@ struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
                goto end;
        }
 
-       BT_ASSERT(event_class->common.payload_field_type->id ==
+       BT_ASSERT_DBG(event_class->common.payload_field_type->id ==
                BT_CTF_FIELD_TYPE_ID_STRUCT);
        name_quark = g_quark_try_string(name);
        if (!name_quark) {
This page took 0.027976 seconds and 4 git commands to generate.