| 1 | #ifndef BABELTRACE_CTF_WRITER_FIELDS_H |
| 2 | #define BABELTRACE_CTF_WRITER_FIELDS_H |
| 3 | |
| 4 | /* |
| 5 | * Babeltrace - CTF writer: Event Fields |
| 6 | * |
| 7 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 8 | * |
| 9 | * Author: Jérémie Galarneau <jeremie.galarneau@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 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 27 | * SOFTWARE. |
| 28 | * |
| 29 | * The Common Trace Format (CTF) Specification is available at |
| 30 | * http://www.efficios.com/ctf |
| 31 | */ |
| 32 | |
| 33 | #include <stdint.h> |
| 34 | #include <stddef.h> |
| 35 | |
| 36 | #ifdef __cplusplus |
| 37 | extern "C" { |
| 38 | #endif |
| 39 | |
| 40 | struct bt_ctf_field; |
| 41 | struct bt_ctf_event_class; |
| 42 | struct bt_ctf_event; |
| 43 | struct bt_ctf_field_type; |
| 44 | struct bt_ctf_field_type_enumeration_mapping_iterator; |
| 45 | |
| 46 | extern struct bt_ctf_field *bt_ctf_field_create( |
| 47 | struct bt_ctf_field_type *field_type); |
| 48 | |
| 49 | extern struct bt_ctf_field_type *bt_ctf_field_get_type( |
| 50 | struct bt_ctf_field *field); |
| 51 | |
| 52 | extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id( |
| 53 | struct bt_ctf_field *field); |
| 54 | |
| 55 | extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field); |
| 56 | |
| 57 | extern int bt_ctf_field_integer_signed_get_value( |
| 58 | struct bt_ctf_field *integer_field, int64_t *value); |
| 59 | |
| 60 | /* Pre-2.0 CTF writer compatibility */ |
| 61 | static inline |
| 62 | int bt_ctf_field_signed_integer_set_value( |
| 63 | struct bt_ctf_field *integer_field, int64_t *value) |
| 64 | { |
| 65 | return bt_ctf_field_integer_signed_get_value(integer_field, value); |
| 66 | } |
| 67 | |
| 68 | extern int bt_ctf_field_integer_signed_set_value( |
| 69 | struct bt_ctf_field *integer_field, int64_t value); |
| 70 | |
| 71 | extern int bt_ctf_field_integer_unsigned_get_value( |
| 72 | struct bt_ctf_field *integer_field, uint64_t *value); |
| 73 | |
| 74 | extern int bt_ctf_field_integer_unsigned_set_value( |
| 75 | struct bt_ctf_field *integer_field, uint64_t value); |
| 76 | |
| 77 | /* Pre-2.0 CTF writer compatibility */ |
| 78 | static inline |
| 79 | int bt_ctf_field_unsigned_integer_set_value( |
| 80 | struct bt_ctf_field *integer_field, uint64_t *value) |
| 81 | { |
| 82 | return bt_ctf_field_integer_unsigned_get_value(integer_field, value); |
| 83 | } |
| 84 | |
| 85 | extern int bt_ctf_field_floating_point_get_value( |
| 86 | struct bt_ctf_field *float_field, double *value); |
| 87 | |
| 88 | extern int bt_ctf_field_floating_point_set_value( |
| 89 | struct bt_ctf_field *float_field, double value); |
| 90 | |
| 91 | extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container( |
| 92 | struct bt_ctf_field *enum_field); |
| 93 | |
| 94 | extern const char *bt_ctf_field_string_get_value( |
| 95 | struct bt_ctf_field *string_field); |
| 96 | |
| 97 | extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field, |
| 98 | const char *value); |
| 99 | |
| 100 | extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field, |
| 101 | const char *value); |
| 102 | |
| 103 | extern int bt_ctf_field_string_append_len( |
| 104 | struct bt_ctf_field *string_field, const char *value, |
| 105 | unsigned int length); |
| 106 | |
| 107 | extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( |
| 108 | struct bt_ctf_field *struct_field, const char *name); |
| 109 | |
| 110 | /* Pre-2.0 CTF writer compatibility */ |
| 111 | static inline |
| 112 | struct bt_ctf_field *bt_ctf_field_structure_get_field( |
| 113 | struct bt_ctf_field *structure, const char *name) |
| 114 | { |
| 115 | return bt_ctf_field_structure_get_field_by_name(structure, name); |
| 116 | } |
| 117 | |
| 118 | extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( |
| 119 | struct bt_ctf_field *struct_field, uint64_t index); |
| 120 | |
| 121 | extern struct bt_ctf_field *bt_ctf_field_array_get_field( |
| 122 | struct bt_ctf_field *array_field, uint64_t index); |
| 123 | |
| 124 | extern struct bt_ctf_field *bt_ctf_field_sequence_get_field( |
| 125 | struct bt_ctf_field *sequence_field, uint64_t index); |
| 126 | |
| 127 | extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field, |
| 128 | struct bt_ctf_field *length_field); |
| 129 | |
| 130 | extern struct bt_ctf_field *bt_ctf_field_variant_get_field( |
| 131 | struct bt_ctf_field *variant_field, |
| 132 | struct bt_ctf_field *tag_field); |
| 133 | |
| 134 | extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field( |
| 135 | struct bt_ctf_field *variant_field); |
| 136 | |
| 137 | #ifdef __cplusplus |
| 138 | } |
| 139 | #endif |
| 140 | |
| 141 | #endif /* BABELTRACE_CTF_WRITER_FIELDS_H */ |