Removed unneeded ctf_* forward declarations from babeltrace.h
[babeltrace.git] / include / babeltrace / babeltrace.h
CommitLineData
34ac0e6c
MD
1#ifndef _BABELTRACE_H
2#define _BABELTRACE_H
3
70bd0a12
JD
4/*
5 * BabelTrace API
6 *
7 * Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
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:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 */
847bf71a 19
64a35d1b 20#include <babeltrace/context.h>
0ec662bd 21#include <babeltrace/format.h>
64a35d1b
JD
22#include <babeltrace/iterator.h>
23#include <babeltrace/trace-collection.h>
24#include <babeltrace/trace-handle.h>
25#include <babeltrace/ctf/events.h>
c34ccddd 26
70bd0a12 27/* Forward declarations */
e8c92a62 28struct bt_iter;
c34ccddd
MD
29struct bt_dependencies;
30
31enum bt_cb_ret {
32 BT_CB_OK = 0,
33 BT_CB_OK_STOP = 1,
34 BT_CB_ERROR_STOP = 2,
35 BT_CB_ERROR_CONTINUE = 3,
36};
063f7048 37
c34ccddd
MD
38/*
39 * Receives a variable number of strings as parameter, ended with NULL.
40 */
41struct bt_dependencies *babeltrace_dependencies_create(const char *first, ...);
42
43/*
44 * struct bt_dependencies must be destroyed explicitly if not passed as
e8c92a62 45 * parameter to a bt_iter_add_callback().
c34ccddd
MD
46 */
47void babeltrace_dependencies_destroy(struct bt_dependencies *dep);
48
49/*
e8c92a62 50 * bt_iter_add_callback: Add a callback to iterator.
c34ccddd
MD
51 *
52 * @iter: trace collection iterator (input)
53 * @event: event to target. 0 for all events.
54 * @private_data: private data pointer to pass to the callback
55 * @flags: specific flags controlling the behavior of this callback
56 * (or'd).
57 *
58 * @callback: function pointer to call
59 * @depends: struct bt_dependency detailing the required computation results.
60 * Ends with 0.
61 * @weak_depends: struct bt_dependency detailing the optional computation
62 * results that can be optionally consumed by this
63 * callback.
64 * @provides: struct bt_dependency detailing the computation results
65 * provided by this callback.
66 * Ends with 0.
67 *
68 * "depends", "weak_depends" and "provides" memory is handled by the
69 * babeltrace library after this call succeeds or fails. These objects
70 * can still be used by the caller until the babeltrace iterator is
71 * destroyed, but they belong to the babeltrace library.
72 *
73 * (note to implementor: we need to keep a gptrarray of struct
e8c92a62 74 * bt_dependencies to "garbage collect" in struct bt_iter, and
c34ccddd
MD
75 * dependencies need to have a refcount to handle the case where they
76 * would be passed to more than one iterator. Upon iterator detroy, we
77 * iterate on all the gc ptrarray and decrement the refcounts, freeing
78 * if we reach 0.)
79 * (note to implementor: we calculate the dependency graph when
e8c92a62
JD
80 * bt_iter_read_event() is executed after a
81 * bt_iter_add_callback(). Beware that it is valid to create/add
c34ccddd
MD
82 * callbacks/read/add more callbacks/read some more.)
83 */
e8c92a62 84int bt_iter_add_callback(struct bt_iter *iter,
34861b9d 85 bt_intern_str event, void *private_data, int flags,
aacd0c69 86 enum bt_cb_ret (*callback)(struct bt_ctf_event *ctf_data,
e73cc54c 87 void *caller_data),
c34ccddd
MD
88 struct bt_dependencies *depends,
89 struct bt_dependencies *weak_depends,
90 struct bt_dependencies *provides);
91
92/*
93 * For flags parameter above.
94 */
95enum {
96 BT_FLAGS_FREE_PRIVATE_DATA = (1 << 0),
97};
98
70bd0a12 99#endif /* _BABELTRACE_H */
This page took 0.028115 seconds and 4 git commands to generate.