src.ctf.fs: pass path to ctf_fs_ds_index_entry constructor
[babeltrace.git] / src / plugins / ctf / fs-src / data-stream-file.cpp
index 330e47f55b9932f5dd6793c15757d6d66cf3b235..22aa309f93df6244727a48e2926e113cf3d59c1a 100644 (file)
@@ -506,11 +506,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_
             return bt2s::nullopt;
         }
 
-        ctf_fs_ds_index_entry index_entry {offset, packetSize};
-
-        /* Set path to stream file. */
-        index_entry.path = file_info->path.c_str();
-
+        ctf_fs_ds_index_entry index_entry {file_info->path.c_str(), offset, packetSize};
         index_entry.timestamp_begin = be64toh(file_index->timestamp_begin);
         index_entry.timestamp_end = be64toh(file_index->timestamp_end);
         if (index_entry.timestamp_end < index_entry.timestamp_begin) {
@@ -656,10 +652,7 @@ build_index_from_stream_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_fi
             return bt2s::nullopt;
         }
 
-        ctf_fs_ds_index_entry index_entry {currentPacketOffset, currentPacketSize};
-
-        /* Set path to stream file. */
-        index_entry.path = file_info->path.c_str();
+        ctf_fs_ds_index_entry index_entry {file_info->path, currentPacketOffset, currentPacketSize};
 
         int ret = init_index_entry(index_entry, ds_file, &props);
         if (ret) {
@@ -729,19 +722,18 @@ ctf_fs_ds_file_info::UP ctf_fs_ds_file_info_create(const char *path, int64_t beg
     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)
+void ctf_fs_ds_file_group::insert_ds_file_info_sorted(ctf_fs_ds_file_info::UP ds_file_info)
 {
-    ctf_fs_ds_file_group::UP ds_file_group {new ctf_fs_ds_file_group};
+    /* Find the spot where to insert this ds_file_info. */
+    auto it = this->ds_file_infos.begin();
 
-    ds_file_group->index = std::move(index);
+    for (; it != this->ds_file_infos.end(); ++it) {
+        const ctf_fs_ds_file_info& other_ds_file_info = **it;
 
-    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;
+        if (ds_file_info->begin_ns < other_ds_file_info.begin_ns) {
+            break;
+        }
+    }
 
-    return ds_file_group;
+    this->ds_file_infos.insert(it, std::move(ds_file_info));
 }
This page took 0.050495 seconds and 4 git commands to generate.