![]() |
VRS
A file format for sensor data.
|
Every file starts with this header, which may grow but not shrink! More...
#include <FileFormat.h>
Public Member Functions | |
void | init () |
Initialize the structure's fixed values with default values for a regular VRS file. | |
void | init (uint32_t magic1, uint32_t magic2, uint32_t magic3, uint32_t formatVersion) |
Initialize the structure's fixed values, with configuration options. | |
bool | looksLikeAVRSFile () const |
bool | looksLikeOurFiles (uint32_t magic1, uint32_t magic2, uint32_t magic3) const |
bool | isFormatSupported () const |
void | enableFrontIndexRecordSupport () |
int64_t | getEndOfUserRecordsOffset (int64_t fileSize) const |
Public Attributes | |
LittleEndian< uint32_t > | magicHeader1 |
magic value #1 | |
LittleEndian< uint32_t > | magicHeader2 |
magic value #2 | |
LittleEndian< uint64_t > | creationId |
A timestamp, hopefully unique, to match files (future). | |
LittleEndian< uint32_t > | fileHeaderSize |
This header size, in bytes. | |
LittleEndian< uint32_t > | recordHeaderSize |
Record headers' size, in bytes (same for all). | |
LittleEndian< int64_t > | indexRecordOffset |
Index record offset in the whole file. | |
LittleEndian< int64_t > | descriptionRecordOffset |
Description record offset in the whole file. | |
LittleEndian< int64_t > | firstUserRecordOffset |
LittleEndian< uint64_t > | future2 |
For future use. | |
LittleEndian< uint64_t > | future3 |
For future use. | |
LittleEndian< uint64_t > | future4 |
For future use. | |
LittleEndian< uint32_t > | magicHeader3 |
magic value #3 | |
LittleEndian< uint32_t > | fileFormatVersion |
file format version. | |
Every file starts with this header, which may grow but not shrink!
void vrs::FileFormat::FileHeader::enableFrontIndexRecordSupport | ( | ) |
By default, the index record is written at the end of the file (original behavior), and the first user record is just after the description record. You can reserve space for the index record between the description record and the first user record, so that it is possible the read the file forward only, for streaming. But if you do that, the VRS file can only be read by a newer version of VRS, so you must bump the file version number by calling this method.
int64_t vrs::FileFormat::FileHeader::getEndOfUserRecordsOffset | ( | int64_t | fileSize | ) | const |
Get a best guess as to where user records end. If the file has no index, this value may be inaccurate, but a sensible estimation will be returned (probably the end of the file). Only call this methods for file headers read from an actual VRS file.
fileSize | the size of the VRS file, value returned if no better estimate can be made, or when the file's index is at the start of the file (in which case it is the right answer). |
bool vrs::FileFormat::FileHeader::isFormatSupported | ( | ) | const |
Check if the file format is supported. Might fail if the file was written by a recent version of VRS that changed the file format.
bool vrs::FileFormat::FileHeader::looksLikeAVRSFile | ( | ) | const |
Check the sanity of the file header.
bool vrs::FileFormat::FileHeader::looksLikeOurFiles | ( | uint32_t | magic1, |
uint32_t | magic2, | ||
uint32_t | magic3 | ||
) | const |
Check the sanity of the file header.
LittleEndian<int64_t> vrs::FileFormat::FileHeader::firstUserRecordOffset |
Offset of the first user record in the file. If 0, the first record is just after the description record (original behavior)