Class PcapIndex¶
Defined in File indexed_pcap_reader.h
Class Documentation¶
-
class PcapIndex¶
Indexing structure for efficient lookup of frames in a PCAP file.
Provides indices to map sensor-specific and global frame numbers to their corresponding byte offsets in the PCAP file. This allows fast random access to lidar frames for analysis or replay.
Public Types
-
using frame_index = std::vector<uint64_t>¶
Maps a frame number to a file offset.
-
using timestamp_index = std::unordered_map<uint64_t, uint64_t>¶
Used to locate packets based on precise capture timestamps.
-
using frame_id_index = std::unordered_map<int32_t, uint64_t>¶
Allows lookup of packet positions based on frame IDs.
Public Functions
-
inline PcapIndex(size_t num_sensors)¶
Constructs a PcapIndex for the specified number of sensors.
Initializes frame indices and timestamp-based indices for each sensor.
- Parameters:
num_sensors[in] The number of sensors captured in the PCAP.
-
void clear()¶
Simple method to clear the index.
-
size_t frame_count(size_t sensor_index) const¶
Returns the number of frames in the frame index for the given sensor index.
- Parameters:
sensor_index[in] The position of the sensor for which to retrieve the desired frame count.
- Returns:
The number of frames in the sensor’s frame index.
-
void seek_to_frame(PcapReader &reader, size_t sensor_index, unsigned int frame_number)¶
Seeks the given reader to the given frame number for the given sensor index.
- Parameters:
reader[inout] The reader to use for seeking.
sensor_index[in] The position of the sensor for which to seek for.
frame_number[in] The frame number to seek to.
Public Members
-
std::vector<frame_index> frame_indices¶
frame index for each sensor
-
std::vector<GlobalIndex> global_frame_indices¶
frame index for all sensors, contains the offset followed by the index of each sensor
-
std::vector<timestamp_index> frame_timestamp_indices¶
Used for efficient lookup of packets based on timestamps.
-
std::vector<frame_id_index> frame_id_indices¶
Used for efficient lookup of packets based on frame IDs.
-
using frame_index = std::vector<uint64_t>¶