lib: make trace IR API const-correct
[babeltrace.git] / plugins / libctfcopytrace / ctfcopytrace.h
1 #ifndef BABELTRACE_LIB_COPY_TRACE_H
2 #define BABELTRACE_LIB_COPY_TRACE_H
3
4 /*
5 * BabelTrace - Library to create a copy of a CTF trace
6 *
7 * Copyright 2017 Julien Desfossez <jdesfossez@efficios.com>
8 *
9 * Author: Julien Desfossez <jdesfossez@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
30 #include <stdbool.h>
31 #include <babeltrace/babeltrace-internal.h>
32 #include <babeltrace/babeltrace.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39 * Create a copy of the clock_class passed in parameter.
40 *
41 * Returns NULL on error.
42 */
43 const struct bt_clock_class *ctf_copy_clock_class(FILE *err,
44 const struct bt_clock_class *clock_class);
45
46 /*
47 * Copy all the clock classes from the input trace and add them to the writer
48 * object.
49 *
50 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
51 * error.
52 */
53 BT_HIDDEN
54 enum bt_component_status ctf_copy_clock_classes(FILE *err,
55 const struct bt_trace *writer_trace,
56 const struct bt_stream_class *writer_stream_class,
57 const struct bt_trace *trace);
58
59 /*
60 * Create a copy of the event class passed in parameter.
61 *
62 * Returns NULL on error.
63 */
64 BT_HIDDEN
65 const struct bt_event_class *ctf_copy_event_class(FILE *err,
66 const struct bt_trace *trace_copy,
67 const struct bt_event_class *event_class);
68
69 /*
70 * Copy all the event classes from the input stream class and add them to the
71 * writer_stream_class.
72 *
73 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
74 * error.
75 */
76 BT_HIDDEN
77 enum bt_component_status ctf_copy_event_classes(FILE *err,
78 const struct bt_stream_class *stream_class,
79 const struct bt_stream_class *writer_stream_class);
80
81 /*
82 * Create a copy of the stream class passed in parameter.
83 *
84 * Returns NULL or error.
85 */
86 BT_HIDDEN
87 const struct bt_stream_class *ctf_copy_stream_class(FILE *err,
88 const struct bt_stream_class *stream_class,
89 const struct bt_trace *writer_trace,
90 bool override_ts64);
91
92 /*
93 * Copy the value of a packet context field and add it to the
94 * writer_packet_context. Only supports unsigned integers for now.
95 *
96 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
97 * error.
98 */
99 BT_HIDDEN
100 enum bt_component_status ctf_copy_packet_context_field(FILE *err,
101 const struct bt_field *field, const char *field_name,
102 const struct bt_field *writer_packet_context,
103 struct bt_field_type *writer_packet_context_type);
104
105
106 /*
107 * Copy the packet_header from the packet passed in parameter and assign it
108 * to the writer_stream.
109 *
110 * Returns 0 on success or -1 on error.
111 */
112 BT_HIDDEN
113 int ctf_stream_copy_packet_header(FILE *err, const struct bt_packet *packet,
114 const struct bt_stream *writer_stream);
115
116 /*
117 * Copy the packet_header from the packet passed in parameter and assign it
118 * to the writer_packet.
119 *
120 * Returns 0 on success or -1 on error.
121 */
122 BT_HIDDEN
123 int ctf_packet_copy_header(FILE *err, const struct bt_packet *packet,
124 const struct bt_packet *writer_packet);
125
126 /*
127 * Copy all the field values of the packet context from the packet passed in
128 * parameter and set it to the writer_stream.
129 *
130 * Returns 0 on success or -1 on error.
131 */
132 BT_HIDDEN
133 int ctf_stream_copy_packet_context(FILE *err, const struct bt_packet *packet,
134 const struct bt_stream *writer_stream);
135
136 /*
137 * Copy all the field values of the packet context from the packet passed in
138 * parameter and set it to the writer_packet.
139 *
140 * Returns 0 on success or -1 on error.
141 */
142 BT_HIDDEN
143 int ctf_packet_copy_context(FILE *err, const struct bt_packet *packet,
144 const struct bt_stream *writer_stream,
145 const struct bt_packet *writer_packet);
146
147 /*
148 * Create and return a copy of the event passed in parameter. The caller has to
149 * append it to the writer_stream.
150 *
151 * Returns NULL on error.
152 */
153 BT_HIDDEN
154 const struct bt_event *ctf_copy_event(FILE *err, const struct bt_event *event,
155 const struct bt_event_class *writer_event_class,
156 bool override_ts64);
157
158 /*
159 * Copies the content of the event header to writer_event_header.
160 *
161 * Returns 0 on success, -1 on error.
162 */
163 BT_HIDDEN
164 int ctf_copy_event_header(FILE *err, const struct bt_event *event,
165 const struct bt_event_class *writer_event_class,
166 const struct bt_event *writer_event,
167 const struct bt_field *event_header);
168
169 /*
170 * Copy the environment and the packet header from the input trace to the
171 * writer_trace.
172 *
173 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
174 * error.
175 */
176 BT_HIDDEN
177 enum bt_component_status ctf_copy_trace(FILE *err, const struct bt_trace *trace,
178 const struct bt_trace *writer_trace);
179
180 #ifdef __cplusplus
181 }
182 #endif
183
184 #endif /* BABELTRACE_LIB_COPY_TRACE_H */
This page took 0.032409 seconds and 4 git commands to generate.