2 * The MIT License (MIT)
4 * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 /* For label type mappings. */
26 %include "native_bt_field_class.i"
28 /* From field-const.h */
30 typedef enum bt_field_status {
31 BT_FIELD_STATUS_OK = 0,
32 BT_FIELD_STATUS_NOMEM = -12,
35 extern const bt_field_class *bt_field_borrow_class_const(
36 const bt_field *field);
38 extern bt_field_class_type bt_field_get_class_type(
39 const bt_field *field);
41 extern int64_t bt_field_signed_integer_get_value(const bt_field *field);
43 extern uint64_t bt_field_unsigned_integer_get_value(
44 const bt_field *field);
46 extern double bt_field_real_get_value(const bt_field *field);
48 extern bt_field_status bt_field_unsigned_enumeration_get_mapping_labels(
49 const bt_field *field,
50 bt_field_class_enumeration_mapping_label_array *LABELARRAY,
51 uint64_t *LABELCOUNT);
53 extern bt_field_status bt_field_signed_enumeration_get_mapping_labels(
54 const bt_field *field,
55 bt_field_class_enumeration_mapping_label_array *LABELARRAY,
56 uint64_t *LABELCOUNT);
58 extern const char *bt_field_string_get_value(const bt_field *field);
60 extern uint64_t bt_field_string_get_length(const bt_field *field);
62 extern const bt_field *
63 bt_field_structure_borrow_member_field_by_index_const(
64 const bt_field *field, uint64_t index);
66 extern const bt_field *
67 bt_field_structure_borrow_member_field_by_name_const(
68 const bt_field *field, const char *name);
70 extern uint64_t bt_field_array_get_length(const bt_field *field);
72 extern const bt_field *
73 bt_field_array_borrow_element_field_by_index_const(
74 const bt_field *field, uint64_t index);
76 extern uint64_t bt_field_variant_get_selected_option_field_index(
77 const bt_field *field);
79 extern const bt_field *
80 bt_field_variant_borrow_selected_option_field_const(
81 const bt_field *field);
85 extern void bt_field_signed_integer_set_value(bt_field *field,
88 extern void bt_field_unsigned_integer_set_value(bt_field *field,
91 extern void bt_field_real_set_value(bt_field *field, double value);
93 extern bt_field_status bt_field_string_set_value(bt_field *field,
96 extern bt_field_status bt_field_string_append(bt_field *field,
99 extern bt_field_status bt_field_string_append_with_length(bt_field *field,
100 const char *value, uint64_t length);
102 extern bt_field_status bt_field_string_clear(bt_field *field);
104 extern bt_field *bt_field_structure_borrow_member_field_by_index(
105 bt_field *field, uint64_t index);
107 extern bt_field *bt_field_structure_borrow_member_field_by_name(
108 bt_field *field, const char *name);
110 extern bt_field *bt_field_array_borrow_element_field_by_index(
111 bt_field *field, uint64_t index);
113 extern bt_field_status bt_field_dynamic_array_set_length(bt_field *field,
116 extern bt_field_status bt_field_variant_select_option_field(
117 bt_field *field, uint64_t index);
119 extern bt_field *bt_field_variant_borrow_selected_option_field(