RTI Connext Modern C++ API
Version 6.0.0
|
<<reference-type>> Automatically manages the association of an Entity and a Listener More...
#include <rti/core/ListenerBinder.hpp>
Public Member Functions | |
Listener * | get () |
(Deprecated) Use listener() | |
const Listener * | get () const |
(Deprecated) Use listener() | |
Listener * | listener () |
Retrieves the listener. | |
const Listener * | listener () const |
Retrieves the listener. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Entity , typename Listener > | |
ListenerBinder< Entity, Listener > | bind_listener (Entity entity, Listener *the_listener, dds::core::status::StatusMask mask) |
Sets the listener and creates a ListenerBinder that automatically resets it when all references go out of scope. | |
template<typename Entity , typename Listener > | |
ListenerBinder< Entity, Listener > | bind_listener (Entity entity, Listener *the_listener) |
Sets the listener and creates a ListenerBinder that automatically resets it when all references go out of scope. | |
template<typename Entity , typename Listener > | |
ListenerBinder< Entity, Listener > | bind_and_manage_listener (Entity entity, Listener *the_listener, dds::core::status::StatusMask mask) |
Sets the listener and creates a ListenerBinder that automatically resets and deletes it when all references go out of scope. | |
template<typename Entity , typename Listener > | |
ListenerBinder< Entity, Listener > | bind_and_manage_listener (Entity entity, Listener *the_listener) |
Sets the listener and creates a ListenerBinder that automatically resets and deletes it when all references go out of scope. | |
<<reference-type>> Automatically manages the association of an Entity and a Listener
Ties the association listener/Entity to the existence of references to this type–that is, the constructor sets the listener; when the last reference is destroyed, the entity's listener is unset. Depending on how this type is created, the listener may also be deleted:
rti::core::bind_listener()
creates a ListenerBinder that doesn't own the listener and won't delete itrti::core::bind_and_manage_listener()
creates a ListenerBinder that owns the listener and will delete it.The goal is to simplify the destruction of an Entity by the application, which otherwise would have to reset the listener or close the Entity explicitly.
Example:
To create a ListenerBinder use rti::core::bind_listener() or rti::core::bind_and_manage_listener(). To retrieve the listener use ListenerBinder::get().
If the Entity changes its listener while references to this ListenerBinder still exist, the ListenerBinder will not reset the listener.
Entity | A subclass of dds::core::Entity |
Listener | The listener type, by default Entity::Listener |
|
inline |
(Deprecated) Use listener()
|
inline |
(Deprecated) Use listener()
|
inline |
Retrieves the listener.
|
inline |
Retrieves the listener.
|
related |
Sets the listener and creates a ListenerBinder that automatically resets it when all references go out of scope.
The ListenerBinder created from this function does not delete the listener, it simply sets the listener back to NULL in the Entity. The application is responsible for the life-cycle of the listener.
To also delete the listener when all references go out of scope, see bind_and_manage_listener().
|
related |
Sets the listener and creates a ListenerBinder that automatically resets it when all references go out of scope.
This overload works for listeners that don't use a mask
|
related |
Sets the listener and creates a ListenerBinder that automatically resets and deletes it when all references go out of scope.
Example:
|
related |
Sets the listener and creates a ListenerBinder that automatically resets and deletes it when all references go out of scope.
This overload works for listeners that don't use a mask