Commit | Line | Data |
---|---|---|
fc93b2bd MD |
1 | #ifndef _BABELTRACE_FORMAT_H |
2 | #define _BABELTRACE_FORMAT_H | |
3 | ||
4 | /* | |
5 | * BabelTrace | |
6 | * | |
7 | * Trace Format Header | |
8 | * | |
c054553d | 9 | * Copyright 2010, 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
fc93b2bd | 10 | * |
ccd7e1c8 MD |
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: | |
fc93b2bd | 17 | * |
ccd7e1c8 MD |
18 | * The above copyright notice and this permission notice shall be included in |
19 | * all copies or substantial portions of the Software. | |
fc93b2bd MD |
20 | */ |
21 | ||
4c8bfb7e | 22 | #include <babeltrace/types.h> |
fc93b2bd | 23 | #include <stdint.h> |
7fb21036 | 24 | #include <stdio.h> |
fc93b2bd MD |
25 | #include <glib.h> |
26 | ||
46322b33 MD |
27 | /* Parent trace descriptor */ |
28 | struct trace_descriptor { | |
29 | }; | |
bbefb8dd | 30 | |
fc93b2bd MD |
31 | struct format { |
32 | GQuark name; | |
33 | ||
bed864a7 | 34 | uint64_t (*uint_read)(struct stream_pos *pos, |
f6625916 | 35 | const struct declaration_integer *integer_declaration); |
bed864a7 | 36 | int64_t (*int_read)(struct stream_pos *pos, |
f6625916 | 37 | const struct declaration_integer *integer_declaration); |
bed864a7 | 38 | void (*uint_write)(struct stream_pos *pos, |
f6625916 MD |
39 | const struct declaration_integer *integer_declaration, |
40 | uint64_t v); | |
bed864a7 | 41 | void (*int_write)(struct stream_pos *pos, |
f6625916 MD |
42 | const struct declaration_integer *integer_declaration, |
43 | int64_t v); | |
fc93b2bd | 44 | |
4c8bfb7e | 45 | void (*float_copy)(struct stream_pos *destp, |
f6625916 MD |
46 | struct stream_pos *srcp, |
47 | const struct declaration_float *float_declaration); | |
bed864a7 | 48 | double (*double_read)(struct stream_pos *pos, |
f6625916 | 49 | const struct declaration_float *float_declaration); |
bed864a7 | 50 | void (*double_write)(struct stream_pos *pos, |
f6625916 MD |
51 | const struct declaration_float *float_declaration, |
52 | double v); | |
dc48ecad MD |
53 | long double (*ldouble_read)(struct stream_pos *pos, |
54 | const struct declaration_float *float_declaration); | |
55 | void (*ldouble_write)(struct stream_pos *pos, | |
56 | const struct declaration_float *float_declaration, | |
57 | long double v); | |
fc93b2bd | 58 | |
bed864a7 | 59 | void (*string_copy)(struct stream_pos *dest, struct stream_pos *src, |
f6625916 | 60 | const struct declaration_string *string_declaration); |
47e0f2e2 | 61 | void (*string_read)(char **dest, struct stream_pos *src, |
f6625916 | 62 | const struct declaration_string *string_declaration); |
47e0f2e2 | 63 | void (*string_write)(struct stream_pos *dest, const char *src, |
f6625916 | 64 | const struct declaration_string *string_declaration); |
47e0f2e2 | 65 | void (*string_free_temp)(char *string); |
fc93b2bd | 66 | |
47e0f2e2 MD |
67 | /* |
68 | * enum_read returns a GArray of GQuark. Must be released with | |
69 | * g_array_unref(). | |
70 | */ | |
71 | GArray *(*enum_read)(struct stream_pos *pos, | |
f6625916 | 72 | const struct declaration_enum *src); |
bed864a7 | 73 | void (*enum_write)(struct stream_pos *pos, |
f6625916 MD |
74 | const struct declaration_enum *dest, |
75 | GQuark q); | |
11796b96 | 76 | void (*struct_begin)(struct stream_pos *pos, |
f6625916 | 77 | const struct declaration_struct *struct_declaration); |
11796b96 | 78 | void (*struct_end)(struct stream_pos *pos, |
f6625916 | 79 | const struct declaration_struct *struct_declaration); |
c054553d | 80 | void (*variant_begin)(struct stream_pos *pos, |
f6625916 | 81 | const struct declaration_variant *variant_declaration); |
c054553d | 82 | void (*variant_end)(struct stream_pos *pos, |
f6625916 | 83 | const struct declaration_variant *variant_declaration); |
d06d03db | 84 | void (*array_begin)(struct stream_pos *pos, |
f6625916 | 85 | const struct declaration_array *array_declaration); |
d06d03db | 86 | void (*array_end)(struct stream_pos *pos, |
f6625916 | 87 | const struct declaration_array *array_declaration); |
d06d03db | 88 | void (*sequence_begin)(struct stream_pos *pos, |
f6625916 | 89 | const struct declaration_sequence *sequence_declaration); |
d06d03db | 90 | void (*sequence_end)(struct stream_pos *pos, |
f6625916 | 91 | const struct declaration_sequence *sequence_declaration); |
bbefb8dd MD |
92 | struct trace_descriptor *(*open_trace)(const char *path, int flags); |
93 | void (*close_trace)(struct trace_descriptor *descriptor); | |
fc93b2bd MD |
94 | }; |
95 | ||
96 | struct format *bt_lookup_format(GQuark qname); | |
7fb21036 | 97 | void bt_fprintf_format_list(FILE *fp); |
4c8bfb7e | 98 | int bt_register_format(struct format *format); |
fc93b2bd MD |
99 | |
100 | /* TBD: format unregistration */ | |
101 | ||
102 | #endif /* _BABELTRACE_FORMAT_H */ |