Commit | Line | Data |
---|---|---|
6945df9a SM |
1 | /* |
2 | * The MIT License (MIT) | |
3 | * | |
4 | * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com> | |
5 | * | |
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: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | |
15 | * | |
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 | |
22 | * THE SOFTWARE. | |
23 | */ | |
24 | ||
1eccc498 SM |
25 | /* For label type mappings. */ |
26 | %include "native_bt_field_class.i" | |
27 | ||
6945df9a SM |
28 | /* From field-const.h */ |
29 | ||
30 | typedef enum bt_field_status { | |
31 | BT_FIELD_STATUS_OK = 0, | |
32 | BT_FIELD_STATUS_NOMEM = -12, | |
33 | } bt_field_status; | |
34 | ||
35 | extern const bt_field_class *bt_field_borrow_class_const( | |
36 | const bt_field *field); | |
37 | ||
38 | extern bt_field_class_type bt_field_get_class_type( | |
39 | const bt_field *field); | |
40 | ||
41 | extern int64_t bt_field_signed_integer_get_value(const bt_field *field); | |
42 | ||
43 | extern uint64_t bt_field_unsigned_integer_get_value( | |
44 | const bt_field *field); | |
45 | ||
46 | extern double bt_field_real_get_value(const bt_field *field); | |
47 | ||
48 | extern bt_field_status bt_field_unsigned_enumeration_get_mapping_labels( | |
49 | const bt_field *field, | |
1eccc498 SM |
50 | bt_field_class_enumeration_mapping_label_array *LABELARRAY, |
51 | uint64_t *LABELCOUNT); | |
6945df9a SM |
52 | |
53 | extern bt_field_status bt_field_signed_enumeration_get_mapping_labels( | |
54 | const bt_field *field, | |
1eccc498 SM |
55 | bt_field_class_enumeration_mapping_label_array *LABELARRAY, |
56 | uint64_t *LABELCOUNT); | |
6945df9a SM |
57 | |
58 | extern const char *bt_field_string_get_value(const bt_field *field); | |
59 | ||
60 | extern uint64_t bt_field_string_get_length(const bt_field *field); | |
61 | ||
62 | extern const bt_field * | |
63 | bt_field_structure_borrow_member_field_by_index_const( | |
64 | const bt_field *field, uint64_t index); | |
65 | ||
66 | extern const bt_field * | |
67 | bt_field_structure_borrow_member_field_by_name_const( | |
68 | const bt_field *field, const char *name); | |
69 | ||
70 | extern uint64_t bt_field_array_get_length(const bt_field *field); | |
71 | ||
72 | extern const bt_field * | |
73 | bt_field_array_borrow_element_field_by_index_const( | |
74 | const bt_field *field, uint64_t index); | |
75 | ||
76 | extern uint64_t bt_field_variant_get_selected_option_field_index( | |
77 | const bt_field *field); | |
78 | ||
79 | extern const bt_field * | |
80 | bt_field_variant_borrow_selected_option_field_const( | |
81 | const bt_field *field); | |
82 | ||
83 | /* From field.h */ | |
84 | ||
85 | extern void bt_field_signed_integer_set_value(bt_field *field, | |
86 | int64_t value); | |
87 | ||
88 | extern void bt_field_unsigned_integer_set_value(bt_field *field, | |
89 | uint64_t value); | |
90 | ||
91 | extern void bt_field_real_set_value(bt_field *field, double value); | |
92 | ||
93 | extern bt_field_status bt_field_string_set_value(bt_field *field, | |
94 | const char *value); | |
95 | ||
96 | extern bt_field_status bt_field_string_append(bt_field *field, | |
97 | const char *value); | |
98 | ||
99 | extern bt_field_status bt_field_string_append_with_length(bt_field *field, | |
100 | const char *value, uint64_t length); | |
101 | ||
102 | extern bt_field_status bt_field_string_clear(bt_field *field); | |
103 | ||
104 | extern bt_field *bt_field_structure_borrow_member_field_by_index( | |
105 | bt_field *field, uint64_t index); | |
106 | ||
107 | extern bt_field *bt_field_structure_borrow_member_field_by_name( | |
108 | bt_field *field, const char *name); | |
109 | ||
110 | extern bt_field *bt_field_array_borrow_element_field_by_index( | |
111 | bt_field *field, uint64_t index); | |
112 | ||
113 | extern bt_field_status bt_field_dynamic_array_set_length(bt_field *field, | |
114 | uint64_t length); | |
115 | ||
116 | extern bt_field_status bt_field_variant_select_option_field( | |
117 | bt_field *field, uint64_t index); | |
118 | ||
119 | extern bt_field *bt_field_variant_borrow_selected_option_field( | |
120 | bt_field *field); |