| 1 | #ifndef _BABELTRACE_CTF_TYPES_H |
| 2 | #define _BABELTRACE_CTF_TYPES_H |
| 3 | |
| 4 | /* |
| 5 | * Common Trace Format |
| 6 | * |
| 7 | * Type header |
| 8 | * |
| 9 | * Copyright (c) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 10 | * |
| 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 |
| 24 | */ |
| 25 | |
| 26 | #include <stdint.h> |
| 27 | #include <glib.h> |
| 28 | |
| 29 | /* |
| 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 |
| 34 | * receive a NULL ptr/dest parameter. In this case, no write is performed, but |
| 35 | * the size is returned. |
| 36 | */ |
| 37 | |
| 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); |
| 48 | |
| 49 | double ctf_double_read(struct stream_pos *pos, |
| 50 | const struct type_class_float *src); |
| 51 | void ctf_double_write(struct stream_pos *pos, |
| 52 | const struct type_class_float *dest, |
| 53 | double v); |
| 54 | long double ctf_ldouble_read(struct stream_pos *pos, |
| 55 | const struct type_class_float *src); |
| 56 | void ctf_ldouble_write(struct stream_pos *pos, |
| 57 | const struct type_class_float *dest, |
| 58 | long double v); |
| 59 | void ctf_float_copy(struct stream_pos *destp, const struct type_class_float *dest, |
| 60 | struct stream_pos *srcp, const struct type_class_float *src); |
| 61 | |
| 62 | void ctf_string_copy(struct stream_pos *dest, struct stream_pos *src, |
| 63 | const struct type_class_string *string_class); |
| 64 | void ctf_string_read(unsigned char **dest, struct stream_pos *src, |
| 65 | const struct type_class_string *string_class); |
| 66 | void ctf_string_write(struct stream_pos *dest, const unsigned char *src, |
| 67 | const struct type_class_string *string_class); |
| 68 | void ctf_string_free_temp(unsigned char *string); |
| 69 | |
| 70 | GQuark ctf_enum_read(struct stream_pos *pos, |
| 71 | const struct type_class_enum *src); |
| 72 | void ctf_enum_write(struct stream_pos *pos, |
| 73 | const struct type_class_enum *dest, |
| 74 | GQuark q); |
| 75 | |
| 76 | #endif /* _BABELTRACE_CTF_TYPES_H */ |