1 #ifndef BABELTRACE_CTF_IR_EVENT_H
2 #define BABELTRACE_CTF_IR_EVENT_H
5 * BabelTrace - CTF IR: Event
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * The Common Trace Format (CTF) Specification is available at
30 * http://www.efficios.com/ctf
40 struct bt_ctf_event_class
;
43 struct bt_ctf_field_type
;
44 struct bt_ctf_stream_class
;
47 * bt_ctf_event_create: instanciate an event.
49 * Allocate a new event of the given event class. The creation of an event
50 * sets its reference count to 1. Each instance shares the ownership of the
51 * event class using its reference count.
53 * An event class must be associated with a stream class before events
54 * may be instanciated.
56 * @param event_class Event class.
58 * Returns an allocated field type on success, NULL on error.
60 extern struct bt_ctf_event
*bt_ctf_event_create(
61 struct bt_ctf_event_class
*event_class
);
64 * bt_ctf_event_get_payload: get an event's field.
66 * Returns the field matching "name". bt_ctf_field_put() must be called on the
69 * @param event Event instance.
70 * @param name Event field name, see notes.
72 * Returns a field instance on success, NULL on error.
74 * Note: Passing a name will cause the function to perform a look-up by
75 * name assuming the event's payload is a structure. This will return
76 * the raw payload instance if name is NULL.
78 extern struct bt_ctf_field
*bt_ctf_event_get_payload(struct bt_ctf_event
*event
,
82 * bt_ctf_event_set_payload: set an event's field.
84 * Set a manually allocated field as an event's payload. The event will share
85 * the field's ownership by using its reference count.
86 * bt_ctf_field_put() must be called on the returned value.
88 * @param event Event instance.
89 * @param name Event field name, see notes.
90 * @param value Instance of a field whose type corresponds to the event's field.
92 * Returns 0 on success, a negative value on error.
94 * Note: The function will return an error if a name is provided and the payload
95 * type is not a structure. If name is NULL, the payload field will be set
96 * directly and must match the event class' payload's type.
98 extern int bt_ctf_event_set_payload(struct bt_ctf_event
*event
,
100 struct bt_ctf_field
*value
);
106 #endif /* BABELTRACE_CTF_IR_EVENT_H */
This page took 0.032718 seconds and 5 git commands to generate.