+ component->destroy = destroy;
+end:
+ return ret;
+}
+
+BT_HIDDEN
+enum bt_component_type bt_component_get_type(struct bt_component *component)
+{
+ return component ? component->class->type : BT_COMPONENT_TYPE_UNKNOWN;
+}
+
+struct bt_component *bt_component_create(
+ struct bt_component_class *component_class, const char *name,
+ struct bt_value *params)
+{
+ int ret;
+ struct bt_component *component = NULL;
+ enum bt_component_type type;
+
+ if (!component_class) {
+ goto end;
+ }
+
+ type = bt_component_class_get_type(component_class);
+ if (type <= BT_COMPONENT_TYPE_UNKNOWN ||
+ type >= BT_COMPONENT_TYPE_FILTER) {
+ /* Filter components are not supported yet. */
+ goto end;
+ }
+
+ component = component_create_funcs[type](component_class, params);
+ if (!component) {
+ goto end;
+ }
+