fix/breakage API : replace bt_ctf_event
authorJulien Desfossez <julien.desfossez@efficios.com>
Fri, 30 Mar 2012 19:50:12 +0000 (15:50 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 30 Mar 2012 19:50:12 +0000 (15:50 -0400)
Following the namespace cleanup, the bt_ctf_event structure is now a
ctf_event_definition structure. Users of the API only have to do this
substitution.

Signed-off-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace.c
formats/ctf/callbacks.c
formats/ctf/events.c
formats/ctf/iterator.c
include/babeltrace/context.h
include/babeltrace/ctf/callbacks-internal.h
include/babeltrace/ctf/callbacks.h
include/babeltrace/ctf/events-internal.h
include/babeltrace/ctf/events.h
include/babeltrace/ctf/iterator.h
include/babeltrace/trace-handle.h

index aadeb441cf18ed81fa4a43b14d77e8d27389af72..fc590ecc50134b10a30ccde0d36c008d1b6aa2b3 100644 (file)
@@ -407,7 +407,7 @@ int convert_trace(struct trace_descriptor *td_write,
        struct bt_ctf_iter *iter;
        struct ctf_text_stream_pos *sout;
        struct bt_iter_pos begin_pos;
-       struct bt_ctf_event *ctf_event;
+       struct ctf_event_definition *ctf_event;
        int ret;
 
        sout = container_of(td_write, struct ctf_text_stream_pos,
index 0b4da9c5599c4e2b995e0c41553f2babda53a231..8e0d61e62e36d2c2de9ff451ace8ebcc91cf7551 100644 (file)
@@ -64,7 +64,7 @@ struct bt_dependencies *babeltrace_dependencies_create(const char *first, ...)
  */
 int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,
                bt_intern_str event, void *private_data, int flags,
-               enum bt_cb_ret (*callback)(struct bt_ctf_event *ctf_data,
+               enum bt_cb_ret (*callback)(struct ctf_event_definition *ctf_data,
                                           void *private_data),
                struct bt_dependencies *depends,
                struct bt_dependencies *weak_depends,
@@ -179,10 +179,9 @@ void process_callbacks(struct bt_ctf_iter *iter,
        struct bt_callback *cb;
        int i;
        enum bt_cb_ret ret;
-       struct bt_ctf_event ctf_data;
+       struct ctf_event_definition *ctf_data;
 
-       ctf_data.event = extract_ctf_stream_event(stream);
-       ctf_data.stream = stream;
+       ctf_data = extract_ctf_stream_event(stream);
 
        /* process all events callback first */
        if (iter->main_callbacks.callback) {
@@ -190,7 +189,7 @@ void process_callbacks(struct bt_ctf_iter *iter,
                        cb = &g_array_index(iter->main_callbacks.callback, struct bt_callback, i);
                        if (!cb)
                                goto end;
-                       ret = cb->callback(&ctf_data, cb->private_data);
+                       ret = cb->callback(ctf_data, cb->private_data);
                        switch (ret) {
                        case BT_CB_OK_STOP:
                        case BT_CB_ERROR_STOP:
@@ -218,7 +217,7 @@ void process_callbacks(struct bt_ctf_iter *iter,
                cb = &g_array_index(bt_chain->callback, struct bt_callback, i);
                if (!cb)
                        goto end;
-               ret = cb->callback(&ctf_data, cb->private_data);
+               ret = cb->callback(ctf_data, cb->private_data);
                switch (ret) {
                case BT_CB_OK_STOP:
                case BT_CB_ERROR_STOP:
index 71665ce01442aeadf3af2d276014eb797faf1b46..714216f3a66ff608ea11799e832388214f544feb 100644 (file)
@@ -38,7 +38,7 @@
  */
 __thread int bt_ctf_last_field_error = 0;
 
-const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_top_level_scope(const struct ctf_event_definition *event,
                enum bt_ctf_scope scope)
 {
        struct definition *tmp = NULL;
@@ -69,16 +69,12 @@ const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *e
                        tmp = &event->stream->stream_event_context->p;
                break;
        case BT_EVENT_CONTEXT:
-               if (!event->event)
-                       goto error;
-               if (event->event->event_context)
-                       tmp = &event->event->event_context->p;
+               if (event->event_context)
+                       tmp = &event->event_context->p;
                break;
        case BT_EVENT_FIELDS:
-               if (!event->event)
-                       goto error;
-               if (event->event->event_fields)
-                       tmp = &event->event->event_fields->p;
+               if (event->event_fields)
+                       tmp = &event->event_fields->p;
                break;
        }
        return tmp;
@@ -87,7 +83,7 @@ error:
        return NULL;
 }
 
-const struct definition *bt_ctf_get_field(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_field(const struct ctf_event_definition *event,
                const struct definition *scope,
                const char *field)
 {
@@ -118,7 +114,7 @@ const struct definition *bt_ctf_get_field(const struct bt_ctf_event *event,
        return NULL;
 }
 
-const struct definition *bt_ctf_get_index(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_index(const struct ctf_event_definition *event,
                const struct definition *field,
                unsigned int index)
 {
@@ -138,7 +134,7 @@ const struct definition *bt_ctf_get_index(const struct bt_ctf_event *event,
        return ret;
 }
 
-const char *bt_ctf_event_name(const struct bt_ctf_event *event)
+const char *bt_ctf_event_name(const struct ctf_event_definition *event)
 {
        struct ctf_event_declaration *event_class;
        struct ctf_stream_declaration *stream_class;
@@ -165,7 +161,7 @@ enum ctf_type_id bt_ctf_field_type(const struct definition *def)
        return CTF_TYPE_UNKNOWN;
 }
 
-int bt_ctf_get_field_list(const struct bt_ctf_event *event,
+int bt_ctf_get_field_list(const struct ctf_event_definition *event,
                const struct definition *scope,
                struct definition const * const **list,
                unsigned int *count)
@@ -251,7 +247,7 @@ error:
        return -1;
 }
 
-struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *event)
+struct bt_context *bt_ctf_event_get_context(const struct ctf_event_definition *event)
 {
        struct bt_context *ret = NULL;
        struct ctf_file_stream *cfs;
@@ -266,7 +262,7 @@ struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *event)
        return ret;
 }
 
-int bt_ctf_event_get_handle_id(const struct bt_ctf_event *event)
+int bt_ctf_event_get_handle_id(const struct ctf_event_definition *event)
 {
        int ret = -1;
        struct ctf_file_stream *cfs;
@@ -281,7 +277,7 @@ int bt_ctf_event_get_handle_id(const struct bt_ctf_event *event)
        return ret;
 }
 
-uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *event)
+uint64_t bt_ctf_get_timestamp_raw(const struct ctf_event_definition *event)
 {
        if (event && event->stream->has_timestamp)
                return ctf_get_timestamp_raw(event->stream,
@@ -290,7 +286,7 @@ uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *event)
                return -1ULL;
 }
 
-uint64_t bt_ctf_get_timestamp(const struct bt_ctf_event *event)
+uint64_t bt_ctf_get_timestamp(const struct ctf_event_definition *event)
 {
        if (event && event->stream->has_timestamp)
                return ctf_get_timestamp(event->stream,
index 3597010a5b0b6d36a5c5b98bfc1028f19552bb5d..5cc7dbad14de5d79ae66ba0fcffefba055983b1e 100644 (file)
@@ -86,19 +86,20 @@ struct bt_iter *bt_ctf_get_iter(struct bt_ctf_iter *iter)
        return &iter->parent;
 }
 
-struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter)
+struct ctf_event_definition *bt_ctf_iter_read_event(struct bt_ctf_iter *iter)
 {
        struct ctf_file_stream *file_stream;
-       struct bt_ctf_event *ret = &iter->current_ctf_event;
+       struct ctf_event_definition *ret = &iter->current_ctf_event;
+       struct ctf_stream_definition *stream;
 
        file_stream = heap_maximum(iter->parent.stream_heap);
        if (!file_stream) {
                /* end of file for all streams */
                goto stop;
        }
-       ret->stream = &file_stream->parent;
-       ret->event = g_ptr_array_index(ret->stream->events_by_id,
-                       ret->stream->event_id);
+       stream = &file_stream->parent;
+       ret = g_ptr_array_index(stream->events_by_id,
+                       stream->event_id);
 
        if (ret->stream->stream_id > iter->callbacks->len)
                goto end;
index 4a85ff9966162aefa6c61b757ff510a62a659dec..9fa22fbf447ecd4ad27ac491c66e2e7ab6b7d5af 100644 (file)
@@ -29,7 +29,7 @@
 /* struct bt_context is opaque to the user */
 struct bt_context;
 struct stream_pos;
-struct bt_ctf_event;
+struct ctf_event_definition;
 
 /*
  * bt_context_create : create a Babeltrace context
@@ -102,6 +102,6 @@ void bt_context_put(struct bt_context *ctx);
  *
  * Returns NULL on error
  */
-struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *event);
+struct bt_context *bt_ctf_event_get_context(const struct ctf_event_definition *event);
 
 #endif /* _BABELTRACE_CONTEXT_H */
index b76f82e180ce8ea208ef0b0a7508470a3fcb6872..e9528da5b61c690ba896626e792b251914580d90 100644 (file)
@@ -31,7 +31,7 @@ struct bt_callback {
        struct bt_dependencies *depends;
        struct bt_dependencies *weak_depends;
        struct bt_dependencies *provides;
-       enum bt_cb_ret (*callback)(struct bt_ctf_event *ctf_data,
+       enum bt_cb_ret (*callback)(struct ctf_event_definition *ctf_data,
                                   void *private_data);
 };
 
index 328762ca14c3e968b10aa62a5c8a26ff202ad73d..43d7af1caeeec9804bcb123ab64f843a7c21c7f3 100644 (file)
@@ -84,7 +84,7 @@ void babeltrace_dependencies_destroy(struct bt_dependencies *dep);
  */
 int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,
                bt_intern_str event, void *private_data, int flags,
-               enum bt_cb_ret (*callback)(struct bt_ctf_event *ctf_data,
+               enum bt_cb_ret (*callback)(struct ctf_event_definition *ctf_data,
                                           void *caller_data),
                struct bt_dependencies *depends,
                struct bt_dependencies *weak_depends,
index 2ff37545ffb0ff984373d7223fbd9b68c07166ba..bd50100d0ea37a7fed53d116f335f3a5e66d2aaf 100644 (file)
 #include <babeltrace/iterator-internal.h>
 #include <babeltrace/ctf/callbacks.h>
 #include <babeltrace/ctf/callbacks-internal.h>
+#include <babeltrace/ctf-ir/metadata.h>
 #include <glib.h>
 
 struct ctf_stream_definition;
-struct ctf_event_definition;
-/*
- * the structure to manipulate events
- */
-struct bt_ctf_event {
-       struct ctf_stream_definition *stream;
-       struct ctf_event_definition *event;
-};
 
 struct bt_ctf_iter {
        struct bt_iter parent;
-       struct bt_ctf_event current_ctf_event;  /* last read event */
+       struct ctf_event_definition current_ctf_event;  /* last read event */
        GArray *callbacks;                              /* Array of struct bt_stream_callbacks */
        struct bt_callback_chain main_callbacks;        /* For all events */
        /*
index 80fbdcf2f5b634b9a720bec49c3aa8f69edd384e..2fc82db26281fa72aa6ed2bb4866e277d663b215 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdint.h>
 
 struct definition;
-struct bt_ctf_event;
+struct ctf_event_definition;
 
 /*
  * the top-level scopes in CTF
@@ -77,32 +77,32 @@ enum ctf_string_encoding {
  * between the enum and the actual definition of top-level scopes.
  * On error return NULL.
  */
-const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_top_level_scope(const struct ctf_event_definition *event,
                enum bt_ctf_scope scope);
 
 /*
  * bt_ctf_event_get_name: returns the name of the event or NULL on error
  */
-const char *bt_ctf_event_name(const struct bt_ctf_event *event);
+const char *bt_ctf_event_name(const struct ctf_event_definition *event);
 
 /*
  * bt_ctf_get_timestamp_raw: returns the timestamp of the event as written in
  * the packet or -1ULL on error
  */
-uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *event);
+uint64_t bt_ctf_get_timestamp_raw(const struct ctf_event_definition *event);
 
 /*
  * bt_ctf_get_timestamp: returns the timestamp of the event offsetted with the
  * system clock source or -1ULL on error
  */
-uint64_t bt_ctf_get_timestamp(const struct bt_ctf_event *event);
+uint64_t bt_ctf_get_timestamp(const struct ctf_event_definition *event);
 
 /*
  * bt_ctf_get_field_list: set list pointer to an array of definition
  * pointers and set count to the number of elements in the array.
  * Return 0 on success and a negative value on error.
  */
-int bt_ctf_get_field_list(const struct bt_ctf_event *event,
+int bt_ctf_get_field_list(const struct ctf_event_definition *event,
                const struct definition *scope,
                struct definition const * const **list,
                unsigned int *count);
@@ -110,7 +110,7 @@ int bt_ctf_get_field_list(const struct bt_ctf_event *event,
 /*
  * bt_ctf_get_field: returns the definition of a specific field
  */
-const struct definition *bt_ctf_get_field(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_field(const struct ctf_event_definition *event,
                const struct definition *scope,
                const char *field);
 
@@ -118,7 +118,7 @@ const struct definition *bt_ctf_get_field(const struct bt_ctf_event *event,
  * bt_ctf_get_index: if the field is an array or a sequence, return the element
  * at position index, otherwise return NULL;
  */
-const struct definition *bt_ctf_get_index(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_index(const struct ctf_event_definition *event,
                const struct definition *field,
                unsigned int index);
 
index 1071def852749d3a4abee44a346e2280dd2d7452..7aeb032c81f23e506edcb9392b7574f85e0152f5 100644 (file)
@@ -26,7 +26,7 @@
 #include <babeltrace/iterator.h>
 
 struct bt_ctf_iter;
-struct bt_ctf_event;
+struct ctf_event_definition;
 
 /*
  * bt_ctf_iter_create - Allocate a CTF trace collection iterator.
@@ -68,6 +68,6 @@ void bt_ctf_iter_destroy(struct bt_ctf_iter *iter);
  *
  * Return current event on success, NULL on end of trace.
  */
-struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
+struct ctf_event_definition *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
 
 #endif /* _BABELTRACE_CTF_ITERATOR_H */
index 31877ee1886a681165d25fdd9d2b2b94e9252af9..0c83bf744fe100fb840edbd92629898dbaaa36b5 100644 (file)
@@ -31,7 +31,7 @@
  * It is a unique identifier representing a trace file.
  */
 struct bt_trace_handle;
-struct bt_ctf_event;
+struct ctf_event_definition;
 
 /*
  * bt_trace_handle_get_path : returns the path of a trace_handle.
@@ -55,6 +55,6 @@ uint64_t bt_trace_handle_get_timestamp_end(struct bt_context *ctx, int handle_id
  *
  * Returns -1 on error
  */
-int bt_ctf_event_get_handle_id(const struct bt_ctf_event *event);
+int bt_ctf_event_get_handle_id(const struct ctf_event_definition *event);
 
 #endif /* _BABELTRACE_TRACE_HANDLE_H */
This page took 0.032315 seconds and 4 git commands to generate.