Fix: add missing void param to bt_clock_class_priority_map_create
[babeltrace.git] / bindings / python / bt2 / native_bttrace.i
CommitLineData
81447b5b
PP
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
81447b5b
PP
25/* Type */
26struct bt_ctf_trace;
27
28/* Functions */
29struct bt_ctf_trace *bt_ctf_trace_create(void);
811644b8
PP
30const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace_class);
31int bt_ctf_trace_set_name(struct bt_ctf_trace *trace_class,
81447b5b 32 const char *name);
811644b8
PP
33enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order(
34 struct bt_ctf_trace *trace_class);
35int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace_class,
36 enum bt_ctf_byte_order native_byte_order);
37BTUUID bt_ctf_trace_get_uuid(
38 struct bt_ctf_trace *trace_class);
39int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace_class,
40 BTUUID uuid);
41int64_t bt_ctf_trace_get_environment_field_count(
42 struct bt_ctf_trace *trace_class);
81447b5b 43const char *
811644b8
PP
44bt_ctf_trace_get_environment_field_name_by_index(
45 struct bt_ctf_trace *trace_class, uint64_t index);
81447b5b 46struct bt_value *
811644b8
PP
47bt_ctf_trace_get_environment_field_value_by_index(struct bt_ctf_trace *trace_class,
48 uint64_t index);
81447b5b
PP
49struct bt_value *
50bt_ctf_trace_get_environment_field_value_by_name(
811644b8 51 struct bt_ctf_trace *trace_class, const char *name);
81447b5b 52int bt_ctf_trace_set_environment_field(
811644b8 53 struct bt_ctf_trace *trace_class, const char *name,
81447b5b
PP
54 struct bt_value *value);
55struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_type(
811644b8
PP
56 struct bt_ctf_trace *trace_class);
57int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace_class,
81447b5b 58 struct bt_ctf_field_type *packet_header_type);
811644b8
PP
59int64_t bt_ctf_trace_get_clock_class_count(
60 struct bt_ctf_trace *trace_class);
61struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index(
62 struct bt_ctf_trace *trace_class, uint64_t index);
81447b5b 63struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_name(
811644b8
PP
64 struct bt_ctf_trace *trace_class, const char *name);
65int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace_class,
81447b5b 66 struct bt_ctf_clock_class *clock_class);
811644b8
PP
67int64_t bt_ctf_trace_get_stream_class_count(
68 struct bt_ctf_trace *trace_class);
69struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
70 struct bt_ctf_trace *trace_class, uint64_t index);
81447b5b 71struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
811644b8
PP
72 struct bt_ctf_trace *trace_class, uint64_t id);
73int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace_class,
81447b5b 74 struct bt_ctf_stream_class *stream_class);
811644b8
PP
75int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace_class);
76struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
77 struct bt_ctf_trace *trace_class, uint64_t index);
78int bt_ctf_trace_is_static(struct bt_ctf_trace *trace_class);
79int bt_ctf_trace_set_is_static(struct bt_ctf_trace *trace_class);
80
81/* Helper functions for Python */
82%{
83void trace_is_static_listener(struct bt_ctf_trace *trace, void *py_callable)
84{
85 PyObject *py_trace_ptr = NULL;
86 PyObject *py_res = NULL;
87
88 py_trace_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(trace),
89 SWIGTYPE_p_bt_ctf_trace, 0);
90 if (!py_trace_ptr) {
91 BT_LOGF_STR("Failed to create a SWIG pointer object.");
92 abort();
93 }
94
95 py_res = PyObject_CallFunction(py_callable, "(O)", py_trace_ptr);
96 assert(py_res == Py_None);
97 Py_DECREF(py_trace_ptr);
98 Py_DECREF(py_res);
99}
100
101void trace_listener_removed(struct bt_ctf_trace *trace, void *py_callable)
102{
103 assert(py_callable);
104 Py_DECREF(py_callable);
105}
106
107static int bt_py3_trace_add_is_staitc_listener(unsigned long long trace_addr,
108 PyObject *py_callable)
109{
110 struct bt_ctf_trace *trace = (void *) trace_addr;
111 int ret = 0;
112
113 assert(trace);
114 assert(py_callable);
115 ret = bt_ctf_trace_add_is_static_listener(trace,
116 trace_is_static_listener, trace_listener_removed, py_callable);
117 if (ret >= 0) {
118 Py_INCREF(py_callable);
119 }
120
121 return ret;
122}
123%}
124
125int bt_py3_trace_add_is_staitc_listener(unsigned long long trace_addr,
126 PyObject *py_callable);
This page took 0.032741 seconds and 4 git commands to generate.