struct ctf_fs_ds_file_group *ds_file_group = NULL;
ctf_fs_ds_file_group::UP new_ds_file_group;
ctf_fs_ds_file_info::UP ds_file_info;
- ctf_fs_ds_index::UP index;
ctf_msg_iter_up msg_iter;
struct ctf_stream_class *sc = NULL;
struct ctf_msg_iter_packet_properties props;
return -1;
}
- index = ctf_fs_ds_file_build_index(ds_file.get(), ds_file_info.get(), msg_iter.get());
+ auto index = ctf_fs_ds_file_build_index(ds_file.get(), ds_file_info.get(), msg_iter.get());
if (!index) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger, "Failed to index CTF stream file \'{}\'",
ds_file->file->path);
* group.
*/
new_ds_file_group =
- ctf_fs_ds_file_group_create(ctf_fs_trace, sc, UINT64_C(-1), std::move(index));
+ ctf_fs_ds_file_group_create(ctf_fs_trace, sc, UINT64_C(-1), std::move(*index));
if (!new_ds_file_group) {
return -1;
if (!ds_file_group) {
new_ds_file_group =
- ctf_fs_ds_file_group_create(ctf_fs_trace, sc, stream_instance_id, std::move(index));
+ 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));
} else {
- merge_ctf_fs_ds_indexes(ds_file_group->index.get(), *index);
+ merge_ctf_fs_ds_indexes(&ds_file_group->index, *index);
}
ds_file_group_insert_ds_file_info_sorted(ds_file_group, std::move(ds_file_info));
}
/* Merge both indexes. */
- merge_ctf_fs_ds_indexes(dest->index.get(), *src->index);
+ merge_ctf_fs_ds_indexes(&dest->index, src->index);
}
/* Merge src_trace's data stream file groups into dest_trace's. */
src_group->sc->id);
BT_ASSERT(sc);
- auto new_dest_group = ctf_fs_ds_file_group_create(dest_trace, sc, src_group->stream_id,
- bt2s::make_unique<ctf_fs_ds_index>());
+ auto new_dest_group =
+ ctf_fs_ds_file_group_create(dest_trace, sc, src_group->stream_id, {});
if (!new_dest_group) {
return -1;
struct ctf_clock_class *default_cc;
BT_ASSERT(ds_file_group);
- const auto index = ds_file_group->index.get();
+ auto& index = ds_file_group->index;
- BT_ASSERT(index);
- BT_ASSERT(!index->entries.empty());
+ BT_ASSERT(!index.entries.empty());
/*
* Iterate over all entries but the last one. The last one is
* fixed differently after.
*/
- for (size_t entry_i = 0; entry_i < index->entries.size() - 1; ++entry_i) {
- auto& curr_entry = index->entries[entry_i];
- const auto& next_entry = index->entries[entry_i + 1];
+ for (size_t entry_i = 0; entry_i < index.entries.size() - 1; ++entry_i) {
+ auto& curr_entry = index.entries[entry_i];
+ const auto& next_entry = index.entries[entry_i + 1];
/*
* 1. Set the current index entry `end` timestamp to
* 2. Fix the last entry by decoding the last event of the last
* packet.
*/
- auto& last_entry = index->entries.back();
+ auto& last_entry = index.entries.back();
BT_ASSERT(ds_file_group->sc->default_clock_class);
default_cc = ds_file_group->sc->default_clock_class;
{
for (const auto& ds_file_group : trace->ds_file_groups) {
struct ctf_clock_class *default_cc;
- const auto index = ds_file_group->index.get();
+ auto& index = ds_file_group->index;
- BT_ASSERT(index);
- BT_ASSERT(!index->entries.empty());
+ BT_ASSERT(!index.entries.empty());
BT_ASSERT(ds_file_group->sc->default_clock_class);
default_cc = ds_file_group->sc->default_clock_class;
* 1. Iterate over the index, starting from the second entry
* (index = 1).
*/
- for (size_t entry_i = 1; entry_i < index->entries.size(); ++entry_i) {
- auto& prev_entry = index->entries[entry_i - 1];
- auto& curr_entry = index->entries[entry_i];
+ for (size_t entry_i = 1; entry_i < index.entries.size(); ++entry_i) {
+ auto& prev_entry = index.entries[entry_i - 1];
+ auto& curr_entry = index.entries[entry_i];
/*
* 2. Set the current entry `begin` timestamp to the
* timestamp of the first event of the current packet.
struct ctf_clock_class *default_cc;
BT_ASSERT(ds_file_group);
- const auto index = ds_file_group->index.get();
+ auto& index = ds_file_group->index;
BT_ASSERT(ds_file_group->sc->default_clock_class);
default_cc = ds_file_group->sc->default_clock_class;
- BT_ASSERT(index);
- BT_ASSERT(!index->entries.empty());
+ BT_ASSERT(!index.entries.empty());
- auto& last_entry = index->entries.back();
+ auto& last_entry = index.entries.back();
/* 1. Fix the last entry first. */
if (last_entry.timestamp_end == 0 && last_entry.timestamp_begin != 0) {
}
/* Iterate over all entries but the last one. */
- for (size_t entry_idx = 0; entry_idx < index->entries.size() - 1; ++entry_idx) {
- auto& curr_entry = index->entries[entry_idx];
- const auto& next_entry = index->entries[entry_idx + 1];
+ for (size_t entry_idx = 0; entry_idx < index.entries.size() - 1; ++entry_idx) {
+ auto& curr_entry = index.entries[entry_idx];
+ const auto& next_entry = index.entries[entry_idx + 1];
if (curr_entry.timestamp_end == 0 && curr_entry.timestamp_begin != 0) {
/*