| 1 | #ifndef _BABELTRACE_CTF_TEXT_TYPES_H |
| 2 | #define _BABELTRACE_CTF_TEXT_TYPES_H |
| 3 | |
| 4 | /* |
| 5 | * Common Trace Format (Text Output) |
| 6 | * |
| 7 | * Type header |
| 8 | * |
| 9 | * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@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 | |
| 22 | #include <sys/mman.h> |
| 23 | #include <errno.h> |
| 24 | #include <stdint.h> |
| 25 | #include <unistd.h> |
| 26 | #include <glib.h> |
| 27 | #include <babeltrace/babeltrace.h> |
| 28 | #include <babeltrace/types.h> |
| 29 | |
| 30 | struct ctf_text_stream_pos { |
| 31 | struct trace_descriptor parent; |
| 32 | FILE *fp; /* File pointer. NULL if unset. */ |
| 33 | }; |
| 34 | |
| 35 | /* |
| 36 | * IMPORTANT: All lengths (len) and offsets (start, end) are expressed in bits, |
| 37 | * *not* in bytes. |
| 38 | * |
| 39 | * All write primitives, as well as read for dynamically sized entities, can |
| 40 | * receive a NULL ptr/dest parameter. In this case, no write is performed, but |
| 41 | * the size is returned. |
| 42 | */ |
| 43 | |
| 44 | void ctf_text_uint_write(struct stream_pos *pos, |
| 45 | const struct declaration_integer *integer_declaration, |
| 46 | uint64_t v); |
| 47 | void ctf_text_int_write(struct stream_pos *pos, |
| 48 | const struct declaration_integer *integer_declaration, |
| 49 | int64_t v); |
| 50 | |
| 51 | void ctf_text_double_write(struct stream_pos *pos, |
| 52 | const struct declaration_float *dest, |
| 53 | double v); |
| 54 | void ctf_text_ldouble_write(struct stream_pos *pos, |
| 55 | const struct declaration_float *dest, |
| 56 | long double v); |
| 57 | |
| 58 | void ctf_text_string_write(struct stream_pos *dest, const char *src, |
| 59 | const struct declaration_string *string_declaration); |
| 60 | |
| 61 | void ctf_text_enum_write(struct stream_pos *pos, |
| 62 | const struct declaration_enum *dest, |
| 63 | GQuark q); |
| 64 | void ctf_text_struct_begin(struct stream_pos *pos, |
| 65 | const struct declaration_struct *struct_declaration); |
| 66 | void ctf_text_struct_end(struct stream_pos *pos, |
| 67 | const struct declaration_struct *struct_declaration); |
| 68 | void ctf_text_variant_begin(struct stream_pos *pos, |
| 69 | const struct declaration_variant *variant_declaration); |
| 70 | void ctf_text_variant_end(struct stream_pos *pos, |
| 71 | const struct declaration_variant *variant_declaration); |
| 72 | void ctf_text_array_begin(struct stream_pos *pos, |
| 73 | const struct declaration_array *array_declaration); |
| 74 | void ctf_text_array_end(struct stream_pos *pos, |
| 75 | const struct declaration_array *array_declaration); |
| 76 | void ctf_text_sequence_begin(struct stream_pos *pos, |
| 77 | const struct declaration_sequence *sequence_declaration); |
| 78 | void ctf_text_sequence_end(struct stream_pos *pos, |
| 79 | const struct declaration_sequence *sequence_declaration); |
| 80 | |
| 81 | #endif /* _BABELTRACE_CTF_TEXT_TYPES_H */ |