lib: graph: add "self" and some "private" APIs
[babeltrace.git] / lib / graph / notification / inactivity.c
index becf17e017e0e124730b640fc84270f6c3746982..2472cba1fa7ca657eedbc55e2c5d78d724338f84 100644 (file)
 #include <babeltrace/trace-ir/clock-class.h>
 #include <babeltrace/trace-ir/clock-value-internal.h>
 #include <babeltrace/graph/notification-internal.h>
+#include <babeltrace/graph/private-notification-inactivity.h>
 #include <babeltrace/graph/notification-inactivity-internal.h>
-#include <babeltrace/graph/private-connection-private-notification-iterator.h>
 #include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/object.h>
 
 static
 void bt_notification_inactivity_destroy(struct bt_object *obj)
@@ -38,7 +39,7 @@ void bt_notification_inactivity_destroy(struct bt_object *obj)
        struct bt_notification_inactivity *notification =
                        (struct bt_notification_inactivity *) obj;
 
-       BT_LOGD("Destroying inactivity notification: addr=%p", notification);
+       BT_LIB_LOGD("Destroying inactivity notification: %!+n", notification);
 
        if (notification->default_cv) {
                bt_clock_value_recycle(notification->default_cv);
@@ -47,16 +48,20 @@ void bt_notification_inactivity_destroy(struct bt_object *obj)
        g_free(notification);
 }
 
-struct bt_notification *bt_notification_inactivity_create(
-               struct bt_private_connection_private_notification_iterator *notif_iter,
+struct bt_private_notification *bt_private_notification_inactivity_create(
+               struct bt_self_notification_iterator *self_notif_iter,
                struct bt_clock_class *default_clock_class)
 {
+       struct bt_self_component_port_input_notification_iterator *notif_iter =
+               (void *) self_notif_iter;
        struct bt_notification_inactivity *notification;
        struct bt_notification *ret_notif = NULL;
 
        BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator");
        BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class");
-       BT_LOGD_STR("Creating inactivity notification object.");
+       BT_LIB_LOGD("Creating inactivity notification object: "
+               "%![iter-]+i, %![default-cc-]+K", notif_iter,
+               default_clock_class);
        notification = g_new0(struct bt_notification_inactivity, 1);
        if (!notification) {
                BT_LOGE_STR("Failed to allocate one inactivity notification.");
@@ -71,20 +76,21 @@ struct bt_notification *bt_notification_inactivity_create(
                goto error;
        }
 
-       BT_LOGD("Created inactivity notification object: addr=%p",
-               ret_notif);
+       BT_LIB_LOGD("Created inactivity notification object: %!+n", ret_notif);
        goto end;
 
 error:
-       BT_PUT(ret_notif);
+       BT_OBJECT_PUT_REF_AND_RESET(ret_notif);
 
 end:
-       return ret_notif;
+       return (void *) ret_notif;
 }
 
-int bt_notification_inactivity_set_default_clock_value(
-               struct bt_notification *notif, uint64_t value_cycles)
+int bt_private_notification_inactivity_set_default_clock_value(
+               struct bt_private_notification *priv_notif,
+               uint64_t value_cycles)
 {
+       struct bt_notification *notif = (void *) priv_notif;
        struct bt_notification_inactivity *inactivity = (void *) notif;
 
        BT_ASSERT_PRE_NON_NULL(notif, "Notification");
This page took 0.024713 seconds and 4 git commands to generate.