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,
*/
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,
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) {
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:
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:
*/
__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;
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;
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)
{
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)
{
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;
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)
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;
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;
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,
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,
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;
/* 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
*
* 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 */
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);
};
*/
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,
#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 */
/*
#include <stdint.h>
struct definition;
-struct bt_ctf_event;
+struct ctf_event_definition;
/*
* the top-level scopes in CTF
* 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);
/*
* 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);
* 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);
#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.
*
* 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 */
* 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.
*
* 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 */