Drake
DrakeLcmInterface Class Referenceabstract

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

#include <drake/lcm/drake_lcm_interface.h>

Public Types

using HandlerFunction = std::function< void(const void *, int)>
 A callback used by DrakeLcmInterface::Subscribe(), with arguments: More...
 

Public Member Functions

virtual ~DrakeLcmInterface ()=default
 
virtual void Publish (const std::string &channel, const void *data, int data_size, optional< double > time_sec)=0
 Publishes an LCM message on channel channel. More...
 
virtual void Subscribe (const std::string &channel, HandlerFunction)=0
 Subscribes to an LCM channel without automatic message decoding. More...
 
virtual void Subscribe (const std::string &channel, DrakeLcmMessageHandlerInterface *)=0
 A deprecated overload of Subscribe. More...
 
Does not allow copy, move, or assignment
 DrakeLcmInterface (const DrakeLcmInterface &)=delete
 
DrakeLcmInterfaceoperator= (const DrakeLcmInterface &)=delete
 
 DrakeLcmInterface (DrakeLcmInterface &&)=delete
 
DrakeLcmInterfaceoperator= (DrakeLcmInterface &&)=delete
 

Protected Member Functions

 DrakeLcmInterface ()=default
 

Detailed Description

A pure virtual interface that enables LCM to be mocked.

Member Typedef Documentation

◆ HandlerFunction

using HandlerFunction = std::function<void(const void*, int)>

A callback used by DrakeLcmInterface::Subscribe(), with arguments:

  • message_buffer A pointer to the byte vector that is the serial representation of the LCM message.
  • message_size The size of message_buffer.

Constructor & Destructor Documentation

◆ DrakeLcmInterface() [1/3]

DrakeLcmInterface ( const DrakeLcmInterface )
delete

◆ DrakeLcmInterface() [2/3]

◆ ~DrakeLcmInterface()

virtual ~DrakeLcmInterface ( )
virtualdefault

◆ DrakeLcmInterface() [3/3]

DrakeLcmInterface ( )
protecteddefault

Member Function Documentation

◆ operator=() [1/2]

DrakeLcmInterface& operator= ( const DrakeLcmInterface )
delete

◆ operator=() [2/2]

DrakeLcmInterface& operator= ( DrakeLcmInterface &&  )
delete

◆ Publish()

virtual void Publish ( const std::string &  channel,
const void *  data,
int  data_size,
optional< double time_sec 
)
pure virtual

Publishes an LCM message on channel channel.

Parameters
[in]channelThe channel on which to publish the message. Must not be the empty string.
[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. If unknown, use drake::nullopt or a default-constructed optional.

Implemented in DrakeLcm, DrakeLcmLog, and DrakeMockLcm.

◆ Subscribe() [1/2]

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

Subscribes to an LCM channel without automatic message decoding.

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

Parameters
channelThe channel to subscribe to. Must not be the empty string.

Implemented in DrakeMockLcm, DrakeLcm, and DrakeLcmLog.

◆ Subscribe() [2/2]

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

A deprecated overload of Subscribe.

Implemented in DrakeMockLcm, DrakeLcm, and DrakeLcmLog.


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