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

VRS stream identifier class. More...

#include <StreamId.h>

Public Member Functions

 StreamId (const StreamId &rhs)=default
 
 StreamId (RecordableTypeId typeId, uint16_t instanceId)
 
RecordableTypeId getTypeId () const
 
uint16_t getInstanceId () const
 
StreamIdoperator= (const StreamId &rhs)=default
 
StreamIdoperator= (StreamId &&rhs)=default
 
bool operator== (const StreamId &rhs) const
 
bool operator!= (const StreamId &rhs) const
 
bool operator< (const StreamId &rhs) const
 Compare operator, so that we can use StreamId in containers, with a guarantied behavior.
 
bool isValid () const
 
string getTypeName () const
 
string getName () const
 
string getFullName () const
 
string getNumericName () const
 

Static Public Member Functions

static StreamId fromNumericName (const string &numericName)
 
static StreamId fromNumericNamePlus (const string &numericName)
 
static bool isKnownTypeId (RecordableTypeId typeId)
 
static StreamId lowest ()
 StreamId value guaranteed to be smaller than any valid StreamId object.
 

Detailed Description

VRS stream identifier class.

Identifier for a stream of records, containing a RecordableTypeId and an instance id, so that multiple streams of the same kind can be recorded side-by-side in a VRS file unambiguously.

Note that instance ids are not meant to be controlled, set, or defined by the recording code.

During recording, VRS generates a unique instance id when a recordable is created, to ensure that each recordable has a unique stream id in the whole system. In particular, by design, if you stop recording, destroy the recordables and create new ones, the instance ids generated will keep increasing. Therefore, when discovering the streams in a VRS file, specific instance ids can't be used to recognize different instances of particular RecordableTypeId. Instead, use recordable tags or flavors. The APIs RecordFileReader::getStreamForTag() and RecordFileReader::getStreamForFlavor() can then quickly determine the StreamId for each of the streams in the file.

Member Function Documentation

◆ fromNumericName()

StreamId vrs::StreamId::fromNumericName ( const string &  numericName)
static

Convert from a stream ID numeric string representation

Parameters
numericNamea stream ID name in numeric representation, e.g., "1100-1"
Returns
A stream ID. Use isValid() to know if the conversion succeeded.

◆ fromNumericNamePlus()

StreamId vrs::StreamId::fromNumericNamePlus ( const string &  numericName)
static

Convert from a stream ID numeric string representation with a '+' sign between numbers Useful to parse relative stream IDs, which need a file for complete resolution.

Parameters
numericNamea stream ID name in numeric representation, e.g., "1100+1"
Returns
A stream ID. Use isValid() to know if the conversion succeeded.

◆ getFullName()

string vrs::StreamId::getFullName ( ) const

Get a complete name for the device, combining the numeric name and recordable type name.

Returns
Numeric name and recordable type name.

◆ getInstanceId()

uint16_t vrs::StreamId::getInstanceId ( ) const
inline

Get the instance id.

Returns
Instance id.

◆ getName()

string vrs::StreamId::getName ( ) const

Get a readable name for the device, combining the recordable type name and the instance id.

Returns
English readable recordable name, including the instance id.

◆ getNumericName()

string vrs::StreamId::getNumericName ( ) const

Get a name combining the recordable type and the instance id, as numbers.

Returns
Recordable type ID numeric value and instance ID.

◆ getTypeId()

RecordableTypeId vrs::StreamId::getTypeId ( ) const
inline

Get the recordable type id.

Returns
Recordable type id.

◆ getTypeName()

string vrs::StreamId::getTypeName ( ) const
inline

Get the name of the type of device.

Returns
Descriptive recordable type name.

◆ isKnownTypeId()

bool vrs::StreamId::isKnownTypeId ( RecordableTypeId  typeId)
static

A recording might be using a type id not known by the current version of the code. This should not be problem, but in some situation, in particular display purposes in particular, it can be useful to be able to tell.

◆ isValid()

bool vrs::StreamId::isValid ( ) const
inline

Test if the instance represents device. Useful when an API returns a StreamId, and needs to tell that no device was found.

Returns
True if the instance is valid/found, false otherwise.

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