Change "handler" terminology to the more specific listener
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 28 Jul 2016 21:27:57 +0000 (17:27 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 17:41:38 +0000 (13:41 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/trace.c
include/babeltrace/ctf-ir/trace-internal.h
include/babeltrace/ctf-ir/trace.h

index 2cbfdb4e0e878ef1938fb3729a081d49918ba55e..2b3fb0e65e580851e4cf690438ac8b07d54ee8d9 100644 (file)
@@ -48,8 +48,8 @@
 #define DEFAULT_IDENTIFIER_SIZE 128
 #define DEFAULT_METADATA_STRING_SIZE 4096
 
-struct notification_handler {
-       bt_ctf_notification_cb func;
+struct listener_wrapper {
+       bt_ctf_listener_cb listener;
        void *data;
 };
 
@@ -1099,31 +1099,35 @@ end:
        return ret;
 }
 
-int bt_ctf_trace_add_notification_handler_cb(struct bt_ctf_trace *trace,
-               bt_ctf_notification_cb handler, void *handler_data)
+int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace,
+               bt_ctf_listener_cb listener, void *listener_data)
 {
        int ret = 0;
-       struct notification_handler *handler_wrapper =
-                       g_new0(struct notification_handler, 1);
+       struct listener_wrapper *listener_wrapper =
+                       g_new0(struct listener_wrapper, 1);
 
-       if (!trace || !handler || !handler_wrapper) {
+       if (!trace || !listener || !listener_wrapper) {
                ret = -1;
                goto error;
        }
 
-       handler_wrapper->func = handler;
-       handler_wrapper->data = handler_data;
+       listener_wrapper->listener = listener;
+       listener_wrapper->data = listener_data;
 
-       /* Emit notifications describing the current schema. */
-       ret = bt_ctf_trace_visit(trace, ir_visitor, handler_wrapper);
+       /* Visit the current schema. */
+       ret = bt_ctf_trace_visit(trace, ir_visitor, listener_wrapper);
        if (ret) {
                goto error;
        }
 
-       g_ptr_array_add(trace->notification_handlers, handler_wrapper);
+       /*
+        * Add listener to the array of callbacks which will be invoked on
+        * schema changes.
+        */
+       g_ptr_array_add(trace->listeners, listener_wrapper);
        return ret;
 error:
-       g_free(handler_wrapper);
+       g_free(listener_wrapper);
        return ret;
 }
 
index c631b97d816f24dd75e29030aff023b29e896875..2ea7109788e533128cc7cd47d386a210275dc300 100644 (file)
@@ -65,7 +65,7 @@ struct bt_ctf_trace {
         * trace is _always_ frozen.
         */
        int valid;
-       GPtrArray *notification_handlers; /* Array of notification_handler */
+       GPtrArray *listeners; /* Array of struct listener_wrapper */
 };
 
 struct metadata_context {
index 39574f3a210dd50e999d9871bfd617820a4c2457..fae7832bd2a3dbda127d57892fdfcedcb4ffb104 100644 (file)
@@ -46,16 +46,15 @@ struct bt_ctf_stream_class;
 struct bt_ctf_clock;
 
 /**
- * Notification handling function type.
+ * Trace modification handling function type.
  *
- * A reference must be taken on the notification if the handler has to
- * keep ownership of the notification beyond the invocation of the callback.
+ * Callback invoked whenever an element is added to a trace's hierachy.
  *
- * @param notification Notification to handle
+ * @param element      New element
  * @param data         Handler private data
  */
-typedef void (*bt_ctf_notification_cb)(
-               struct bt_notification *notification, void *data);
+typedef void (*bt_ctf_listener_cb)(
+               struct bt_ctf_ir_element *element, void *data);
 
 /*
  * bt_ctf_trace_create: create a trace instance.
@@ -368,23 +367,23 @@ extern int bt_ctf_trace_visit(struct bt_ctf_trace *trace,
                bt_ctf_ir_visitor visitor, void *data);
 
 /*
- * bt_ctf_trace_add_notification_handler_cb: set a notification callback
+ * bt_ctf_trace_add_listener: add a trace modification listener
  * which will be invoked whenever a trace's schema is modified.
  *
- * Register a notification handler to a trace.
+ * Register a modification listener to a trace.
  *
  * @param trace Trace instance.
- * @param handler Notification handler to invoke on trace xmodification.
- * @param handler_data Private data passed to the notification handler.
+ * @param listener Callback to invoke on trace modification.
+ * @param listener_data Private data passed to the listener.
  *
  * Returns 0 on success, a negative value on error.
  *
- * Note: the notification handler will be used to serialize the trace's current
+ * Note: the listener will be used to serialize the trace's current
  * state on registration. It will then be invoked on any change occuring within
  * the trace's hierarchy.
  */
-extern int bt_ctf_trace_add_notification_handler_cb(struct bt_ctf_trace *trace,
-               bt_ctf_notification_cb handler, void *handler_data);
+extern int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace,
+               bt_ctf_listener_cb listener, void *listener_data);
 
 #ifdef __cplusplus
 }
This page took 0.027803 seconds and 4 git commands to generate.