Drake
TranslatorBase< DataType, MsgType > Class Template Referenceabstract

Base API for a translator between arbitrary data of DataType and a Lcm message of MsgType. More...

#include <drake/lcm/translator_base.h>

Public Member Functions

 TranslatorBase ()
 
virtual ~TranslatorBase ()
 
virtual const DataType & get_default_data () const =0
 Returns a const reference to the default data value. More...
 
virtual const MsgType & get_default_msg () const =0
 Returns a const reference to the default message value. More...
 
virtual void Encode (const DataType &data, MsgType *msg) const =0
 Encodes data into msg. More...
 
virtual void Decode (const MsgType &msg, DataType *data) const =0
 Decodes msg into data. More...
 
virtual void EncodeTime (double time, MsgType *msg) const
 Encodes time into msg. More...
 
virtual void DecodeTime (const MsgType &msg, double *time) const
 Decodes msg into time. More...
 
Does not allow copy, move, or assignment
 TranslatorBase (const TranslatorBase &)=delete
 
TranslatorBaseoperator= (const TranslatorBase &)=delete
 
 TranslatorBase (TranslatorBase &&)=delete
 
TranslatorBaseoperator= (TranslatorBase &&)=delete
 

Detailed Description

template<typename DataType, typename MsgType>
class drake::lcm::TranslatorBase< DataType, MsgType >

Base API for a translator between arbitrary data of DataType and a Lcm message of MsgType.

This class is intended to facilitate Lcm communication under the System framework. Within the System framework, time can be acquired directly from the Context, so it is not uncommon to omit time from state representations (DataType). Meanwhile, a well defined Lcm message (MsgType) almost always contains an time stamp. Thus, additional time information (often extracted from some Context) can be used for message encoding (from DataType to MsgType). For decoding (from MsgType to DataType), the message's time stamp can be extracted and stored separately.

Note that MsgType is not required to be a Lcm message. In fact, it can be any arbitrary data type as well.

Constructor & Destructor Documentation

TranslatorBase ( const TranslatorBase< DataType, MsgType > &  )
delete
TranslatorBase ( TranslatorBase< DataType, MsgType > &&  )
delete
TranslatorBase ( )
inline
virtual ~TranslatorBase ( )
inlinevirtual

Here is the call graph for this function:

Member Function Documentation

virtual void Decode ( const MsgType &  msg,
DataType *  data 
) const
pure virtual

Decodes msg into data.

Here is the caller graph for this function:

virtual void DecodeTime ( const MsgType &  msg,
double time 
) const
inlinevirtual

Decodes msg into time.

The default implementation does nothing.

Here is the call graph for this function:

virtual void Encode ( const DataType &  data,
MsgType *  msg 
) const
pure virtual

Encodes data into msg.

Here is the caller graph for this function:

virtual void EncodeTime ( double  time,
MsgType *  msg 
) const
inlinevirtual

Encodes time into msg.

The default implementation does nothing.

Here is the call graph for this function:

virtual const DataType& get_default_data ( ) const
pure virtual

Returns a const reference to the default data value.

Here is the caller graph for this function:

virtual const MsgType& get_default_msg ( ) const
pure virtual

Returns a const reference to the default message value.

Here is the caller graph for this function:

TranslatorBase& operator= ( const TranslatorBase< DataType, MsgType > &  )
delete
TranslatorBase& operator= ( TranslatorBase< DataType, MsgType > &&  )
delete

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