Visibility hidden by default
[babeltrace.git] / src / lib / trace-ir / event.h
index b1fb2313034b08a8d88e27e6dfbb1ab1dd06986c..251d49ec83173c66a2f19700aa5595e1eb43f992 100644 (file)
@@ -1,35 +1,19 @@
-#ifndef BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
-#define BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
-
 /*
+ * SPDX-License-Identifier: MIT
+ *
  * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
  * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@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.
  */
 
+#ifndef BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
+#define BABELTRACE_TRACE_IR_EVENT_INTERNAL_H
+
 /* Protection: this file uses BT_LIB_LOG*() macros directly */
 #ifndef BT_LIB_LOG_SUPPORTED
 # error Please include "lib/logging.h" before including this file.
 #endif
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/macros.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/trace-ir/stream-class.h>
@@ -69,13 +53,10 @@ struct bt_event {
        bool frozen;
 };
 
-BT_HIDDEN
 void bt_event_destroy(struct bt_event *event);
 
-BT_HIDDEN
 struct bt_event *bt_event_new(struct bt_event_class *event_class);
 
-BT_HIDDEN
 void _bt_event_set_is_frozen(const struct bt_event *event, bool is_frozen);
 
 #ifdef BT_DEV_MODE
@@ -169,73 +150,4 @@ void bt_event_recycle(struct bt_event *event)
        bt_object_put_ref_no_null_check(&event_class->base);
 }
 
-static inline
-void bt_event_set_packet(struct bt_event *event, struct bt_packet *packet)
-{
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
-       BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet");
-       BT_ASSERT_PRE_DEV_EVENT_HOT(event);
-       BT_ASSERT_PRE_DEV(bt_event_class_borrow_stream_class(
-               event->class) == packet->stream->class,
-               "Packet's stream class and event's stream class differ: "
-               "%![event-]+e, %![packet-]+a", event, packet);
-       BT_ASSERT_DBG(event->stream->class->supports_packets);
-       BT_ASSERT_DBG(!event->packet);
-       event->packet = packet;
-       bt_object_get_ref_no_null_check_no_parent_check(&event->packet->base);
-       BT_LIB_LOGD("Set event's packet: %![event-]+e, %![packet-]+a",
-               event, packet);
-}
-
-static inline
-void bt_event_set_stream(struct bt_event *event, struct bt_stream *stream)
-{
-       BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
-       BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream");
-       BT_ASSERT_PRE_DEV_EVENT_HOT(event);
-       BT_ASSERT_PRE_DEV(bt_event_class_borrow_stream_class(
-               event->class) == stream->class,
-               "Stream's class and event's stream class differ: "
-               "%![event-]+e, %![stream-]+s", event, stream);
-       BT_ASSERT_DBG(!event->stream);
-       event->stream = stream;
-       bt_object_get_ref_no_null_check_no_parent_check(&event->stream->base);
-       BT_LIB_LOGD("Set event's stream: %![event-]+e, %![stream-]+s",
-               event, stream);
-}
-
-static inline
-struct bt_event *bt_event_create(struct bt_event_class *event_class,
-               struct bt_packet *packet, struct bt_stream *stream)
-{
-       struct bt_event *event = NULL;
-
-       BT_ASSERT_DBG(event_class);
-       BT_ASSERT_DBG(stream);
-       event = bt_object_pool_create_object(&event_class->event_pool);
-       if (G_UNLIKELY(!event)) {
-               BT_LIB_LOGE_APPEND_CAUSE(
-                       "Cannot allocate one event from event class's event pool: "
-                       "%![ec-]+E", event_class);
-               goto end;
-       }
-
-       if (G_LIKELY(!event->class)) {
-               event->class = event_class;
-               bt_object_get_ref_no_null_check(&event_class->base);
-       }
-
-       bt_event_set_stream(event, stream);
-
-       if (packet) {
-               BT_ASSERT_DBG(packet);
-               bt_event_set_packet(event, packet);
-       }
-
-       goto end;
-
-end:
-       return event;
-}
-
 #endif /* BABELTRACE_TRACE_IR_EVENT_INTERNAL_H */
This page took 0.025441 seconds and 4 git commands to generate.