Drake
DrakeSubscriptionInterface Class Referenceabstract

Detailed Description

A helper class returned by DrakeLcmInterface::Subscribe() that allows for (possibly automatic) unsubscription and/or queue capacity control.

Refer to that method for additional details.

Instance of this object are always stored in std::shared_ptr to manage them as resources. When a particular DrakeLcmInterface implementation does not support subscription controls, the managed pointer will be nullptr instead of an instance of this object.

To unsubscribe, induce a call to the DrakeSubscriptionInterface destructor by bringing the std::shared_ptr use count to zero. That usually means either a call to subscription.reset() or by allowing it to go out of scope.

To disable unsubscription so that the pointer loss never causes unsubscription, call subscription->set_unsubscribe_on_delete(false). To enable unsubscription, set it to true. Which choice is active by default is specified by whatever method returns this object.

#include <drake/lcm/drake_lcm_interface.h>

Public Member Functions

virtual ~DrakeSubscriptionInterface ()
 
virtual void set_unsubscribe_on_delete (bool enabled)=0
 Sets whether or not the subscription on DrakeLcmInterface will be terminated when this object is deleted. More...
 
virtual void set_queue_capacity (int capacity)=0
 Sets this subscription's queue depth to store messages between calls to DrakeLcmInterface::HandleSubscriptions. More...
 
Does not allow copy, move, or assignment
 DrakeSubscriptionInterface (const DrakeSubscriptionInterface &)=delete
 
DrakeSubscriptionInterfaceoperator= (const DrakeSubscriptionInterface &)=delete
 
 DrakeSubscriptionInterface (DrakeSubscriptionInterface &&)=delete
 
DrakeSubscriptionInterfaceoperator= (DrakeSubscriptionInterface &&)=delete
 

Protected Member Functions

 DrakeSubscriptionInterface ()
 

Constructor & Destructor Documentation

◆ DrakeSubscriptionInterface() [1/3]

◆ DrakeSubscriptionInterface() [2/3]

◆ ~DrakeSubscriptionInterface()

virtual ~DrakeSubscriptionInterface ( )
virtual

◆ DrakeSubscriptionInterface() [3/3]

Member Function Documentation

◆ operator=() [1/2]

DrakeSubscriptionInterface& operator= ( const DrakeSubscriptionInterface )
delete

◆ operator=() [2/2]

◆ set_queue_capacity()

virtual void set_queue_capacity ( int  capacity)
pure virtual

Sets this subscription's queue depth to store messages between calls to DrakeLcmInterface::HandleSubscriptions.

When the queue becomes full, new received messages will be discarded. The default depth is 1.

Warning
The memq:// LCM URL does not support per-channel queues, so this method has no effect when memq is being used, e.g., in Drake unit tests.

◆ set_unsubscribe_on_delete()

virtual void set_unsubscribe_on_delete ( bool  enabled)
pure virtual

Sets whether or not the subscription on DrakeLcmInterface will be terminated when this object is deleted.

It is permitted to call this method many times, with a new enabled value each time.


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