VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
vrs::RecordFormatRegistrar Class Reference

Utility class to handle record format registry manipulations. More...

#include <LegacyFormatsProvider.h>

Public Member Functions

void getLegacyRecordFormats (RecordableTypeId id, RecordFormatMap &outFormats)
 
unique_ptr< DataLayoutgetLegacyDataLayout (const ContentBlockId &blockId)
 
unique_ptr< DataLayoutgetLatestDataLayout (RecordableTypeId typeId, Record::Type recordType)
 
bool addLegacyRecordFormat (RecordableTypeId typeId, Record::Type recordType, uint32_t formatVersion, const RecordFormat &format, const vector< const DataLayout * > &layouts)
 

Static Public Member Functions

static void registerProvider (unique_ptr< LegacyFormatsProvider > provider)
 
static RecordFormatRegistrargetInstance ()
 

Detailed Description

Utility class to handle record format registry manipulations.

Member Function Documentation

◆ addLegacyRecordFormat()

bool vrs::RecordFormatRegistrar::addLegacyRecordFormat ( RecordableTypeId  typeId,
Record::Type  recordType,
uint32_t  formatVersion,
const RecordFormat format,
const vector< const DataLayout * > &  layouts 
)

VRS internal method to register a legacy record format. Do not call directly.

◆ getInstance()

RecordFormatRegistrar & vrs::RecordFormatRegistrar::getInstance ( )
static

Access the legacy format registry's singleton.

Returns
RecordFormatRegistrar singleton.

◆ getLatestDataLayout()

unique_ptr< DataLayout > vrs::RecordFormatRegistrar::getLatestDataLayout ( RecordableTypeId  typeId,
Record::Type  recordType 
)

Get the newest legacy DataLayout definition for a recordable type id & record type. "Latest" makes the assumption, generally true but not guaranteed, that record versions are numeric values increasing over time. Also, if the "most recent" RecordFormat definition includes multiple DataLayout blocks, the last one is returned, which is also arbitrary, but generally what's needed. These approximations are OK, because this API is meant to dig out legacy DataLayout definitions that include metadata definitions, such as unit & description, mix & max values, to be used for UI purposes when the DataLayout definition found in a file doesn't provide that information. Therefore, approximate matches are better than nothing.

◆ getLegacyDataLayout()

unique_ptr< DataLayout > vrs::RecordFormatRegistrar::getLegacyDataLayout ( const ContentBlockId blockId)

Provide DataLayout definitions for a specific ContentBlockId.

Parameters
blockIdSpecific content block.
See also
ContentBlockId.
Returns
DataLayout definition, or nullptr, if none can be provided.

◆ getLegacyRecordFormats()

void vrs::RecordFormatRegistrar::getLegacyRecordFormats ( RecordableTypeId  id,
RecordFormatMap outFormats 
)

Use all the registered providers to get the RecordFormat definitions for a specific RecordableTypeId.

Parameters
idThe RecordableTypeId to provider the formats for.
outFormatsMap to be set the RecordFormat definitions.

◆ registerProvider()

void vrs::RecordFormatRegistrar::registerProvider ( unique_ptr< LegacyFormatsProvider provider)
static

Register a provider. Do this before reading a VRS file.

Parameters
providerThe provider to register.

The documentation for this class was generated from the following files: