VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Enumerations | Functions
vrs::DescriptionRecord Namespace Reference

Helper functions to read & write description records. More...

Enumerations

enum  { kLegacyDescriptionFormatVersion = 1 , kDescriptionFormatVersion = 2 }
 Description record format version. More...
 

Functions

int writeDescriptionRecord (WriteFileHandler &file, const map< StreamId, const StreamTags * > &streamTags, const map< string, string > &fileTags, uint32_t &outPreviousRecordSize)
 
int readDescriptionRecord (FileHandler &file, uint32_t recordHeaderSize, uint32_t &outDescriptionRecordSize, map< StreamId, StreamTags > &outStreamTags, map< string, string > &outFileTags)
 
void upgradeStreamTags (map< string, string > &streamTags)
 
void createStreamSerialNumbers (const map< string, string > &inFileTags, map< StreamId, StreamTags > &inOutStreamTags)
 

Detailed Description

Helper functions to read & write description records.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Description record format version.

Enumerator
kLegacyDescriptionFormatVersion 

legacy description record format, json based.

kDescriptionFormatVersion 

current description record format.

Function Documentation

◆ createStreamSerialNumbers()

void vrs::DescriptionRecord::createStreamSerialNumbers ( const map< string, string > &  inFileTags,
map< StreamId, StreamTags > &  inOutStreamTags 
)

Streams did not always have a serial number generated at creation. To simplify backward compatibility with existing files, when opening a file, we generate a deterministic serial number for each stream, if there isn't one already. That serial number is a hash of the file tags, that stream's tags, and the stream's type and sequence number, so that reprocessed or split files generate the same serial numbers.

Parameters
inFileTagsthe file's tags.
inOutStreamTagsstream tags with or without serial numbers. On exit, every stream will have a unique serial number, preserving existing values.

◆ readDescriptionRecord()

int vrs::DescriptionRecord::readDescriptionRecord ( FileHandler file,
uint32_t  recordHeaderSize,
uint32_t &  outDescriptionRecordSize,
map< StreamId, StreamTags > &  outStreamTags,
map< string, string > &  outFileTags 
)

Read a description record, including both the record's header and the record's body.

◆ upgradeStreamTags()

void vrs::DescriptionRecord::upgradeStreamTags ( map< string, string > &  streamTags)

Tags may need to be upgraded/cleaned-up. Currently, this process consists simply of making sure the original stream's name saved in VRS tags are stripped of a potential instance number, which used to be included. This clean-up is required for checksums compares to work as expected.

◆ writeDescriptionRecord()

int vrs::DescriptionRecord::writeDescriptionRecord ( WriteFileHandler file,
const map< StreamId, const StreamTags * > &  streamTags,
const map< string, string > &  fileTags,
uint32_t &  outPreviousRecordSize 
)

Write a description record, including both the record's header and the record's body.