VRS
A file format for sensor data.
Loading...
Searching...
No Matches
vrs::internal::DataLayouter Class Reference

Helper class to manage the registration of DataPiece objects within a single DataLayout. More...

Public Member Functions

void dataLayoutBegin (DataLayout &layout)
DataLayout & registerDataPiece (DataPiece *dataPiece)
void dataLayoutEnd ()
void dataLayoutStructStart (const string &structName)
string dataLayoutPieceLabel (string &&label)
void dataLayoutStructEnd (const string &structName)

Static Public Member Functions

static DataLayouter & get ()

Detailed Description

Helper class to manage the registration of DataPiece objects within a single DataLayout.

C++ doesn't support a form of introspection that would allow objects to "find their parent". This technique allows the automatic registration of DataPiece objects.

  • call dataLayoutBegin(layout) to start registering DataPiece objects with a layout object.
  • create DataPiece objects, which will automatically call registerDataPiece(dataPiece).
  • call dataLayoutEnd() to end the registration. Each thread has its own DataLayouter instance, so DataLayout objects can be constructed concurrently in different threads, but the construction of a DataLayout must begin and end in the same thread. This class is purely internal to VRS, and nothing outside of VRS should ever rely on it. This is one of the reasons why it's only declared & defined in the same cpp file.

Member Function Documentation

◆ dataLayoutBegin()

void vrs::internal::DataLayouter::dataLayoutBegin ( DataLayout & layout)
inline

Start auto-registration of DataPiece objects in the provided DataLayout. You must guarantee that this call is matched by a call to dataLayoutEnd() in the same thread. This is called by the constructors of AutoDataLayout and ManualDataLayout.

Parameters
layoutDataLayout all DataPieces created will register themselves with.

◆ dataLayoutEnd()

void vrs::internal::DataLayouter::dataLayoutEnd ( )
inline

End the construction of a DataLayout. This is called by AutoDataLayoutEnd's constructor, and on demand by ManualDataLayout.

◆ dataLayoutPieceLabel()

string vrs::internal::DataLayouter::dataLayoutPieceLabel ( string && label)
inline

Get the actual label of a DataPiece. This method adds a prefix to the label, if the DataPiece belongs to a DataLayoutStruct.

Parameters
labelname requested for the DataPiece.
Returns
The full label for the DataPiece, which may have been prepended with a suffix.

◆ dataLayoutStructEnd()

void vrs::internal::DataLayouter::dataLayoutStructEnd ( const string & structName)
inline

End the construction of a DataPieceStruct.

Parameters
stuctNamename of the structName which construction is being ended.

◆ dataLayoutStructStart()

void vrs::internal::DataLayouter::dataLayoutStructStart ( const string & structName)
inline

Start a sub-structure within a DataLayout, with its own "namespace". The DataPiece objects within that struct will have a label prepended with the namespace. The "namespaces" may be nested, so that you may have a DataLayoutStruct within a DataLayoutStruct.

Parameters
structNamename of the sub-struct, to be added to the prefix namespace.

◆ registerDataPiece()

DataLayout & vrs::internal::DataLayouter::registerDataPiece ( DataPiece * dataPiece)
inline

Called by DataPiece constructor to register themselves in the DataLayout currently constructed.

Parameters
dataPieceReference to the DataPiece to register.
Returns
A reference to the DataLayout being constructed.

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