libcamera  v0.3.1+12-19bbca3c
Supporting cameras in Linux since 2019
Static Public Member Functions | List of all members
libcamera::IPADataSerializer< T > Class Template Reference

IPA Data Serializer. More...

Static Public Member Functions

static std::tuple< std::vector< uint8_t >, std::vector< SharedFD > > serialize (const T &data, ControlSerializer *cs=nullptr)
 Serialize an object into byte vector and fd vector. More...
 
static T deserialize (const std::vector< uint8_t > &data, ControlSerializer *cs=nullptr)
 Deserialize byte vector into an object. More...
 
static T deserialize (std::vector< uint8_t >::const_iterator dataBegin, std::vector< uint8_t >::const_iterator dataEnd, ControlSerializer *cs=nullptr)
 Deserialize byte vector into an object. More...
 
static T deserialize (const std::vector< uint8_t > &data, const std::vector< SharedFD > &fds, ControlSerializer *cs=nullptr)
 Deserialize byte vector and fd vector into an object. More...
 
static T deserialize (std::vector< uint8_t >::const_iterator dataBegin, std::vector< uint8_t >::const_iterator dataEnd, std::vector< SharedFD >::const_iterator fdsBegin, std::vector< SharedFD >::const_iterator fdsEnd, ControlSerializer *cs=nullptr)
 Deserialize byte vector and fd vector into an object. More...
 

Detailed Description

template<typename T>
class libcamera::IPADataSerializer< T >

IPA Data Serializer.

Static template class that provides functions for serializing and deserializing IPA data.

Todo:
Switch to Span instead of byte and fd vector
Todo:
Harden the vector and map deserializer
Todo:
For SharedFDs, instead of storing a validity flag, store an index into the fd array. This will allow us to use views instead of copying.

Member Function Documentation

◆ deserialize() [1/4]

template<typename T >
template< typename T > libcamera::IPADataSerializer< T >::deserialize ( const std::vector< uint8_t > &  data,
ControlSerializer cs = nullptr 
)
static

Deserialize byte vector into an object.

Template Parameters
TType of object to deserialize to
Parameters
[in]dataByte vector to deserialize from
[in]csControlSerializer

This version of deserialize() can be used if the object type T and its members don't have any SharedFD.

cs is only necessary if the object type T or its members contain ControlList or ControlInfoMap.

Returns
The deserialized object

◆ deserialize() [2/4]

template<typename T >
template< typename T > libcamera::IPADataSerializer< T >::deserialize ( std::vector< uint8_t >::const_iterator  dataBegin,
std::vector< uint8_t >::const_iterator  dataEnd,
ControlSerializer cs = nullptr 
)
static

Deserialize byte vector into an object.

Template Parameters
TType of object to deserialize to
Parameters
[in]dataBeginBegin iterator of byte vector to deserialize from
[in]dataEndEnd iterator of byte vector to deserialize from
[in]csControlSerializer

This version of deserialize() can be used if the object type T and its members don't have any SharedFD.

cs is only necessary if the object type T or its members contain ControlList or ControlInfoMap.

Returns
The deserialized object

◆ deserialize() [3/4]

template<typename T >
template< typename T > libcamera::IPADataSerializer< T >::deserialize ( const std::vector< uint8_t > &  data,
const std::vector< SharedFD > &  fds,
ControlSerializer cs = nullptr 
)
static

Deserialize byte vector and fd vector into an object.

Template Parameters
TType of object to deserialize to
Parameters
[in]dataByte vector to deserialize from
[in]fdsFd vector to deserialize from
[in]csControlSerializer

This version of deserialize() (or the iterator version) must be used if the object type T or its members contain SharedFD.

cs is only necessary if the object type T or its members contain ControlList or ControlInfoMap.

Returns
The deserialized object

◆ deserialize() [4/4]

template<typename T >
template< typename T > libcamera::IPADataSerializer< T >::deserialize ( std::vector< uint8_t >::const_iterator  dataBegin,
std::vector< uint8_t >::const_iterator  dataEnd,
std::vector< SharedFD >::const_iterator  fdsBegin,
std::vector< SharedFD >::const_iterator  fdsEnd,
ControlSerializer cs = nullptr 
)
static

Deserialize byte vector and fd vector into an object.

Template Parameters
TType of object to deserialize to
Parameters
[in]dataBeginBegin iterator of byte vector to deserialize from
[in]dataEndEnd iterator of byte vector to deserialize from
[in]fdsBeginBegin iterator of fd vector to deserialize from
[in]fdsEndEnd iterator of fd vector to deserialize from
[in]csControlSerializer

This version of deserialize() (or the vector version) must be used if the object type T or its members contain SharedFD.

cs is only necessary if the object type T or its members contain ControlList or ControlInfoMap.

Returns
The deserialized object

◆ serialize()

template<typename T >
template< typename T > libcamera::IPADataSerializer< T >::serialize ( const T &  data,
ControlSerializer cs = nullptr 
)
static

Serialize an object into byte vector and fd vector.

Template Parameters
TType of object to serialize
Parameters
[in]dataObject to serialize
[in]csControlSerializer

cs is only necessary if the object type T or its members contain ControlList or ControlInfoMap.

Returns
Tuple of byte vector and fd vector, that is the serialized form of data

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