![]() |
VRS
A file format for sensor data.
|
Container of data pointers, to tell where to write data when reading a record. More...
#include <DataReference.h>
Public Member Functions | |
DataReference (void *data1=nullptr, uint32_t size1=0, void *data2=nullptr, uint32_t size2=0) | |
template<class T > | |
DataReference (vector< T > &vectorT, void *data=nullptr, uint32_t size=0) | |
template<class T , class U > | |
DataReference (vector< T > &vectorT, vector< U > &vectorU) | |
template<class T , class U > | |
DataReference (T &object, vector< U > &vectorU) | |
template<class T > | |
DataReference (T &object, void *data=nullptr, uint32_t size=0) | |
void | useRawData (void *data1, uint32_t size1, void *data2=nullptr, uint32_t size2=0) |
template<class T > | |
void | useVector (vector< T > &vectorT, void *data=nullptr, uint32_t size=0) |
template<class T > | |
void | useObject (T &object, void *data=nullptr, uint32_t size=0) |
template<class T , class U > | |
void | useVectors (vector< T > &vectorT, vector< U > &vectorU) |
template<class T , class U > | |
void | useObjects (T &object1, U &object2) |
uint32_t | getSize () const |
void | copyTo (void *destination) const |
int | readFrom (FileHandler &file, uint32_t &outReadSize) |
void * | getDataPtr1 () const |
uint32_t | getDataSize1 () const |
void * | getDataPtr2 () const |
uint32_t | getDataSize2 () const |
Container of data pointers, to tell where to write data when reading a record.
This is essentially a wrapper for two pairs of pointers to a buffer and the size of that buffer, both of which may be null.
Examples:
Reference a single pointer/length:
uint8_t buffer[kBufferLength]; DataReference dataReference(buffer, kBufferLength);
Reference the content of a POD struct:
struct { int value; double otherValue; } someStruct; DataReference dataReference(someStruct);
Reference the content of a struct and a pointer+length:
uint8_t buffer[kBufferLength]; struct { int value; double otherValue; } someStruct; DataReference dataReference(someStruct, buffer, kBufferLength);
|
inlineexplicit |
data1 | Pointer to first block of bytes. |
size1 | Size of first block of bytes. |
data2 | Pointer to second block of bytes. |
size2 | Size of second block of bytes. |
|
inlineexplicit |
vectorT | Vector of POD objects of type T to read. |
data | Pointer to second block of bytes. |
size | Size of second block of bytes. |
|
inline |
vectorT | Vector of POD objects of type T to read. |
vectorU | Vector of POD objects of type U to read. |
|
inline |
object | POD object to read. |
vectorU | Vector of POD objects of type U to read. |
|
inlineexplicit |
object | POD object to read. |
data | Pointer to second block of bytes. |
size | Size of second block of bytes. |
void vrs::DataReference::copyTo | ( | void * | destination | ) | const |
Copy referenced data to a specific location, in one stream of bytes. The destination buffer must be large enough for the entire data.
destination | Pointer where to write everything. |
|
inline |
Get pointer to first chunk of data. Might be nullptr.
|
inline |
Get pointer to second chunk of data. Might be nullptr.
|
inline |
Get size in bytes of the fist chunk of data. Might be 0.
|
inline |
Get size in bytes of the second chunk of data. Might be 0.
|
inline |
int vrs::DataReference::readFrom | ( | FileHandler & | file, |
uint32_t & | outReadSize | ||
) |
Fill the referenced data from a file (uncompressed).
file | Open file to read from. |
outReadSize | Number of bytes actually read. Might be less than the size of the DataReference, if an error occurred. |
|
inline |
object | POD object to read. |
data | Pointer to second block of bytes. |
size | Size of second block of bytes. |
|
inline |
object1 | First POD object to read. |
object2 | Second POD object to read. |
void vrs::DataReference::useRawData | ( | void * | data1, |
uint32_t | size1, | ||
void * | data2 = nullptr , |
||
uint32_t | size2 = 0 |
||
) |
data1 | Pointer to first block of bytes. |
size1 | Size of first block of bytes. |
data2 | Pointer to second block of bytes. |
size2 | Size of second block of bytes. |
|
inline |
vectorT | Vector of POD objects of type T to read. |
data | Pointer to second block of bytes. |
size | Size of second block of bytes. |
|
inline |
vectorT | Vector of POD objects of type T to read. |
vectorU | Vector of POD objects of type U to read. |