| 1 | /* |
| 2 | * BabelTrace - Common Trace Format (CTF) |
| 3 | * |
| 4 | * Format registration. |
| 5 | * |
| 6 | * Copyright 2010, 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | * of this software and associated documentation files (the "Software"), to deal |
| 10 | * in the Software without restriction, including without limitation the rights |
| 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | * copies of the Software, and to permit persons to whom the Software is |
| 13 | * furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included in |
| 16 | * all copies or substantial portions of the Software. |
| 17 | */ |
| 18 | |
| 19 | #include <babeltrace/format.h> |
| 20 | #include <babeltrace/ctf/types.h> |
| 21 | |
| 22 | void __attribute__((constructor)) ctf_init(void); |
| 23 | |
| 24 | static struct format ctf_format = { |
| 25 | .uint_read = ctf_uint_read, |
| 26 | .int_read = ctf_int_read, |
| 27 | .uint_write = ctf_uint_write, |
| 28 | .int_write = ctf_int_write, |
| 29 | .double_read = ctf_double_read, |
| 30 | .double_write = ctf_double_write, |
| 31 | .float_copy = ctf_float_copy, |
| 32 | .string_copy = ctf_string_copy, |
| 33 | .string_read = ctf_string_read, |
| 34 | .string_write = ctf_string_write, |
| 35 | .string_free_temp = ctf_string_free_temp, |
| 36 | .enum_read = ctf_enum_read, |
| 37 | .enum_write = ctf_enum_write, |
| 38 | .struct_begin = ctf_struct_begin, |
| 39 | .struct_end = ctf_struct_end, |
| 40 | .variant_begin = ctf_variant_begin, |
| 41 | .variant_end = ctf_variant_end, |
| 42 | .array_begin = ctf_array_begin, |
| 43 | .array_end = ctf_array_end, |
| 44 | .sequence_begin = ctf_sequence_begin, |
| 45 | .sequence_end = ctf_sequence_end, |
| 46 | }; |
| 47 | |
| 48 | void ctf_init(void) |
| 49 | { |
| 50 | int ret; |
| 51 | |
| 52 | ctf_format.name = g_quark_from_static_string("ctf"); |
| 53 | ret = bt_register_format(&ctf_format); |
| 54 | assert(!ret); |
| 55 | } |
| 56 | |
| 57 | /* TODO: finalize */ |