![]() |
VRS
A file format for sensor data.
|
Specialized DataLayout class to declare a DataLayout in struct format. More...
#include <DataLayout.h>
Additional Inherited Members | |
![]() | |
DataLayout & | operator= (const DataLayout &)=delete |
DataLayout (const DataLayout &)=delete | |
virtual | ~DataLayout () |
ContentBlock | getContentBlock () const |
vector< int8_t > & | getFixedData () |
vector< int8_t > & | getVarData () |
size_t | getFixedDataSizeNeeded () const |
size_t | getVarDataSizeFromIndex () const |
size_t | getVarDataSizeNeeded () const |
void | collectVariableDataAndUpdateIndex () |
void | collectVariableDataAndUpdateIndex (void *destination) |
void | getRawData (vector< int8_t > &outRawData) const |
void | stageCurrentValues () |
bool | copyClonedDataPieceValues (const DataLayout &originalLayout) |
bool | mapLayout (DataLayout &targetLayout) |
bool | isMapped () const |
bool | hasAllRequiredPieces () const |
void | requireAllPieces () |
Mark all the fields of the layout as required. | |
void | printLayout (ostream &out, const string &indent="") const |
void | printLayoutCompact (ostream &out, const string &indent="") const |
string | asJson (JsonFormatProfile profile) const |
string | asJson (const JsonFormatProfileSpec &profile=JsonFormatProfileSpec()) const |
string | getListOfPiecesSpec () const |
Get a text list of fields, types & names, one per line. Useful for tests. | |
bool | isSame (const DataLayout &otherLayout) const |
template<class T > | |
const DataPieceValue< T > * | findDataPieceValue (const string &label) const |
template<class T > | |
DataPieceValue< T > * | findDataPieceValue (const string &label) |
template<class T > | |
const DataPieceArray< T > * | findDataPieceArray (const string &label, size_t arraySize) const |
template<class T > | |
DataPieceArray< T > * | findDataPieceArray (const string &label, size_t arraySize) |
template<class T > | |
const DataPieceVector< T > * | findDataPieceVector (const string &label) const |
template<class T > | |
DataPieceVector< T > * | findDataPieceVector (const string &label) |
template<class T > | |
const DataPieceStringMap< T > * | findDataPieceStringMap (const string &label) const |
template<class T > | |
DataPieceStringMap< T > * | findDataPieceStringMap (const string &label) |
const DataPieceString * | findDataPieceString (const string &label) const |
DataPieceString * | findDataPieceString (const string &label) |
void | forEachDataPiece (const std::function< void(const DataPiece *)> &, DataPieceType type=DataPieceType::Undefined) const |
void | forEachDataPiece (const std::function< void(DataPiece *)> &, DataPieceType type=DataPieceType::Undefined) |
Same as above, but as a non-const version. | |
bool | isVarDataIndexValid () const |
size_t | getDeclaredFixedDataPiecesCount () const |
size_t | getDeclaredVarDataPiecesCount () const |
size_t | getAvailableFixedDataPiecesCount () const |
size_t | getAvailableVarDataPiecesCount () const |
![]() | |
static unique_ptr< DataLayout > | makeFromJson (const string &json) |
![]() | |
static const size_t | kNotFound = numeric_limits<size_t>::max() |
Special OffsetAndLength offset value marking that a piece of data isn't available. | |
static const size_t | kVariableSize = numeric_limits<size_t>::max() - 1 |
Special value used for a DataPiece size, telling that that DataPiece has a variable size. | |
![]() | |
template<class T > | |
T * | getFixedData (size_t offset, size_t size) |
const IndexEntry * | getVarSizeIndex () const |
IndexEntry * | getVarSizeIndex () |
template<class T > | |
T * | getVarData (size_t varPieceIndex, size_t &outCount) |
void | initLayout () |
void | serialize (JsonWrapper &rj, const JsonFormatProfileSpec &profile) const |
![]() | |
static bool | mapPieces (const vector< DataPiece * > &searchPieces, const vector< DataPiece * > &givenPieces) |
![]() | |
vector< DataPiece * > | fixedSizePieces_ |
Ordered fixed-size DataPieces. | |
vector< DataPiece * > | varSizePieces_ |
Ordered variable-size DataPieces. | |
vector< int8_t > | fixedData_ |
Buffer to hold fixed-size pieces, and the index of var size pieces (if any). | |
size_t | fixedDataSizeNeeded_ {} |
Byte count for all the fixed size pieces + var size index. | |
vector< int8_t > | varData_ |
Buffer holding variable-size pieces, after they've been collected, or read from disk. | |
bool | hasAllRequiredPieces_ {true} |
Tells all the required pieces have been mapped successfully. | |
DataLayout * | mappedDataLayout_ {} |
DataLayout this layout has been mapped to, if any. | |
Specialized DataLayout class to declare a DataLayout in struct format.
To create an automatically generated DataLayout class, inherit from AutoDataLayout, then declare the specialized DataPiece objects as members, and finalize the DataLayout by using an AutoDataLayoutEnd object as the last class member. All the DataPiece objects will be automatically registered in the DataLayout, allowing the DataLayout to references all its DataPiece objects.
Example:
class MyConfig : public AutoDataLayout { DataPieceValue<uint32_t> exposureMode{"exposure_mode"}; DataPieceValue<int8_t> serial{"serial_number", 12}; // array of 12 int8_t values DataPieceString description{"description"}; AutoDataLayoutEnd end; };
Be very careful to always match each AutoDataLayout with an AutoDataLayoutEnd member!