return ds_file_info;
}
-ctf_fs_ds_file_group::UP ctf_fs_ds_file_group_create(struct ctf_fs_trace *ctf_fs_trace,
- struct ctf_stream_class *sc,
- uint64_t stream_instance_id,
- ctf_fs_ds_index index)
-{
- ctf_fs_ds_file_group::UP ds_file_group {new ctf_fs_ds_file_group};
-
- ds_file_group->index = std::move(index);
-
- ds_file_group->stream_id = stream_instance_id;
- BT_ASSERT(sc);
- ds_file_group->sc = sc;
- ds_file_group->ctf_fs_trace = ctf_fs_trace;
-
- return ds_file_group;
-}
-
void ctf_fs_ds_file_group::insert_ds_file_info_sorted(ctf_fs_ds_file_info::UP ds_file_info)
{
/* Find the spot where to insert this ds_file_info. */
{
using UP = std::unique_ptr<ctf_fs_ds_file_group>;
+ explicit ctf_fs_ds_file_group(struct ctf_fs_trace * const trace,
+ ctf_stream_class * const scParam, const uint64_t streamInstanceId,
+ ctf_fs_ds_index indexParam) noexcept :
+
+ sc {scParam},
+ stream_id(streamInstanceId), ctf_fs_trace {trace}, index {std::move(indexParam)}
+
+ {
+ }
+
/*
* Insert ds_file_info in the list of ds_file_infos at the right
* place to keep it sorted.
ctf_fs_ds_file_info::UP ctf_fs_ds_file_info_create(const char *path, int64_t begin_ns);
-ctf_fs_ds_file_group::UP ctf_fs_ds_file_group_create(struct ctf_fs_trace *ctf_fs_trace,
- struct ctf_stream_class *sc,
- uint64_t stream_instance_id,
- ctf_fs_ds_index index);
-
/*
* Medium operations to iterate on a single ctf_fs_ds_file.
*
* there's no timestamp to order the file within its
* group.
*/
- auto new_ds_file_group =
- ctf_fs_ds_file_group_create(ctf_fs_trace, sc, UINT64_C(-1), std::move(*index));
-
- if (!new_ds_file_group) {
- return -1;
- }
-
- new_ds_file_group->insert_ds_file_info_sorted(std::move(ds_file_info));
- ctf_fs_trace->ds_file_groups.emplace_back(std::move(new_ds_file_group));
+ ctf_fs_trace->ds_file_groups.emplace_back(bt2s::make_unique<ctf_fs_ds_file_group>(
+ ctf_fs_trace, sc, UINT64_C(-1), std::move(*index)));
+ ctf_fs_trace->ds_file_groups.back()->insert_ds_file_info_sorted(std::move(ds_file_info));
return 0;
}
}
}
- ctf_fs_ds_file_group::UP new_ds_file_group;
-
if (!ds_file_group) {
- new_ds_file_group =
- ctf_fs_ds_file_group_create(ctf_fs_trace, sc, stream_instance_id, std::move(*index));
- if (!new_ds_file_group) {
- return -1;
- }
-
- ds_file_group = new_ds_file_group.get();
- ctf_fs_trace->ds_file_groups.emplace_back(std::move(new_ds_file_group));
+ ctf_fs_trace->ds_file_groups.emplace_back(bt2s::make_unique<ctf_fs_ds_file_group>(
+ ctf_fs_trace, sc, static_cast<std::uint64_t>(stream_instance_id), std::move(*index)));
+ ds_file_group = ctf_fs_trace->ds_file_groups.back().get();
} else {
merge_ctf_fs_ds_indexes(ds_file_group->index, *index);
}
dest_trace->metadata->tc, src_group->sc->id);
BT_ASSERT(sc);
- auto new_dest_group =
- ctf_fs_ds_file_group_create(dest_trace, sc, src_group->stream_id, {});
-
- if (!new_dest_group) {
- return -1;
- }
-
- dest_group = new_dest_group.get();
- dest_trace->ds_file_groups.emplace_back(std::move(new_dest_group));
+ dest_trace->ds_file_groups.emplace_back(bt2s::make_unique<ctf_fs_ds_file_group>(
+ dest_trace, sc, src_group->stream_id, ctf_fs_ds_index {}));
+ dest_group = dest_trace->ds_file_groups.back().get();
}
BT_ASSERT(dest_group);