Automatically generate discarded packets/events notifications
[babeltrace.git] / include / babeltrace / graph / notification-internal.h
index 01eb59670cc3fb89802df7eb180c2b0f21c5b97e..4ffef1c504e3ec145ed3716fcf8229f84e5ade80 100644 (file)
  * SOFTWARE.
  */
 
-#include <stdbool.h>
 #include <babeltrace/ref-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/graph/notification.h>
 #include <babeltrace/ctf-ir/stream.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <babeltrace/types.h>
 
 typedef struct bt_ctf_stream *(*get_stream_func)(
                struct bt_notification *notification);
@@ -45,7 +41,7 @@ struct bt_notification {
        struct bt_object base;
        enum bt_notification_type type;
        get_stream_func get_stream;
-       bool frozen;
+       bt_bool frozen;
 };
 
 BT_HIDDEN
@@ -53,14 +49,40 @@ void bt_notification_init(struct bt_notification *notification,
                enum bt_notification_type type,
                bt_object_release_func release);
 
-BT_HIDDEN
 static inline void bt_notification_freeze(struct bt_notification *notification)
 {
-       notification->frozen = true;
+       notification->frozen = BT_TRUE;
 }
 
-#ifdef __cplusplus
+static inline
+const char *bt_notification_type_string(enum bt_notification_type type)
+{
+       switch (type) {
+       case BT_NOTIFICATION_TYPE_SENTINEL:
+               return "BT_NOTIFICATION_TYPE_SENTINEL";
+       case BT_NOTIFICATION_TYPE_UNKNOWN:
+               return "BT_NOTIFICATION_TYPE_UNKNOWN";
+       case BT_NOTIFICATION_TYPE_ALL:
+               return "BT_NOTIFICATION_TYPE_ALL";
+       case BT_NOTIFICATION_TYPE_EVENT:
+               return "BT_NOTIFICATION_TYPE_EVENT";
+       case BT_NOTIFICATION_TYPE_INACTIVITY:
+               return "BT_NOTIFICATION_TYPE_INACTIVITY";
+       case BT_NOTIFICATION_TYPE_STREAM_BEGIN:
+               return "BT_NOTIFICATION_TYPE_STREAM_BEGIN";
+       case BT_NOTIFICATION_TYPE_STREAM_END:
+               return "BT_NOTIFICATION_TYPE_STREAM_END";
+       case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
+               return "BT_NOTIFICATION_TYPE_PACKET_BEGIN";
+       case BT_NOTIFICATION_TYPE_PACKET_END:
+               return "BT_NOTIFICATION_TYPE_PACKET_END";
+       case BT_NOTIFICATION_TYPE_DISCARDED_EVENTS:
+               return "BT_NOTIFICATION_TYPE_DISCARDED_EVENTS";
+       case BT_NOTIFICATION_TYPE_DISCARDED_PACKETS:
+               return "BT_NOTIFICATION_TYPE_DISCARDED_PACKETS";
+       default:
+               return "(unknown)";
+       }
 }
-#endif
 
 #endif /* BABELTRACE_COMPONENT_NOTIFICATION_NOTIFICATION_INTERNAL_H */
This page took 0.038794 seconds and 4 git commands to generate.