- bt_component_class_initialize_method_status status;
- bt_self_component_add_port_status add_port_status;
- struct fs_sink_comp *fs_sink = NULL;
- bt_self_component *self_comp = bt_self_component_sink_as_self_component(self_comp_sink);
- bt_logging_level log_level =
- bt_component_get_logging_level(bt_self_component_as_component(self_comp));
-
- fs_sink = g_new0(struct fs_sink_comp, 1);
- if (!fs_sink) {
- BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, log_level, self_comp,
- "Failed to allocate one CTF FS sink structure.");
- BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(
- self_comp, "Failed to allocate one CTF FS sink structure.");
- status = BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR;
- goto end;
- }
-
- fs_sink->log_level = log_level;
- fs_sink->self_comp = self_comp;
- fs_sink->output_dir_path = g_string_new(NULL);
- status = configure_component(fs_sink, params);
- if (status != BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK) {
- /* configure_component() logs errors */
- goto end;
- }
+ try {
+ bt_component_class_initialize_method_status status;
+ bt_self_component_add_port_status add_port_status;
+ struct fs_sink_comp *fs_sink = NULL;
+
+ fs_sink = new fs_sink_comp {bt2::wrap(self_comp_sink)};
+ fs_sink->output_dir_path = g_string_new(NULL);
+ status = configure_component(fs_sink, params);
+ if (status != BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK) {
+ /* configure_component() logs errors */
+ goto end;
+ }