![]() |
VRS
A file format for sensor data.
|
Description of the format of a VRS record as a succession of typed blocks of content. More...
#include <RecordFormat.h>
Public Member Functions | |
RecordFormat ()=default | |
Empty record format definition. | |
RecordFormat (const RecordFormat &)=default | |
Default copy constructor. | |
RecordFormat (const string &format) | |
RecordFormat (const char *format) | |
RecordFormat (const ContentBlock &block) | |
Build a RecordFormat from a single ContentBlock. | |
RecordFormat (ContentBlock &&block) | |
Build a RecordFormat from a single ContentBlock. | |
RecordFormat (const ContentBlock &first, const ContentBlock &second) | |
Build a RecordFormat from two ContentBlock definitions. | |
RecordFormat (const ContentBlock &&first, const ContentBlock &&second) | |
Build a RecordFormat from two ContentBlock definitions. | |
RecordFormat (ContentType type, size_t size=ContentBlock::kSizeUnknown) | |
RecordFormat & | operator+ (const ContentBlock &block) |
Append a ContentBlock to this RecordFormat. | |
RecordFormat & | operator+ (ContentBlock &&block) |
Append a ContentBlock to this RecordFormat. | |
RecordFormat & | operator= (const RecordFormat &)=default |
Default copy assignment. | |
bool | operator== (const RecordFormat &rhs) const |
bool | operator!= (const RecordFormat &rhs) const |
void | clear () |
void | set (const string &format) |
string | asString () const |
size_t | getRecordSize () const |
size_t | getUsedBlocksCount () const |
size_t | getBlocksOfTypeCount (ContentType type) const |
const ContentBlock & | getContentBlock (size_t index) const |
const ContentBlock & | getFirstContentBlock () const |
size_t | getRemainingBlocksSize (size_t firstBlock) const |
size_t | getBlockSize (size_t blockIndex, size_t remainingSize) const |
Static Public Member Functions | |
static string | getRecordFormatTagName (Record::Type recordType, uint32_t formatVersion) |
Names of the VRS stream tags used for RecordFormat descriptions. | |
static string | getDataLayoutTagName (Record::Type type, uint32_t version, size_t blockIndex) |
static bool | parseRecordFormatTagName (const string &tagName, Record::Type &recordType, uint32_t &formatVersion) |
static bool | addRecordFormat (map< string, string > &inOutRecordFormatRegister, Record::Type recordType, uint32_t formatVersion, const RecordFormat &format, const vector< const DataLayout * > &layouts) |
static void | getRecordFormats (const map< string, string > &recordFormatRegister, RecordFormatMap &outFormats) |
static unique_ptr< DataLayout > | getDataLayout (const map< string, string > &recordFormatRegister, const ContentBlockId &blockId) |
Description of the format of a VRS record as a succession of typed blocks of content.
A RecordFormat description can be associated with each record type & record format version, so that we can tell how a particular type of VRS record looks like.
Major ContentBlock types include DataLayout blocks and image blocks. See enum class ContentType above for the complete list of ContentBlock types.
See ContentBlock to find out about all the different types of content blocks supported.
|
inline |
Build a RecordFormat from a string description. This constructor is meant for internal VRS usage only.
|
inline |
Build a RecordFormat from a string description. This constructor is meant for internal VRS usage only.
|
inline |
Build a RecordFormat from a simple ContentType & block size.
type | Content type of the block. |
size | Size of the block, or ContentBlock::kSizeUnknown, if the size of the block isn't known/fixed. |
|
static |
VRS internal utility to add record format definitions to a container. This container might be the VRS tags for a Recordable, or a legacy registry.
string vrs::RecordFormat::asString | ( | ) | const |
Convert as a string. For VRS usage only.
size_t vrs::RecordFormat::getBlockSize | ( | size_t | blockIndex, |
size_t | remainingSize | ||
) | const |
Get the size of a particular block, knowing the remaining record size including this block, or ContentBlock::kSizeUnknown.
firstBlock | Size of the first content block to count the size of. |
remainingSize | Number of bytes left in the record for the remaining blocks. |
size_t vrs::RecordFormat::getBlocksOfTypeCount | ( | ContentType | type | ) | const |
Count the number of blocks of a particular type.
type | Content block type to count. |
const ContentBlock & vrs::RecordFormat::getContentBlock | ( | size_t | index | ) | const |
Get a specific ContentBlock. Use getUsedBlocksCount() to know when to stop.
index | The index of the block requested. |
|
inline |
Get first content block.
size_t vrs::RecordFormat::getRecordSize | ( | ) | const |
Get the size of the record, based on RecordFormat information only.
size_t vrs::RecordFormat::getRemainingBlocksSize | ( | size_t | firstBlock | ) | const |
Get the size of all the blocks at and past an index, or ContentBlock::kSizeUnknown.
firstBlock | Size of the first content block to count the size of. |
size_t vrs::RecordFormat::getUsedBlocksCount | ( | ) | const |
Get the number of blocks to read (ignores trailing empty blocks).
|
static |
Tell if a tag name was generated by getRecordFormatTagName, by returning true, and setting recordType & formatVersion. Otherwise, it returns false.
void vrs::RecordFormat::set | ( | const string & | format | ) |
Initialize from a string description. For VRS usage only.