Drake
DrakeLcm Class Reference

A wrapper around a real LCM instance. More...

#include <drake/lcm/drake_lcm.h>

Inheritance diagram for DrakeLcm:
[legend]
Collaboration diagram for DrakeLcm:
[legend]

Public Member Functions

 DrakeLcm ()
 
 ~DrakeLcm () override
 A destructor that forces the receive thread to be stopped. More...
 
void StartReceiveThread ()
 Starts the receive thread. More...
 
void StopReceiveThread ()
 Stops the receive thread. More...
 
bool IsReceiveThreadRunning () const
 Indicates that the receiving thread is running. More...
 
::lcm::LCM * get_lcm_instance ()
 An accessor to the real LCM instance encapsulated by this object. More...
 
void Publish (const std::string &channel, const void *data, int data_size, optional< double > time_sec) override
 Publishes an LCM message on channel channel. More...
 
void Subscribe (const std::string &, HandlerFunction) override
 Subscribes to an LCM channel without automatic message decoding. More...
 
void Subscribe (const std::string &, DrakeLcmMessageHandlerInterface *) override
 A deprecated overload of Subscribe. More...
 
Does not allow copy, move, or assignment
 DrakeLcm (const DrakeLcm &)=delete
 
DrakeLcmoperator= (const DrakeLcm &)=delete
 
 DrakeLcm (DrakeLcm &&)=delete
 
DrakeLcmoperator= (DrakeLcm &&)=delete
 
- Public Member Functions inherited from DrakeLcmInterface
virtual ~DrakeLcmInterface ()=default
 
 DrakeLcmInterface (const DrakeLcmInterface &)=delete
 
DrakeLcmInterfaceoperator= (const DrakeLcmInterface &)=delete
 
 DrakeLcmInterface (DrakeLcmInterface &&)=delete
 
DrakeLcmInterfaceoperator= (DrakeLcmInterface &&)=delete
 

Additional Inherited Members

- Public Types inherited from DrakeLcmInterface
using HandlerFunction = std::function< void(const void *, int)>
 A callback used by DrakeLcmInterface::Subscribe(), with arguments: More...
 
- Protected Member Functions inherited from DrakeLcmInterface
 DrakeLcmInterface ()=default
 

Detailed Description

A wrapper around a real LCM instance.

Constructor & Destructor Documentation

DrakeLcm ( const DrakeLcm )
delete
DrakeLcm ( DrakeLcm &&  )
delete
DrakeLcm ( )
~DrakeLcm ( )
override

A destructor that forces the receive thread to be stopped.

Member Function Documentation

lcm::LCM * get_lcm_instance ( )

An accessor to the real LCM instance encapsulated by this object.

The returned pointer is guaranteed to be valid for the duration of this object's lifetime.

Here is the caller graph for this function:

bool IsReceiveThreadRunning ( ) const
inline

Indicates that the receiving thread is running.

Here is the call graph for this function:

DrakeLcm& operator= ( const DrakeLcm )
delete
DrakeLcm& operator= ( DrakeLcm &&  )
delete
void Publish ( const std::string &  channel,
const void *  data,
int  data_size,
optional< double time_sec 
)
overridevirtual

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.

Implements DrakeLcmInterface.

Here is the caller graph for this function:

void StartReceiveThread ( )

Starts the receive thread.

This must be called for subscribers to receive any messages.

Precondition
StartReceiveThread() was not called.

Here is the caller graph for this function:

void StopReceiveThread ( )

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.
void Subscribe ( const std::string &  channel,
HandlerFunction   
)
overridevirtual

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.

Implements DrakeLcmInterface.

Here is the caller graph for this function:

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

A deprecated overload of Subscribe.

Implements DrakeLcmInterface.

Here is the call graph for this function:


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