7 * Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
20 /* Forward declarations */
21 struct babeltrace_iter
;
22 struct babeltrace_iter_pos
;
23 struct babeltrace_iter_stream_pos
;
24 struct trace_collection
;
25 struct ctf_stream_event
;
29 * babeltrace_iter_create - Allocate a trace collection iterator.
31 struct babeltrace_iter
*babeltrace_iter_create(struct trace_collection
*tc
);
34 * babeltrace_iter_destroy - Free a trace collection iterator.
36 void babeltrace_iter_destroy(struct babeltrace_iter
*iter
);
39 * babeltrace_iter_next: Move trace collection position to the next event.
41 * Returns 0 on success, a negative value on error
43 int babeltrace_iter_next(struct babeltrace_iter
*iter
);
46 * babeltrace_iter_get_pos - Get the current trace collection position.
48 * The position returned by this function needs to be freed by
49 * babeltrace_iter_free_pos after use.
51 struct babeltrace_iter_pos
*
52 babeltrace_iter_get_pos(struct babeltrace_iter
*iter
);
55 * babeltrace_iter_free_pos - Free the position.
57 void babeltrace_iter_free_pos(struct babeltrace_iter_pos
*pos
);
60 * babeltrace_iter_seek_pos - Seek the trace collection to the position.
62 int babeltrace_iter_seek_pos(struct babeltrace_iter
*iter
,
63 struct babeltrace_iter_pos
*pos
);
66 * babeltrace_iter_seek_time: Seek the trace collection to the given timestamp.
68 * Return EOF if timestamp is after the last event of the trace collection.
69 * Return other negative value for other errors.
70 * Return 0 for success.
72 int babeltrace_iter_seek_time(struct babeltrace_iter
*iter
,
76 * babeltrace_iter_read_event: Read the iterator's current event data.
78 * @iter: trace collection iterator (input)
79 * @stream: stream containing event at current position (output)
80 * @event: current event (output)
81 * Return 0 on success, negative error value on error.
83 int babeltrace_iter_read_event(struct babeltrace_iter
*iter
,
84 struct ctf_stream
**stream
,
85 struct ctf_stream_event
**event
);
87 #endif /* _BABELTRACE_H */