bt2: Adapt test_field.py and make it pass
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt_field.i
CommitLineData
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
30typedef enum bt_field_status {
31 BT_FIELD_STATUS_OK = 0,
32 BT_FIELD_STATUS_NOMEM = -12,
33} bt_field_status;
34
35extern const bt_field_class *bt_field_borrow_class_const(
36 const bt_field *field);
37
38extern bt_field_class_type bt_field_get_class_type(
39 const bt_field *field);
40
41extern int64_t bt_field_signed_integer_get_value(const bt_field *field);
42
43extern uint64_t bt_field_unsigned_integer_get_value(
44 const bt_field *field);
45
46extern double bt_field_real_get_value(const bt_field *field);
47
48extern 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
53extern 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
58extern const char *bt_field_string_get_value(const bt_field *field);
59
60extern uint64_t bt_field_string_get_length(const bt_field *field);
61
62extern const bt_field *
63bt_field_structure_borrow_member_field_by_index_const(
64 const bt_field *field, uint64_t index);
65
66extern const bt_field *
67bt_field_structure_borrow_member_field_by_name_const(
68 const bt_field *field, const char *name);
69
70extern uint64_t bt_field_array_get_length(const bt_field *field);
71
72extern const bt_field *
73bt_field_array_borrow_element_field_by_index_const(
74 const bt_field *field, uint64_t index);
75
76extern uint64_t bt_field_variant_get_selected_option_field_index(
77 const bt_field *field);
78
79extern const bt_field *
80bt_field_variant_borrow_selected_option_field_const(
81 const bt_field *field);
82
83/* From field.h */
84
85extern void bt_field_signed_integer_set_value(bt_field *field,
86 int64_t value);
87
88extern void bt_field_unsigned_integer_set_value(bt_field *field,
89 uint64_t value);
90
91extern void bt_field_real_set_value(bt_field *field, double value);
92
93extern bt_field_status bt_field_string_set_value(bt_field *field,
94 const char *value);
95
96extern bt_field_status bt_field_string_append(bt_field *field,
97 const char *value);
98
99extern bt_field_status bt_field_string_append_with_length(bt_field *field,
100 const char *value, uint64_t length);
101
102extern bt_field_status bt_field_string_clear(bt_field *field);
103
104extern bt_field *bt_field_structure_borrow_member_field_by_index(
105 bt_field *field, uint64_t index);
106
107extern bt_field *bt_field_structure_borrow_member_field_by_name(
108 bt_field *field, const char *name);
109
110extern bt_field *bt_field_array_borrow_element_field_by_index(
111 bt_field *field, uint64_t index);
112
113extern bt_field_status bt_field_dynamic_array_set_length(bt_field *field,
114 uint64_t length);
115
116extern bt_field_status bt_field_variant_select_option_field(
117 bt_field *field, uint64_t index);
118
119extern bt_field *bt_field_variant_borrow_selected_option_field(
120 bt_field *field);
This page took 0.028261 seconds and 4 git commands to generate.