VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Classes | Functions | Variables
vrs::FileFormat Namespace Reference

Namespace for key datastructures of a VRS file. More...

Classes

struct  FileHeader
 Every file starts with this header, which may grow but not shrink! More...
 
class  LittleEndian
 Placeholder layer for endianness support, if we ever need it. More...
 
struct  RecordHeader
 Every record starts with this header, and is followed by a raw data blob, which semantic is private to the data type handler. More...
 

Functions

RecordableTypeId readRecordableTypeId (const FileFormat::LittleEndian< int32_t > &recordableTypeId)
 
bool printVRSFileInternals (unique_ptr< FileHandler > &file)
 
constexpr uint32_t fourCharCode (char a, char b, char c, char d)
 
bool printVRSFileInternals (std::unique_ptr< FileHandler > &file)
 

Variables

constexpr uint32_t kMagicHeader1 = fourCharCode('V', 'i', 's', 'i')
 
constexpr uint32_t kMagicHeader2 = fourCharCode('o', 'n', 'R', 'e')
 
constexpr uint32_t kMagicHeader3 = fourCharCode('c', 'o', 'r', 'd')
 
constexpr uint32_t kOriginalFileFormatVersion = fourCharCode('V', 'R', 'S', '1')
 Original file format.
 
constexpr uint32_t kFrontIndexFileFormatVersion = fourCharCode('V', 'R', 'S', '2')
 When we added support for place the index record at the beginning of the file.
 
constexpr uint32_t kZstdFormatVersion = fourCharCode('V', 'R', 'S', '3')
 When we added support for ztd compression. Used only briefly.
 

Detailed Description

Namespace for key datastructures of a VRS file.

File format description:

Every file starts with one FileHeader structure. It is followed by an arbitrary number of records. That header gives you the size of the FileHeader and the size of the RecordHeader structures used for all the following records.

Be careful that both FileHeader & RecordHeader structures may grow in the future, so that when you read a file, you must use these given sizes to move around the file, while skipping possible parts of the headers your code doesn't know about.

Each record starts with a RecordHeader structure, which provides sizes so that you can find both the next and the previous record, and implicitly tells you the size of its raw byte blob.

Each RecordHeader a typeId, which tells us what handler knows how to manipulate this data. This typeId is extremely important and must not collide between types!

The RecordHeader gives an instance id, in case multiple streams of data of the same type are needed. Each RecordHeader is immediately followed by a blob of raw bytes, which meaning is only known by the type handler.

The RecordHeader provides a record format version, to be interpreted by the type handler, so that type handlers can handle changes in the format of their data.

The RecordHeader also provides a timestamp for the data, to be used when playing back the data, as well as a Record::Type.

Function Documentation

◆ fourCharCode()

constexpr uint32_t vrs::FileFormat::fourCharCode ( char  a,
char  b,
char  c,
char  d 
)
constexpr

Assemble four letters into a uint32_t to make "good looking" magic numbers on disk... Because we're specific letters, we reduce chances of an accidental match.

◆ printVRSFileInternals()

bool vrs::FileFormat::printVRSFileInternals ( std::unique_ptr< FileHandler > &  file)

Debug method to printout key internal details about a VRS file for debugging purposes.

Returns
True if the file looks "good", false if anything doesn't look right.