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 | |
DrakeSubscriptionInterface & | operator= (const DrakeSubscriptionInterface &)=delete |
DrakeSubscriptionInterface (DrakeSubscriptionInterface &&)=delete | |
DrakeSubscriptionInterface & | operator= (DrakeSubscriptionInterface &&)=delete |
Protected Member Functions | |
DrakeSubscriptionInterface () | |
|
delete |
|
delete |
|
virtual |
|
protected |
|
delete |
|
delete |
|
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.
|
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.