![]() |
VRS
A file format for sensor data.
|
Abstract class representing a piece of information part of a DataLayout. More...
#include <DataPieces.h>
Classes | |
struct | MakerBundle |
Public Member Functions | |
const DataLayout & | getDataLayout () const |
const string & | getLabel () const |
DataPieceType | getPieceType () const |
string | getTypeName () const |
size_t | getOffset () const |
bool | hasFixedSize () const |
size_t | getFixedSize () const |
bool | getTag (const string &tagName, string &outTag) const |
void | setTag (const string &tagName, const string &tag) |
bool | getUnit (string &outUnit) const |
void | setUnit (const string &unit) |
bool | getDescription (string &outDescription) const |
void | setDescription (const string &description) |
void | setRequired (bool required=true) |
bool | isRequired () const |
virtual size_t | getVariableSize () const =0 |
virtual size_t | collectVariableData (int8_t *data, size_t bufferSize)=0 |
virtual const string & | getElementTypeName () const =0 |
virtual bool | isAvailable () const =0 |
virtual void | print (ostream &out, const string &indent="") const =0 |
virtual void | printCompact (ostream &out, const string &indent="") const =0 |
virtual void | serialize (JsonWrapper &jsonWrapper, const JsonFormatProfileSpec &profile) |
virtual bool | stageCurrentValue () |
virtual unique_ptr< DataPiece > | clone () const =0 |
Create a new DataPiece of the same type, with the same label. | |
Protected Member Functions | |
DataPiece (const string &label, DataPieceType type, size_t size) | |
bool | isMatch (const DataPiece &rhs) const |
Match signature only. | |
virtual bool | isSame (const DataPiece *rhs) const |
Match signature & properties (default value, min/max, etc). | |
void | setOffset (size_t offset) |
virtual bool | stageFrom (const DataPiece *original)=0 |
Stage value from another piece known to be of the same type. | |
Protected Attributes | |
const string | label_ |
const DataPieceType | pieceType_ |
const size_t | fixedSize_ |
size_t | offset_ |
DataLayout & | layout_ |
map< string, string > | tags_ |
bool | required_ |
Static Protected Attributes | |
static const string | kUnit = "unit" |
Special tag name to specify a unit of the DataPiece. | |
static const string | kDescription = "description" |
Special tag name to specify a human readable description the DataPiece. | |
static const string | kMinValue = "min" |
Special property name for the minimum value of the DataPiece. | |
static const string | kMaxValue = "max" |
Special property name for the maximum value of the DataPiece. | |
static const string | kMinIncrement = "min_increment" |
Special property name for the minimum increment of the DataPiece. | |
static const string | kMaxIncrement = "max_increment" |
Special property name for the maximum increment of the DataPiece. | |
Friends | |
class | DataLayout |
Abstract class representing a piece of information part of a DataLayout.
DataPiece objects have a type (DataPieceType) and label (a text name), which together are enough to identify uniquely a DataPiece of a particular DataLayout. See DataLayout for more details.
|
protected |
Constructor, called by derived types exclusively.
label | Text name. |
type | A DataPieceType. |
size | Size in bytes of the DataPiece, or the constant: DataLayout::kVariableSize. |
|
pure virtual |
Create a new DataPiece of the same type, with the same label.
Implemented in vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
pure virtual |
Copy the staged variable-size to a location.
data | Pointer where to copy the variable-size data. |
bufferSize | Max number of bytes to copy. |
Implemented in vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
inline |
Get the DataLayout owning this DataPiece.
|
inline |
Get the description of a DataPiece.
outDescription | Reference to a string to set. |
|
pure virtual |
Get the name of the template element type T of the derived template class, or "string" in the case of DataPieceString.
Implemented in vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
inline |
Get the number of bytes needed to store the DataPiece's value.
|
inline |
Get the text label of this DataPiece.
|
inline |
Get the offset of the DataPiece in the DataLayout. For fixed-size DataPiece objects, it's the memory index in the fixed size data buffer. For variable-size DataPiece objects, it's the index of the variable DataPiece. For both: if the DataLayout was mapped to another, but this particular DataPiece could not be mapped in the target DataLayout, the offset value is set to DataLayout::kNotFound.
|
inline |
Get the type of the DataPiece.
bool vrs::DataPiece::getTag | ( | const string & | tagName, |
string & | outTag | ||
) | const |
Get a DataPiece tag.
tagName | Name of the tag to retrieve. |
outTag | Reference to a string to set. |
string vrs::DataPiece::getTypeName | ( | ) | const |
Get the type name of the DataPiece.
|
inline |
Get the unit of a DataPiece.
outUnit | Reference to a string to set. |
|
pure virtual |
Get the size of variable-size DataPiece staged value.
Implemented in vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
inline |
|
pure virtual |
Tell if the DataPiece is available.
Implemented in vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
inline |
Tell if the DataPiece requires to be mapped for the mapping of the DataLayout to be considered successful.
|
protectedvirtual |
Match signature & properties (default value, min/max, etc).
Reimplemented in vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
pure virtual |
Print the DataPiece to the out stream, with many details, using indent text at the start of each line of output.
out | Output stream to print to. |
indent | Text to insert at the beginning of each output line, for indentation purposes. |
Implemented in vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
pure virtual |
Print the DataPiece to the out stream in compact form, using indent text at the start of each line of output.
out | Output stream to print to. |
indent | Text to insert at the beginning of each output line, for indentation purposes. |
Implemented in vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, vrs::DataPieceVector< vrs::MatrixND >, vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
virtual |
Export the DataPiece as json, using a specific profile.
jsonWrapper | Wrapper around a json type (to isolate any 3rd party library dependency). |
profile | Profile describing what information needs to be exported as json. |
Reimplemented in vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
inline |
|
inline |
Specify if the DataPiece is required when mapping to another DataLayout.
required | True if mapping the DataPiece successfully is required. |
|
inline |
Set a DataPiece tag.
tagName | Name of the tag to set. |
tag | Value of the tag. |
|
inline |
|
inlinevirtual |
Take the current value of the field, and stage it for writing during record creation. This operation does nothing for fixed size fields, which value & stage data are the same. For variable size fields, the value is read from the DataLayout's variable size data buffer, and staged as the value to write out.
Reimplemented in vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.
|
protectedpure virtual |
Stage value from another piece known to be of the same type.
Implemented in vrs::DataPieceArray< T >, vrs::DataPieceArray< Matrix3Dd >, vrs::DataPieceValue< T >, vrs::DataPieceValue< ContentBlockSizeType >, vrs::DataPieceValue< double >, vrs::DataPieceValue< float >, vrs::DataPieceValue< ImageSpecType >, vrs::DataPieceValue< Point3Dd >, vrs::DataPieceValue< StorageType >, vrs::DataPieceValue< uint32_t >, vrs::DataPieceValue< uint64_t >, vrs::DataPieceValue< uint8_t >, vrs::DataPieceString, vrs::DataPieceStringMap< T >, vrs::DataPieceStringMap< Matrix4Dd >, vrs::DataPieceStringMap< string >, vrs::DataPieceVector< T >, vrs::DataPieceVector< float >, vrs::DataPieceVector< Point3Df >, vrs::DataPieceVector< string >, and vrs::DataPieceVector< vrs::MatrixND >.