X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf%2Fevents.h;h=c08314f8775bbb6d0418b9f7011ccc0c30fb04f1;hb=badea1a2413e25f0b1961770148e28deba8a3a3f;hp=eb644125c69a9875b0875c9f60aa7fecd5ad5824;hpb=9843982dca5a80c001fc5989a9ce5a2283b0740f;p=babeltrace.git diff --git a/include/babeltrace/ctf/events.h b/include/babeltrace/ctf/events.h index eb644125..c08314f8 100644 --- a/include/babeltrace/ctf/events.h +++ b/include/babeltrace/ctf/events.h @@ -24,10 +24,12 @@ */ #include +#include struct ctf_stream; struct ctf_stream_event; struct definition; +struct bt_ctf_iter; /* * the top-level scopes in CTF @@ -66,6 +68,42 @@ struct bt_ctf_event { struct ctf_stream_event *event; }; +/* + * bt_ctf_iter_read_event: Read the iterator's current event data. + * + * @iter: trace collection iterator (input) + * @stream: stream containing event at current position (output) + * @event: current event (output) + * Return 0 on success, negative error value on error. + */ +struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter); + +/* + * bt_ctf_iter_create - Allocate a CTF trace collection iterator. + * + * begin_pos and end_pos are optional parameters to specify the position + * at which the trace collection should be seeked upon iterator + * creation, and the position at which iteration will start returning + * "EOF". + * + * By default, if begin_pos is NULL, a BT_SEEK_CUR is performed at + * creation. By default, if end_pos is NULL, a BT_SEEK_END (end of + * trace) is the EOF criterion. + */ +struct bt_ctf_iter *bt_ctf_iter_create(struct bt_context *ctx, + struct bt_iter_pos *begin_pos, + struct bt_iter_pos *end_pos); + +/* + * bt_ctf_get_iter - get iterator from ctf iterator. + */ +struct bt_iter *bt_ctf_get_iter(struct bt_ctf_iter *iter); + +/* + * bt_ctf_iter_destroy - Free a CTF trace collection iterator. + */ +void bt_ctf_iter_destroy(struct bt_ctf_iter *iter); + /* * bt_ctf_get_top_level_scope: return a definition of the top-level scope * @@ -90,9 +128,9 @@ const char *bt_ctf_event_name(struct bt_ctf_event *event); uint64_t bt_ctf_get_timestamp(struct bt_ctf_event *event); /* - * bt_ctf_get_field_list: returns an array of *def pointing to each field of - * the event. The array is NULL terminated. - * On error : return NULL. + * 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(struct bt_ctf_event *event, struct definition *scope, @@ -122,7 +160,7 @@ const char *bt_ctf_field_name(const struct definition *def); /* * bt_ctf_field_type: returns the type of a field or -1 if unknown */ -enum ctf_type_id bt_ctf_field_type(struct definition *def); +enum ctf_type_id bt_ctf_field_type(const struct definition *def); /* * Field access functions @@ -134,10 +172,10 @@ enum ctf_type_id bt_ctf_field_type(struct definition *def); * returned is undefined. To check if an error occured, use the * bt_ctf_field_error() function after accessing a field. */ -uint64_t bt_ctf_get_uint64(struct definition *field); -int64_t bt_ctf_get_int64(struct definition *field); -char *bt_ctf_get_char_array(struct definition *field); -char *bt_ctf_get_string(struct definition *field); +uint64_t bt_ctf_get_uint64(const struct definition *field); +int64_t bt_ctf_get_int64(const struct definition *field); +char *bt_ctf_get_char_array(const struct definition *field); +char *bt_ctf_get_string(const struct definition *field); /* * bt_ctf_field_error: returns the last error code encountered while