VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
vrs::DataPieceValue< T > Class Template Reference

DataPiece for a single value of type T. The value is stored in DataLayout's fixed size buffer. More...

#include <DataPieceValue.h>

Inheritance diagram for vrs::DataPieceValue< T >:
vrs::DataPiece vrs::DataPieceEnum< AudioFormat, uint8_t > vrs::DataPieceEnum< AudioSampleFormat, uint8_t > vrs::DataPieceEnum< PixelFormat, ImageSpecType >

Public Member Functions

 DataPieceValue (const string &label)
 
 DataPieceValue (const string &label, T defaultValue)
 
 DataPieceValue (const MakerBundle &bundle)
 
const string & getElementTypeName () const override
 
size_t getVariableSize () const override
 
size_t collectVariableData (int8_t *, size_t) override
 
get () const
 
bool get (T &outValue) const
 
bool set (const T &value)
 
getDefault () const
 
bool getDefault (T &outDefault) const
 
void setDefault (const T &defaultValue)
 
bool getProperty (const string &propertyName, T &outValue) const
 
void setProperty (const string &propertyName, T value)
 
bool getMin (T &outMin) const
 
bool getMax (T &outMax) const
 
bool getMinIncrement (T &outMinIncrement) const
 
bool getMaxIncrement (T &outMaxIncrement) const
 
void setMin (T min)
 
void setMax (T max)
 
void setRange (T min, T max)
 
void setMinIncrement (T minIncrement)
 
void setMaxIncrement (T maxIncrement)
 
void setIncrement (T minIncrement, T maxIncrement)
 
bool isAvailable () const override
 
void print (ostream &out, const string &indent) const override
 
void printCompact (ostream &out, const string &indent) const override
 
bool isSame (const DataPiece *rhs) const override
 
void serialize (JsonWrapper &jsonWrapper, const JsonFormatProfileSpec &profile) override
 
unique_ptr< DataPiececlone () const override
 
- Public Member Functions inherited from vrs::DataPiece
const DataLayoutgetDataLayout () 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 bool stageCurrentValue ()
 

Protected Member Functions

bool stageFrom (const DataPiece *) override
 Stage value from another piece known to be of the same type.
 
- Protected Member Functions inherited from vrs::DataPiece
 DataPiece (const string &label, DataPieceType type, size_t size)
 
bool isMatch (const DataPiece &rhs) const
 Match signature only.
 
void setOffset (size_t offset)
 

Additional Inherited Members

- Protected Attributes inherited from vrs::DataPiece
const string label_
 
const DataPieceType pieceType_
 
const size_t fixedSize_
 
size_t offset_
 
DataLayoutlayout_
 
map< string, string > tags_
 
bool required_
 
- Static Protected Attributes inherited from vrs::DataPiece
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.
 

Detailed Description

template<typename T>
class vrs::DataPieceValue< T >

DataPiece for a single value of type T. The value is stored in DataLayout's fixed size buffer.

Constructor & Destructor Documentation

◆ DataPieceValue() [1/3]

template<typename T >
vrs::DataPieceValue< T >::DataPieceValue ( const string &  label)
inlineexplicit
Parameters
labelName for the DataPiece.

◆ DataPieceValue() [2/3]

template<typename T >
vrs::DataPieceValue< T >::DataPieceValue ( const string &  label,
defaultValue 
)
inline
Parameters
labelName for the DataPiece.
defaultValueDefault value for the DataPiece.

◆ DataPieceValue() [3/3]

template<typename T >
vrs::DataPieceValue< T >::DataPieceValue ( const MakerBundle bundle)
explicit
Parameters
bundleBundle to reconstruct a DataPieceValue from disk.

Member Function Documentation

◆ clone()

template<typename T >
unique_ptr< DataPiece > vrs::DataPieceValue< T >::clone ( ) const
inlineoverridevirtual

Clone data piece.

Returns
A clone of the data piece, with the same label and same type. All the other data piece properties (default value and properties) are not cloned.

