Commit | Line | Data |
---|---|---|
d79865b9 MD |
1 | #ifndef _BABELTRACE_CTF_TYPES_H |
2 | #define _BABELTRACE_CTF_TYPES_H | |
6dc2ca62 MD |
3 | |
4 | /* | |
5 | * Common Trace Format | |
6 | * | |
7 | * Type header | |
8 | * | |
de0ba614 | 9 | * Copyright (c) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
6dc2ca62 | 10 | * |
de0ba614 MD |
11 | * This library is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU Lesser General Public | |
13 | * License as published by the Free Software Foundation; either | |
14 | * version 2.1 of the License, or (at your option) any later version. | |
15 | * | |
16 | * This library is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | * Lesser General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU Lesser General Public | |
22 | * License along with this library; if not, write to the Free Software | |
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
6dc2ca62 MD |
24 | */ |
25 | ||
26 | #include <stdint.h> | |
27 | #include <glib.h> | |
28 | ||
29 | /* | |
de0ba614 MD |
30 | * IMPORTANT: All lengths (len) and offsets (start, end) are expressed in bits, |
31 | * *not* in bytes. | |
32 | * | |
33 | * All write primitives, as well as read for dynamically sized entities, can | |
6dc2ca62 MD |
34 | * receive a NULL ptr/dest parameter. In this case, no write is performed, but |
35 | * the size is returned. | |
36 | */ | |
37 | ||
bed864a7 MD |
38 | uint64_t ctf_uint_read(struct stream_pos *pos, |
39 | const struct type_class_integer *int_class); | |
40 | int64_t ctf_int_read(struct stream_pos *pos, | |
41 | const struct type_class_integer *int_class); | |
42 | void ctf_uint_write(struct stream_pos *pos, | |
43 | const struct type_class_integer *int_class, | |
44 | uint64_t v); | |
45 | void ctf_int_write(struct stream_pos *pos, | |
46 | const struct type_class_integer *int_class, | |
47 | int64_t v); | |
6dc2ca62 | 48 | |
bed864a7 MD |
49 | uint64_t ctf_bitfield_unsigned_read(struct stream_pos *pos, |
50 | const struct type_class_bitfield *bitfield_class); | |
51 | int64_t ctf_bitfield_signed_read(struct stream_pos *pos, | |
52 | const struct type_class_bitfield *bitfield_class); | |
53 | void ctf_bitfield_unsigned_write(struct stream_pos *pos, | |
54 | const struct type_class_bitfield *bitfield_class, | |
55 | uint64_t v); | |
56 | void ctf_bitfield_signed_write(struct stream_pos *pos, | |
57 | const struct type_class_bitfield *bitfield_class, | |
58 | int64_t v); | |
6dc2ca62 | 59 | |
bed864a7 MD |
60 | double ctf_double_read(struct stream_pos *pos, |
61 | const struct type_class_float *src); | |
62 | void ctf_double_write(struct stream_pos *pos, | |
63 | const struct type_class_float *dest, | |
64 | double v); | |
65 | long double ctf_ldouble_read(struct stream_pos *pos, | |
0a46062b | 66 | const struct type_class_float *src); |
bed864a7 MD |
67 | void ctf_ldouble_write(struct stream_pos *pos, |
68 | const struct type_class_float *dest, | |
69 | long double v); | |
70 | void ctf_float_copy(struct stream_pos *destp, const struct type_class_float *dest, | |
71 | struct stream_pos *srcp, const struct type_class_float *src); | |
6dc2ca62 | 72 | |
bed864a7 MD |
73 | void ctf_string_copy(struct stream_pos *dest, struct stream_pos *src, |
74 | const struct type_class_string *string_class); | |
a52d7f6a MD |
75 | void ctf_string_read(unsigned char **dest, struct stream_pos *src, |
76 | const struct type_class_string *string_class); | |
77 | void ctf_string_write(struct stream_pos *dest, const unsigned char *src, | |
78 | const struct type_class_string *string_class); | |
79 | void ctf_string_free_temp(unsigned char *string); | |
6dc2ca62 | 80 | |
bed864a7 MD |
81 | GQuark ctf_enum_read(struct stream_pos *pos, |
82 | const struct type_class_enum *src); | |
83 | void ctf_enum_write(struct stream_pos *pos, | |
84 | const struct type_class_enum *dest, | |
85 | GQuark q); | |
6dc2ca62 | 86 | |
d79865b9 | 87 | #endif /* _BABELTRACE_CTF_TYPES_H */ |