Decouple component class from plugin subsystem, remove component factory
[babeltrace.git] / plugins / writer / writer.c
index ad268ebf74aa6fc28c4615fb901ff9004031c89d..e8b1fefdba118920d20f08a93834fb236da60823 100644 (file)
  */
 
 #include <babeltrace/ctf-ir/packet.h>
-#include <babeltrace/plugin/plugin-macros.h>
-#include <babeltrace/plugin/component.h>
-#include <babeltrace/plugin/sink.h>
-#include <babeltrace/plugin/notification/notification.h>
-#include <babeltrace/plugin/notification/iterator.h>
-#include <babeltrace/plugin/notification/event.h>
-#include <babeltrace/plugin/notification/packet.h>
+#include <babeltrace/plugin/plugin-dev.h>
+#include <babeltrace/component/component.h>
+#include <babeltrace/component/sink.h>
+#include <babeltrace/component/notification/notification.h>
+#include <babeltrace/component/notification/iterator.h>
+#include <babeltrace/component/notification/event.h>
+#include <babeltrace/component/notification/packet.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <glib.h>
@@ -126,10 +126,10 @@ enum bt_component_status handle_notification(
        }
 
        switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_START:
+       case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
        {
                struct bt_ctf_packet *packet =
-                       bt_notification_packet_start_get_packet(notification);
+                       bt_notification_packet_begin_get_packet(notification);
 
                if (!packet) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -143,7 +143,7 @@ enum bt_component_status handle_notification(
        case BT_NOTIFICATION_TYPE_PACKET_END:
        {
                struct bt_ctf_packet *packet =
-                       bt_notification_packet_start_get_packet(notification);
+                       bt_notification_packet_end_get_packet(notification);
 
                if (!packet) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -193,17 +193,17 @@ enum bt_component_status run(struct bt_component *component)
                goto end;
        }
 
-       ret = bt_notification_iterator_next(it);
-       if (ret != BT_COMPONENT_STATUS_OK) {
-               goto end;
-       }
-
        notification = bt_notification_iterator_get_notification(it);
        if (!notification) {
                ret = BT_COMPONENT_STATUS_ERROR;
                goto end;
        }
 
+       ret = bt_notification_iterator_next(it);
+       if (ret != BT_COMPONENT_STATUS_OK) {
+               goto end;
+       }
+
        ret = handle_notification(writer_component, notification);
 end:
        bt_put(it);
@@ -278,7 +278,6 @@ BT_PLUGIN_AUTHOR("Jérémie Galarneau");
 BT_PLUGIN_LICENSE("MIT");
 
 BT_PLUGIN_COMPONENT_CLASSES_BEGIN
-BT_PLUGIN_SINK_COMPONENT_CLASS_ENTRY("writer",
-               "Formats CTF-IR to CTF.",
+BT_PLUGIN_COMPONENT_CLASS_SINK_ENTRY("writer", "Formats CTF-IR to CTF.",
                writer_component_init)
 BT_PLUGIN_COMPONENT_CLASSES_END
This page took 0.02455 seconds and 4 git commands to generate.