Hide new bt_ctf_event_* symbols
[babeltrace.git] / include / babeltrace / ctf-ir / event.h
CommitLineData
1c822dfb
JG
1#ifndef BABELTRACE_CTF_IR_EVENT_H
2#define BABELTRACE_CTF_IR_EVENT_H
3
4/*
5 * BabelTrace - CTF IR: Event
6 *
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 *
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
10 *
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:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
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
27 * SOFTWARE.
28 *
29 * The Common Trace Format (CTF) Specification is available at
30 * http://www.efficios.com/ctf
31 */
32
33#include <stdint.h>
34#include <stddef.h>
1c822dfb
JG
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40struct bt_ctf_event_class;
41struct bt_ctf_event;
42struct bt_ctf_field;
43struct bt_ctf_field_type;
44struct bt_ctf_stream_class;
45struct bt_ctf_packet;
46
47/*
48 * bt_ctf_event_create: instanciate an event.
49 *
50 * Allocate a new event of the given event class. The creation of an event
51 * sets its reference count to 1. Each instance shares the ownership of the
52 * event class using its reference count.
53 *
54 * An event class must be associated with a stream class before events
55 * may be instanciated.
56 *
57 * @param event_class Event class.
58 *
59 * Returns an allocated field type on success, NULL on error.
60 */
61extern struct bt_ctf_event *bt_ctf_event_create(
62 struct bt_ctf_event_class *event_class);
63
1c822dfb
JG
64/*
65 * bt_ctf_event_get_payload: get an event's field.
66 *
67 * Returns the field matching "name". bt_ctf_field_put() must be called on the
68 * returned value.
69 *
70 * @param event Event instance.
71 * @param name Event field name, see notes.
72 *
73 * Returns a field instance on success, NULL on error.
74 *
75 * Note: Passing a name will cause the function to perform a look-up by
76 * name assuming the event's payload is a structure. This will return
77 * the raw payload instance if name is NULL.
78 */
79extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event,
80 const char *name);
81
82/*
83 * bt_ctf_event_set_payload: set an event's field.
84 *
85 * Set a manually allocated field as an event's payload. The event will share
86 * the field's ownership by using its reference count.
87 * bt_ctf_field_put() must be called on the returned value.
88 *
89 * @param event Event instance.
90 * @param name Event field name, see notes.
91 * @param value Instance of a field whose type corresponds to the event's field.
92 *
93 * Returns 0 on success, a negative value on error.
94 *
95 * Note: The function will return an error if a name is provided and the payload
96 * type is not a structure. If name is NULL, the payload field will be set
97 * directly and must match the event class' payload's type.
98 */
99extern int bt_ctf_event_set_payload(struct bt_ctf_event *event,
100 const char *name,
101 struct bt_ctf_field *value);
102
1c822dfb
JG
103#ifdef __cplusplus
104}
105#endif
106
107#endif /* BABELTRACE_CTF_IR_EVENT_H */
This page took 0.027336 seconds and 4 git commands to generate.