Drake
DrakeLcmInterface Class Referenceabstract

A pure virtual interface that enables LCM to be mocked. More...

#include <drake/lcm/drake_lcm_interface.h>

Inheritance diagram for DrakeLcmInterface:
[legend]

Public Member Functions

 DrakeLcmInterface ()=default
 
virtual ~DrakeLcmInterface ()=default
 
virtual void StartReceiveThread ()=0
 Starts the receive thread. More...
 
virtual void StopReceiveThread ()=0
 Stops the receive thread. More...
 
virtual void Publish (const std::string &channel, const void *data, int data_size, double time_sec=0)=0
 Publishes an LCM message on channel channel. More...
 
virtual void Subscribe (const std::string &channel, DrakeLcmMessageHandlerInterface *handler)=0
 Subscribes to an LCM channel without automatic message decoding. More...
 
virtual void DispatchMessageAndAdvanceLog (double)
 Only used for supporting Lcm log playback. More...
 
virtual double GetNextMessageTime () const
 Only used for supporting Lcm log playback. More...
 
Does not allow copy, move, or assignment
 DrakeLcmInterface (const DrakeLcmInterface &)=delete
 
DrakeLcmInterfaceoperator= (const DrakeLcmInterface &)=delete
 
 DrakeLcmInterface (DrakeLcmInterface &&)=delete
 
DrakeLcmInterfaceoperator= (DrakeLcmInterface &&)=delete
 

Detailed Description

A pure virtual interface that enables LCM to be mocked.

Constructor & Destructor Documentation

DrakeLcmInterface ( const DrakeLcmInterface )
delete
DrakeLcmInterface ( )
default
virtual ~DrakeLcmInterface ( )
virtualdefault

Member Function Documentation

virtual void DispatchMessageAndAdvanceLog ( double  )
inlinevirtual

Only used for supporting Lcm log playback.

Default implementation is no-op.

See also
DrakeLcmLog::DispatchMessageAndAdvanceLog

Reimplemented in DrakeLcmLog.

Here is the caller graph for this function:

virtual double GetNextMessageTime ( ) const
inlinevirtual

Only used for supporting Lcm log playback.

Default implementation returns infinity.

See also
DrakeLcmLog::GetNextMessageTime

Reimplemented in DrakeLcmLog.

Here is the caller graph for this function:

DrakeLcmInterface& operator= ( DrakeLcmInterface &&  )
delete
DrakeLcmInterface& operator= ( const DrakeLcmInterface )
delete
virtual void Publish ( const std::string &  channel,
const void *  data,
int  data_size,
double  time_sec = 0 
)
pure virtual

Publishes an LCM message on channel channel.

Parameters
[in]channelThe channel on which to publish the message.
[in]dataA buffer containing the serialized bytes of the message to publish.
[in]data_sizeThe length of in bytes.
[in]time_secTime in seconds when the publish event occurred. Note that this argument is only used when generating a Lcm log.

Implemented in DrakeLcmLog, DrakeMockLcm, and DrakeLcm.

Here is the caller graph for this function:

virtual void StartReceiveThread ( )
pure virtual

Starts the receive thread.

This must be called for subscribers to receive any messages.

Precondition
StartReceiveThread() was not called.

Implemented in DrakeLcmLog, DrakeMockLcm, and DrakeLcm.

Here is the caller graph for this function:

virtual void StopReceiveThread ( )
pure virtual

Stops the receive thread.

This must be called prior to any subscribers being destroyed. Note that the receive thread will be automatically stopped by this class's destructor, so usage of this method will be extremely rare. It will only be needed if this class's instance and the subscribers to LCM channels are owned by different classes. In such a scenario, this method can be used to ensure the receive thread is destroyed before the subscribers are destroyed.

Precondition
StartReceiveThread() was called.

Implemented in DrakeLcmLog, DrakeMockLcm, and DrakeLcm.

virtual void Subscribe ( const std::string &  channel,
DrakeLcmMessageHandlerInterface handler 
)
pure virtual

Subscribes to an LCM channel without automatic message decoding.

The callback method within handler will be invoked when a message arrives on channel channel.

Parameters
[in]channelThe channel to subscribe to.
[in]handlerA class instance whose callback method will be invoked.

Implemented in DrakeMockLcm, DrakeLcmLog, and DrakeLcm.


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