Gazebo Sim

API Reference

8.7.0
ComponentToMsgSerializer< DataType, MsgType > Class Template Reference

Serialization for that converts components data types to gz::msgs. This assumes that convert<DataType> is defined. More...

#include <Serialization.hh>

Static Public Member Functions

static std::istreamDeserialize (std::istream &_in, DataType &_data)
 Deserialization. More...
 
static std::ostreamSerialize (std::ostream &_out, const DataType &_data)
 Serialization. More...
 

Detailed Description

template<typename DataType, typename MsgType>
class gz::sim::serializers::ComponentToMsgSerializer< DataType, MsgType >

Serialization for that converts components data types to gz::msgs. This assumes that convert<DataType> is defined.

Template Parameters
DataTypeUnderlying data type of the component

This can be used for components that can be converted to gz::msg types via convert. For example sdf::Geometry can be converted to msgs::Geometry so the component can be defined as

using Geometry = Component<sdf::Geometry, class GeometryTag,
ComponentToMsgSerializer<sdf::Geometry, msgs::Geometry>>

Member Function Documentation

◆ Deserialize()

static std::istream& Deserialize ( std::istream _in,
DataType &  _data 
)
inlinestatic

Deserialization.

Parameters
[in]_inInput stream.
[out]_datadata to populate
Returns
The stream.

References gz::msgs::Convert().

◆ Serialize()

static std::ostream& Serialize ( std::ostream _out,
const DataType &  _data 
)
inlinestatic

Serialization.

Parameters
[in]_outOutput stream.
[in]_datadata to stream
Returns
The stream.

References gz::msgs::Convert().


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