*/
BT_LOGD_STR("Creating native component class to Python component class hash table.");
bt_cc_ptr_to_py_cls = g_hash_table_new(g_direct_hash, g_direct_equal);
- assert(bt_cc_ptr_to_py_cls);
+ BT_ASSERT(bt_cc_ptr_to_py_cls);
}
g_hash_table_insert(bt_cc_ptr_to_py_cls, (gpointer) bt_cc,
* code here without importing bt2 first.
*/
py_mod_bt2 = PyImport_ImportModule("bt2");
- assert(py_mod_bt2);
+ BT_ASSERT(py_mod_bt2);
py_mod_bt2_exc_error_type =
PyObject_GetAttrString(py_mod_bt2, "Error");
- assert(py_mod_bt2_exc_error_type);
+ BT_ASSERT(py_mod_bt2_exc_error_type);
py_mod_bt2_exc_unsupported_feature_type =
PyObject_GetAttrString(py_mod_bt2, "UnsupportedFeature");
- assert(py_mod_bt2_exc_unsupported_feature_type);
+ BT_ASSERT(py_mod_bt2_exc_unsupported_feature_type);
py_mod_bt2_exc_try_again_type =
PyObject_GetAttrString(py_mod_bt2, "TryAgain");
- assert(py_mod_bt2_exc_try_again_type);
+ BT_ASSERT(py_mod_bt2_exc_try_again_type);
py_mod_bt2_exc_stop_type =
PyObject_GetAttrString(py_mod_bt2, "Stop");
- assert(py_mod_bt2_exc_stop_type);
+ BT_ASSERT(py_mod_bt2_exc_stop_type);
py_mod_bt2_exc_port_connection_refused_type =
PyObject_GetAttrString(py_mod_bt2, "PortConnectionRefused");
- assert(py_mod_bt2_exc_port_connection_refused_type);
+ BT_ASSERT(py_mod_bt2_exc_port_connection_refused_type);
py_mod_bt2_exc_invalid_query_object_type =
PyObject_GetAttrString(py_mod_bt2, "InvalidQueryObject");
- assert(py_mod_bt2_exc_invalid_query_object_type);
+ BT_ASSERT(py_mod_bt2_exc_invalid_query_object_type);
py_mod_bt2_exc_invalid_query_params_type =
PyObject_GetAttrString(py_mod_bt2, "InvalidQueryParams");
- assert(py_mod_bt2_exc_invalid_query_params_type);
+ BT_ASSERT(py_mod_bt2_exc_invalid_query_params_type);
}
static void bt_py3_cc_exit_handler(void)
struct bt_value *params, void *init_method_data)
{
struct bt_component *comp =
- bt_component_from_private_component(priv_comp);
+ bt_component_from_private(priv_comp);
struct bt_component_class *comp_cls = bt_component_get_class(comp);
enum bt_component_status status = BT_COMPONENT_STATUS_OK;
PyObject *py_cls = NULL;
PyObject *py_comp_ptr = NULL;
(void) init_method_data;
- assert(comp);
- assert(comp_cls);
+ BT_ASSERT(comp);
+ BT_ASSERT(comp_cls);
/*
* Get the user-defined Python class which created this
PyObject *py_comp = bt_private_component_get_user_data(priv_comp);
PyObject *py_method_result = NULL;
- assert(py_comp);
+ BT_ASSERT(py_comp);
/* Call user's _finalize() method */
py_method_result = PyObject_CallMethod(py_comp,
PyObject *py_method_result = NULL;
py_comp = bt_private_component_get_user_data(priv_comp);
- assert(py_comp);
+ BT_ASSERT(py_comp);
py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_priv_port),
SWIGTYPE_p_bt_private_port, 0);
if (!py_self_port_ptr) {
goto error;
}
- assert(PyBool_Check(py_method_result));
+ BT_ASSERT(PyBool_Check(py_method_result));
if (py_method_result == Py_True) {
status = BT_COMPONENT_STATUS_OK;
PyObject *py_method_result = NULL;
py_comp = bt_private_component_get_user_data(priv_comp);
- assert(py_comp);
+ BT_ASSERT(py_comp);
py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_priv_port),
SWIGTYPE_p_bt_private_port, 0);
if (!py_self_port_ptr) {
py_method_result = PyObject_CallMethod(py_comp,
"_port_connected_from_native", "(OO)", py_self_port_ptr,
py_other_port_ptr);
- assert(py_method_result == Py_None);
+ BT_ASSERT(py_method_result == Py_None);
Py_XDECREF(py_self_port_ptr);
Py_XDECREF(py_other_port_ptr);
Py_XDECREF(py_method_result);
PyObject *py_method_result = NULL;
py_comp = bt_private_component_get_user_data(priv_comp);
- assert(py_comp);
+ BT_ASSERT(py_comp);
py_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(priv_port),
SWIGTYPE_p_bt_private_port, 0);
if (!py_port_ptr) {
py_method_result = PyObject_CallMethod(py_comp,
"_port_disconnected_from_native", "(O)", py_port_ptr);
- assert(py_method_result == Py_None);
+ BT_ASSERT(py_method_result == Py_None);
Py_XDECREF(py_port_ptr);
Py_XDECREF(py_method_result);
}
-static struct bt_component_class_query_return bt_py3_cc_query(
+static struct bt_component_class_query_method_return bt_py3_cc_query(
struct bt_component_class *comp_cls,
struct bt_query_executor *query_exec,
const char *object, struct bt_value *params)
PyObject *py_query_func = NULL;
PyObject *py_object = NULL;
PyObject *py_results_addr = NULL;
- struct bt_component_class_query_return ret = {
+ struct bt_component_class_query_method_return ret = {
.status = BT_QUERY_STATUS_OK,
.result = NULL,
};
* reference).
*/
ret.result = (void *) PyLong_AsUnsignedLongLong(py_results_addr);
- assert(!PyErr_Occurred());
- assert(ret.result);
+ BT_ASSERT(!PyErr_Occurred());
+ BT_ASSERT(ret.result);
goto end;
error:
}
static enum bt_notification_iterator_status bt_py3_cc_notification_iterator_init(
- struct bt_private_notification_iterator *priv_notif_iter,
+ struct bt_private_connection_private_notification_iterator *priv_notif_iter,
struct bt_private_port *priv_port)
{
enum bt_notification_iterator_status status =
PyObject *py_init_method_result = NULL;
PyObject *py_iter = NULL;
struct bt_private_component *priv_comp =
- bt_private_notification_iterator_get_private_component(
+ bt_private_connection_private_notification_iterator_get_private_component(
priv_notif_iter);
PyObject *py_comp;
- assert(priv_comp);
+ BT_ASSERT(priv_comp);
py_comp = bt_private_component_get_user_data(priv_comp);
/* Find user's Python notification iterator class */
}
py_iter_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(priv_notif_iter),
- SWIGTYPE_p_bt_private_notification_iterator, 0);
+ SWIGTYPE_p_bt_private_connection_private_notification_iterator, 0);
if (!py_iter_ptr) {
BT_LOGE_STR("Failed to create a SWIG pointer object.");
goto error;
* owns a native bt_notification_iterator object (iter)
* owns a _UserNotificationIterator instance (py_iter)
* self._ptr is a borrowed reference to the
- * native bt_private_notification_iterator
+ * native bt_private_connection_private_notification_iterator
* object (iter)
*/
- bt_private_notification_iterator_set_user_data(priv_notif_iter,
+ bt_private_connection_private_notification_iterator_set_user_data(priv_notif_iter,
py_iter);
py_iter = NULL;
goto end;
}
static void bt_py3_cc_notification_iterator_finalize(
- struct bt_private_notification_iterator *priv_notif_iter)
+ struct bt_private_connection_private_notification_iterator *priv_notif_iter)
{
PyObject *py_notif_iter =
- bt_private_notification_iterator_get_user_data(priv_notif_iter);
+ bt_private_connection_private_notification_iterator_get_user_data(priv_notif_iter);
PyObject *py_method_result = NULL;
- assert(py_notif_iter);
+ BT_ASSERT(py_notif_iter);
/* Call user's _finalize() method */
py_method_result = PyObject_CallMethod(py_notif_iter,
Py_DECREF(py_notif_iter);
}
-static struct bt_notification_iterator_next_return
+static struct bt_notification_iterator_next_method_return
bt_py3_cc_notification_iterator_next(
- struct bt_private_notification_iterator *priv_notif_iter)
+ struct bt_private_connection_private_notification_iterator *priv_notif_iter)
{
- struct bt_notification_iterator_next_return next_ret = {
+ struct bt_notification_iterator_next_method_return next_ret = {
.status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
.notification = NULL,
};
PyObject *py_notif_iter =
- bt_private_notification_iterator_get_user_data(priv_notif_iter);
+ bt_private_connection_private_notification_iterator_get_user_data(priv_notif_iter);
PyObject *py_method_result = NULL;
- assert(py_notif_iter);
+ BT_ASSERT(py_notif_iter);
py_method_result = PyObject_CallMethod(py_notif_iter,
"_next_from_native", NULL);
if (!py_method_result) {
next_ret.status = bt_py3_exc_to_notif_iter_status();
- assert(next_ret.status != BT_NOTIFICATION_ITERATOR_STATUS_OK);
+ BT_ASSERT(next_ret.status != BT_NOTIFICATION_ITERATOR_STATUS_OK);
goto end;
}
py_method_result);
/* Clear potential overflow error; should never happen */
- assert(!PyErr_Occurred());
- assert(next_ret.notification);
+ BT_ASSERT(!PyErr_Occurred());
+ BT_ASSERT(next_ret.notification);
goto end;
end:
PyObject *py_method_result = NULL;
enum bt_component_status status;
- assert(py_comp);
+ BT_ASSERT(py_comp);
py_method_result = PyObject_CallMethod(py_comp,
"_consume", NULL);
status = bt_py3_exc_to_component_status();
}
ret = bt_component_class_set_init_method(cc, bt_py3_cc_init);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
ret = bt_component_class_set_finalize_method(cc, bt_py3_cc_finalize);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
ret = bt_component_class_set_accept_port_connection_method(cc,
bt_py3_cc_accept_port_connection);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
ret = bt_component_class_set_port_connected_method(cc,
bt_py3_cc_port_connected);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
ret = bt_component_class_set_port_disconnected_method(cc,
bt_py3_cc_port_disconnected);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
ret = bt_component_class_set_query_method(cc, bt_py3_cc_query);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
end:
return ret;
ret = set_notif_iter_init_method(
cc, bt_py3_cc_notification_iterator_init);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
ret = set_notif_iter_finalize_method(
cc, bt_py3_cc_notification_iterator_finalize);
- assert(ret == 0);
+ BT_ASSERT(ret == 0);
}
static struct bt_component_class *bt_py3_component_class_source_create(
struct bt_component_class *cc;
int ret;
- assert(py_cls);
+ BT_ASSERT(py_cls);
cc = bt_component_class_source_create(name,
bt_py3_cc_notification_iterator_next);
if (!cc) {
struct bt_component_class *cc;
int ret;
- assert(py_cls);
+ BT_ASSERT(py_cls);
cc = bt_component_class_filter_create(name,
bt_py3_cc_notification_iterator_next);
if (!cc) {
struct bt_component_class *cc;
int ret;
- assert(py_cls);
+ BT_ASSERT(py_cls);
cc = bt_component_class_sink_create(name, bt_py3_cc_sink_consume);
if (!cc) {
BT_LOGE_STR("Cannot create sink component class.");