Implements vrs::DataPiece.

◆ collectVariableData()

template<typename T >
size_t vrs::DataPieceValue< T >::collectVariableData ( int8_t *  ,
size_t   
)
inlineoverridevirtual

Copy staged variable-size data to a specific location. [doesn't apply].

Implements vrs::DataPiece.

◆ get() [1/2]

template<typename T >
T vrs::DataPieceValue< T >::get ( ) const
inline
Returns
Value or mapped value, or default value if any, or default value for type T.

◆ get() [2/2]

template<typename T >
bool vrs::DataPieceValue< T >::get ( T &  outValue) const
inline

Get value or mapped value, or default value if any, or default value for type T.

Parameters
outValueReference to a variable to set.
Returns
True if outValue was set to the value or the mapped value.

◆ getDefault() [1/2]

template<typename T >
T vrs::DataPieceValue< T >::getDefault ( ) const
inline

Get default value.

Returns
Default value, or default value for type T.

◆ getDefault() [2/2]

template<typename T >
bool vrs::DataPieceValue< T >::getDefault ( T &  outDefault) const
inline

Get default value.

Parameters
referenceReference to a default value to set.
Returns
True if the value was set to default value.

◆ getElementTypeName()

template<typename T >
const string & vrs::DataPieceValue< T >::getElementTypeName ( ) const
inlineoverridevirtual

Get the name of the element type <T>.

Implements vrs::DataPiece.

◆ getMax()

template<typename T >
bool vrs::DataPieceValue< T >::getMax ( T &  outMax) const
inline

Get maximum value.

Parameters
outMaxReference to set to the maximum valid value.
Returns
True if there is maximum value & outMax was set.

◆ getMaxIncrement()

template<typename T >
bool vrs::DataPieceValue< T >::getMaxIncrement ( T &  outMaxIncrement) const
inline

Get maximum increment for this value, between two successive records.

Parameters
outMaxIncrementReference to set to the maximum increment value.
Returns
True if there is maximum increment value & outMaxIncrement was set.

◆ getMin()

template<typename T >
bool vrs::DataPieceValue< T >::getMin ( T &  outMin) const
inline

Get minimum value.

Parameters
outMinReference to set to the minimum valid value.
Returns
True if there is minimum value & outMin was set.

◆ getMinIncrement()

template<typename T >
bool vrs::DataPieceValue< T >::getMinIncrement ( T &  outMinIncrement) const
inline

Get minimum increment for this value, between two successive records.

Parameters
outMinIncrementReference to set to the minimum increment value.
Returns
True if there is minimum increment value & outMinIncrement was set.

◆ getProperty()

template<typename T >
bool vrs::DataPieceValue< T >::getProperty ( const string &  propertyName,
T &  outValue 
) const
inline

Get a property

Parameters
propertyNameName of the property.
outValueReference to a value to set.
Returns
True if the property exists and outValue was set, false otherwise.

◆ getVariableSize()

template<typename T >
size_t vrs::DataPieceValue< T >::getVariableSize ( ) const
inlineoverridevirtual

Get variable-size. 0 here, since this is a fixed size DataPiece. [doesn't apply].

Implements vrs::DataPiece.

◆ isAvailable()

template<typename T >
bool vrs::DataPieceValue< T >::isAvailable ( ) const
inlineoverridevirtual

Tell if a DataPiece value is available.

Returns
True if the value is available, false if the DataPiece could not be mapped.

Implements vrs::DataPiece.

◆ isSame()

template<typename T >
bool vrs::DataPieceValue< T >::isSame ( const DataPiece rhs) const
overridevirtual

Compare two DataPiece objects for their equivalence. Note: the values are not compared, all the other properties are (type, name, tags, etc).

Parameters
rhsOther DataPiece to compare to.
Returns
True if the DataPiece objects are considered the same.

Reimplemented from vrs::DataPiece.

◆ print()

template<typename T >
void vrs::DataPieceValue< T >::print ( ostream &  out,
const string &  indent 
) const
overridevirtual

Print the DataPiece to the out stream, with many details, using indent text at the start of each line of output.

Parameters
outOutput stream to print to.
indentText to insert at the beginning of each output line, for indentation purposes.

Implements vrs::DataPiece.

◆ printCompact()

template<typename T >
void vrs::DataPieceValue< T >::printCompact ( ostream &  out,
const string &  indent 
) const
overridevirtual

Print the DataPiece to the out stream in compact form, using indent text at the start of each line of output.

Parameters
outOutput stream to print to.
indentText to insert at the beginning of each output line, for indentation purposes.

Implements vrs::DataPiece.

◆ serialize()

template<typename T >
void vrs::DataPieceValue< T >::serialize ( JsonWrapper &  jsonWrapper,
const JsonFormatProfileSpec profile 
)
overridevirtual

Export the DataPiece as json, using a specific profile.

Parameters
jsonWrapperWrapper around a json type (to isolate any 3rd party library dependency).
profileProfile describing what information needs to be exported as json.

Reimplemented from vrs::DataPiece.

◆ set()

template<typename T >
bool vrs::DataPieceValue< T >::set ( const T &  value)
inline

Set value in fixed size buffer.

Parameters
valueValue to set the DataPiece to.
Returns
False if the DataLayout is mapped, but this DataPiece is not mapped.

◆ setDefault()

template<typename T >
void vrs::DataPieceValue< T >::setDefault ( const T &  defaultValue)
inline

Set default value.

Parameters
defaultValueValue to use as default.

◆ setIncrement()

template<typename T >
void vrs::DataPieceValue< T >::setIncrement ( minIncrement,
maxIncrement 
)
inline

Set the min & max increment values, between two successive records.

Parameters
minIncrementMinimum increment value.
maxIncrementMaximum increment value. Note: min & max increment checking is a sanity check operation only. This won't prevents users of the API to set the values any way they want.

◆ setMax()

template<typename T >
void vrs::DataPieceValue< T >::setMax ( max)
inline

Set the maximum valid value.

Parameters
maxMaximum valid value. Note: max checking is a sanity check operation only. Nothing prevents users of the API to set the values of the array any way they want.

◆ setMaxIncrement()

template<typename T >
void vrs::DataPieceValue< T >::setMaxIncrement ( maxIncrement)
inline

Set the maximum increment value, between two successive records.

Parameters
maxIncrementMaximum increment value. Note: max increment checking is a sanity check operation only. This won't prevents users of the API to set the values any way they want.

◆ setMin()

template<typename T >
void vrs::DataPieceValue< T >::setMin ( min)
inline

Set the minimum valid value.

Parameters
minMinimum valid value. Note: min checking is a sanity check operation only. Nothing prevents users of the API to set the values of the array any way they want.

◆ setMinIncrement()

template<typename T >
void vrs::DataPieceValue< T >::setMinIncrement ( minIncrement)
inline

Set the minimum increment value, between two successive records.

Parameters
minIncrementMinimum increment value. Note: min increment checking is a sanity check operation only. This won't prevents users of the API to set the values any way they want.

◆ setProperty()

template<typename T >
void vrs::DataPieceValue< T >::setProperty ( const string &  propertyName,
value 
)
inline

Set a property.

Parameters
propertyNameName of the property.
valueValue of the property.

◆ setRange()

template<typename T >
void vrs::DataPieceValue< T >::setRange ( min,
max 
)
inline

Set the min & max valid values.

Parameters
minMinimum valid value.
maxMaximum valid value. Note: min/max checking is a sanity check operation only. Nothing prevents users of the API to set the values of the array any way they want.

◆ stageFrom()

template<typename T >
bool vrs::DataPieceValue< T >::stageFrom ( const DataPiece original)
inlineoverrideprotectedvirtual

Stage value from another piece known to be of the same type.

Implements vrs::DataPiece.


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