Drake
SampleTranslator Class Referencefinal

Translates between LCM message objects and VectorBase objects for the Sample type. More...

#include <drake/tools/vector_gen/test/goal/sample_translator.h>

Public Member Functions

 SampleTranslator ()
 
std::unique_ptr< drake::systems::BasicVector< double > > AllocateOutputVector () const final
 Allocates the vector storage for an output port of our LCM message type, in case special storage is needed. More...
 
void Deserialize (const void *lcm_message_bytes, int lcm_message_length, drake::systems::VectorBase< double > *vector_base) const final
 Translates LCM message bytes into a drake::systems::VectorBase object. More...
 
void Serialize (double time, const drake::systems::VectorBase< double > &vector_base, std::vector< uint8_t > *lcm_message_bytes) const final
 Translates a drake::systems::VectorBase object into LCM message bytes. More...
 
- Public Member Functions inherited from LcmAndVectorBaseTranslator
 LcmAndVectorBaseTranslator (int size)
 The constructor. More...
 
virtual ~LcmAndVectorBaseTranslator ()
 
int get_vector_size () const
 Returns the size of the vector in the drake::systems::VectorBase object. More...
 
 LcmAndVectorBaseTranslator (const LcmAndVectorBaseTranslator &)=delete
 
LcmAndVectorBaseTranslatoroperator= (const LcmAndVectorBaseTranslator &)=delete
 
 LcmAndVectorBaseTranslator (LcmAndVectorBaseTranslator &&)=delete
 
LcmAndVectorBaseTranslatoroperator= (LcmAndVectorBaseTranslator &&)=delete
 

Detailed Description

Translates between LCM message objects and VectorBase objects for the Sample type.

Constructor & Destructor Documentation

SampleTranslator ( )
inline

Member Function Documentation

std::unique_ptr< drake::systems::BasicVector< double > > AllocateOutputVector ( ) const
finalvirtual

Allocates the vector storage for an output port of our LCM message type, in case special storage is needed.

A result of nullptr indicates that no special vector is needed; the calling code can and should use a default vector implementation such as BasicVector.

The default implementation in this class returns nullptr. Subclasses that require custom VectorBase subtypes should override it.

Reimplemented from LcmAndVectorBaseTranslator.

void Deserialize ( const void *  lcm_message_bytes,
int  lcm_message_length,
drake::systems::VectorBase< double > *  vector_base 
) const
finalvirtual

Translates LCM message bytes into a drake::systems::VectorBase object.

Parameters
[in]lcm_message_bytesA pointer to a buffer holding the LCM message's data.
[in]lcm_message_lengthThe number of bytes pointed to by the lcm_message_bytes.
[out]vector_baseA pointer to where the translation of the LCM message should be stored. This pointer must not be nullptr.
Exceptions
runtime_errorIf a received LCM message failed to be decoded, or if the decoded LCM message is incompatible with the vector_base. This often occurs when the size of the vector_base does not equal or is incompatible with the size of the decoded LCM message.

Implements LcmAndVectorBaseTranslator.

void Serialize ( double  time,
const drake::systems::VectorBase< double > &  vector_base,
std::vector< uint8_t > *  lcm_message_bytes 
) const
finalvirtual

Translates a drake::systems::VectorBase object into LCM message bytes.

Parameters
[in]timeThe current time in seconds. This value is typically obtained from drake::systems::Context::get_time().
[in]vector_baseThe object to convert into an LCM message.
[out]lcm_message_bytesThe LCM message bytes. This pointer must not be nullptr.

Implements LcmAndVectorBaseTranslator.


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