ctf.fs: bt_ctf_notif_iter_create(): assert() that all medops exist
[babeltrace.git] / include / babeltrace / ctf / iterator.h
CommitLineData
c5498370
MD
1#ifndef _BABELTRACE_CTF_ITERATOR_H
2#define _BABELTRACE_CTF_ITERATOR_H
3
4/*
5 * BabelTrace
6 *
7 * CTF iterator API
8 *
9 * Copyright 2011-2012 EfficiOS Inc. and Linux Foundation
10 *
11 * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 * Julien Desfossez <julien.desfossez@efficios.com>
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining
15 * a copy of this software and associated documentation files (the
16 * "Software"), to deal in the Software without restriction, including
17 * without limitation the rights to use, copy, modify, merge, publish,
18 * distribute, sublicense, and/or sell copies of the Software, and to
19 * permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be
23 * included in all copies or substantial portions of the Software.
c462e188
MD
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
c5498370
MD
32 */
33
34#include <babeltrace/iterator.h>
35
6946751f
JD
36#ifdef __cplusplus
37extern "C" {
38#endif
39
c5498370 40struct bt_ctf_iter;
c50d2a7a 41struct bt_ctf_event;
c5498370
MD
42
43/*
44 * bt_ctf_iter_create - Allocate a CTF trace collection iterator.
45 *
46 * begin_pos and end_pos are optional parameters to specify the position
47 * at which the trace collection should be seeked upon iterator
48 * creation, and the position at which iteration will start returning
49 * "EOF".
50 *
51 * By default, if begin_pos is NULL, a BT_SEEK_CUR is performed at
52 * creation. By default, if end_pos is NULL, a BT_SEEK_END (end of
53 * trace) is the EOF criterion.
e003e871
JD
54 *
55 * Return a pointer to the newly allocated iterator.
56 *
57 * Only one iterator can be created against a context. If more than one
58 * iterator is being created for the same context, the second creation
59 * will return NULL. The previous iterator must be destroyed before
60 * creation of the new iterator for this function to succeed.
c5498370
MD
61 */
62struct bt_ctf_iter *bt_ctf_iter_create(struct bt_context *ctx,
04ae3991
MD
63 const struct bt_iter_pos *begin_pos,
64 const struct bt_iter_pos *end_pos);
c5498370 65
82008834
AB
66 /*
67 * bt_ctf_iter_create_intersect - Allocate a CTF trace collection
68 * iterator corresponding to the timerange when all streams are active
69 * simultaneously.
70 *
71 * On success, return a pointer to the newly allocated iterator. The
72 * out parameters inter_begin_pos and inter_end_pos are also set to
73 * correspond to the beginning and end of the intersection,
74 * respectively.
75 *
76 * On failure, return NULL.
77 */
78struct bt_ctf_iter *bt_ctf_iter_create_intersect(struct bt_context *ctx,
79 struct bt_iter_pos **inter_begin_pos,
80 struct bt_iter_pos **inter_end_pos);
81
c5498370
MD
82/*
83 * bt_ctf_get_iter - get iterator from ctf iterator.
84 */
85struct bt_iter *bt_ctf_get_iter(struct bt_ctf_iter *iter);
86
87/*
88 * bt_ctf_iter_destroy - Free a CTF trace collection iterator.
89 */
90void bt_ctf_iter_destroy(struct bt_ctf_iter *iter);
91
92/*
93 * bt_ctf_iter_read_event: Read the iterator's current event data.
94 *
7f89ddce 95 * @iter: trace collection iterator (input). Should NOT be NULL.
17e0c86e
MD
96 *
97 * Return current event on success, NULL on end of trace.
c5498370 98 */
c50d2a7a 99struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
c5498370 100
f60efc0e
JD
101/*
102 * bt_ctf_iter_read_event_flags: Read the iterator's current event data.
103 *
104 * @iter: trace collection iterator (input). Should NOT be NULL.
105 * @flags: pointer passed by the user, in which the trace reader populates
106 * flags on special condition (BT_ITER_FLAG_*).
107 *
108 * Return current event on success, NULL on end of trace.
109 */
110struct bt_ctf_event *bt_ctf_iter_read_event_flags(struct bt_ctf_iter *iter,
111 int *flags);
112
113/*
114 * bt_ctf_get_lost_events_count: returns the number of events discarded
115 * immediately prior to the last event read
116 *
117 * @iter: trace collection iterator (input). Should NOT be NULL.
118 *
119 * Return the number of lost events or -1ULL on error.
120 */
121uint64_t bt_ctf_get_lost_events_count(struct bt_ctf_iter *iter);
122
953bcd89
JD
123#ifdef __cplusplus
124}
125#endif
126
c5498370 127#endif /* _BABELTRACE_CTF_ITERATOR_H */
This page took 0.040981 seconds and 4 git commands to generate.