File listener.hpp
FileList > astutedds > rmw > listener.hpp
Go to the source code of this file
Rebuild-and-install helpers for AstuteDDS DataWriter/DataReader listeners. More...
#include <astutedds/c/astutedds.h>#include <astutedds/rmw/types.hpp>#include <rmw/event.h>
Public Functions
| Type | Name |
|---|---|
| bool | event_is_ready (const rmw_event_t * event) |
| AstuteDDS_ReturnCode | rebuild_publisher_listener (AstuteDDSPublisher * pub) |
| AstuteDDS_ReturnCode | rebuild_subscription_listener (AstuteDDSSubscription * sub) |
Detailed Description
astutedds_datawriter_set_listener() / astutedds_datareader_set_listener() each take a single, fixed-shape listener struct and replace whatever was previously installed — they do not merge. But a publisher or subscription can have several independently-registered rmw callbacks alive at once (e.g. a subscription's "new message" callback from rmw_subscription_set_on_new_message_callback() and a RMW_EVENT_LIVELINESS_CHANGED callback from rmw_event_set_callback()).
The two functions here are the single place that assembles the complete AstuteDDS listener struct from a PIMPL's current callback state and installs it. Every rmw entry point that registers or clears a publisher/subscription callback (in rmw.cpp and event.cpp) must go through one of these instead of calling astutedds_data{writer,reader}_set_listener() directly, or it will silently clobber whichever other callback was registered.
Public Functions Documentation
function event_is_ready
bool event_is_ready (
const rmw_event_t * event
)
True if event has a pending (unread) occurrence right now, per the same AstuteDDS status getter rmw_take_event() (event.cpp) would read for its event_type — i.e. the underlying status's *_count_change is nonzero. Used by rmw_wait() (rmw.cpp) to decide whether an entry in the events array should be left non-null. Returns false (never ready) for an unsupported/unknown event_type or a null event.
function rebuild_publisher_listener
AstuteDDS_ReturnCode rebuild_publisher_listener (
AstuteDDSPublisher * pub
)
(Re)build and install the complete AstuteDDS_DataWriterListener for a publisher's DataWriter from its currently-registered event callbacks.
Precondition:
Caller holds pub->listener_mtx.
Returns:
The result of the underlying astutedds_datawriter_set_listener() call.
function rebuild_subscription_listener
AstuteDDS_ReturnCode rebuild_subscription_listener (
AstuteDDSSubscription * sub
)
Subscription-side counterpart of rebuild_publisher_listener. Also covers the "new message" callback (on_data_available) alongside the five subscription event callbacks, since AstuteDDS_DataReaderListener is a single struct shared by both concerns.
Precondition:
Caller holds sub->listener_mtx.
Returns:
The result of the underlying astutedds_datareader_set_listener() call.
The documentation for this class was generated from the following file include/astutedds/rmw/listener.hpp