Commit | Line | Data |
---|---|---|
81447b5b PP |
1 | /* |
2 | * The MIT License (MIT) | |
3 | * | |
4 | * Copyright (c) 2017 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 */ |
26 | struct bt_notification_iterator; | |
27 | ||
28 | /* Status */ | |
29 | enum bt_notification_iterator_status { | |
f6a5e476 PP |
30 | BT_NOTIFICATION_ITERATOR_STATUS_CANCELED = 125, |
31 | BT_NOTIFICATION_ITERATOR_STATUS_AGAIN = 11, | |
81447b5b PP |
32 | BT_NOTIFICATION_ITERATOR_STATUS_END = 1, |
33 | BT_NOTIFICATION_ITERATOR_STATUS_OK = 0, | |
f6a5e476 PP |
34 | BT_NOTIFICATION_ITERATOR_STATUS_INVALID = -22, |
35 | BT_NOTIFICATION_ITERATOR_STATUS_ERROR = -1, | |
36 | BT_NOTIFICATION_ITERATOR_STATUS_NOMEM = -12, | |
37 | BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED = -2, | |
81447b5b PP |
38 | }; |
39 | ||
fe7265b5 | 40 | /* Functions (base) */ |
81447b5b PP |
41 | struct bt_notification *bt_notification_iterator_get_notification( |
42 | struct bt_notification_iterator *iterator); | |
43 | enum bt_notification_iterator_status bt_notification_iterator_next( | |
44 | struct bt_notification_iterator *iterator); | |
fe7265b5 PP |
45 | |
46 | /* Functions (private connection) */ | |
47 | struct bt_component *bt_private_connection_notification_iterator_get_component( | |
81447b5b | 48 | struct bt_notification_iterator *iterator); |
81447b5b | 49 | |
26c5273a PP |
50 | /* Functions (output port) */ |
51 | struct bt_notification_iterator *bt_output_port_notification_iterator_create( | |
52 | struct bt_port *port, const char *colander_component_name, | |
53 | const enum bt_notification_type *notification_types); | |
54 | ||
81447b5b PP |
55 | /* Helper functions for Python */ |
56 | %{ | |
f6a5e476 | 57 | static PyObject *bt_py3_get_user_component_from_user_notif_iter( |
fe7265b5 | 58 | struct bt_private_connection_private_notification_iterator *priv_notif_iter) |
81447b5b | 59 | { |
f6a5e476 | 60 | struct bt_private_component *priv_comp = |
fe7265b5 | 61 | bt_private_connection_private_notification_iterator_get_private_component( |
f6a5e476 | 62 | priv_notif_iter); |
81447b5b PP |
63 | PyObject *py_comp; |
64 | ||
f6a5e476 PP |
65 | assert(priv_comp); |
66 | py_comp = bt_private_component_get_user_data(priv_comp); | |
67 | bt_put(priv_comp); | |
81447b5b PP |
68 | assert(py_comp); |
69 | ||
70 | /* Return new reference */ | |
71 | Py_INCREF(py_comp); | |
72 | return py_comp; | |
73 | } | |
74 | %} | |
75 | ||
f6a5e476 | 76 | PyObject *bt_py3_get_user_component_from_user_notif_iter( |
fe7265b5 | 77 | struct bt_private_connection_private_notification_iterator *priv_notif_iter); |