CARLA
Loading...
Searching...
No Matches
Public Member Functions | List of all members
carla::ros2::ISubscriberMiddleware Class Referenceabstract

Type-erased abstract interface for a subscriber middleware. More...

#include <ISubscriberMiddleware.h>

+ Inheritance diagram for carla::ros2::ISubscriberMiddleware:

Public Member Functions

virtual std::string GetTopicName () const =0
 
virtual bool Init (const std::string &topic_name, void *message_ptr, bool *new_message_flag)=0
 Initialize the underlying middleware entities.
 
virtual bool Init (const std::string &topic_name, void *message_ptr, bool *new_message_flag, const QosProfile &qos)
 Initialize with an explicit per-topic QoS profile (see QosProfile.h).
 
virtual bool IsAlive () const =0
 
virtual ~ISubscriberMiddleware ()=default
 

Detailed Description

Type-erased abstract interface for a subscriber middleware.

Concrete implementations write received messages directly into the caller-provided storage (message_ptr / new_message_flag) to avoid an extra copy.

Contract: when an implementation establishes its process-wide transport context (a DDS DomainParticipant, a Zenoh session, ...) it must honor carla::ros2::MiddlewareConfig::GetDomainId(), mapping kUnsetDomainId to its own native default. This keeps the ROS 2 domain id configurable and middleware-agnostic (see MiddlewareConfig.h).

Definition at line 23 of file ISubscriberMiddleware.h.

Constructor & Destructor Documentation

◆ ~ISubscriberMiddleware()

virtual carla::ros2::ISubscriberMiddleware::~ISubscriberMiddleware ( )
virtualdefault

Member Function Documentation

◆ GetTopicName()

virtual std::string carla::ros2::ISubscriberMiddleware::GetTopicName ( ) const
pure virtual
Returns
The topic name this subscriber is bound to.

Implemented in carla::ros2::FastDDSSubscriberMiddleware< S >, and MockSubscriberMiddleware.

◆ Init() [1/2]

virtual bool carla::ros2::ISubscriberMiddleware::Init ( const std::string &  topic_name,
void *  message_ptr,
bool *  new_message_flag 
)
pure virtual

Initialize the underlying middleware entities.

The middleware writes incoming messages to *message_ptr and sets *new_message_flag = true.

Parameters
topic_nameFull topic name.
message_ptrPointer to the message storage owned by the caller.
new_message_flagPointer to the new-message flag owned by the caller.
Returns
true on success.

Implemented in carla::ros2::FastDDSSubscriberMiddleware< S >, and MockSubscriberMiddleware.

Referenced by Init().

◆ Init() [2/2]

virtual bool carla::ros2::ISubscriberMiddleware::Init ( const std::string &  topic_name,
void *  message_ptr,
bool *  new_message_flag,
const QosProfile &  qos 
)
inlinevirtual

Initialize with an explicit per-topic QoS profile (see QosProfile.h).

The default implementation ignores the profile and falls back to the QoS-less Init so test fakes and QoS-agnostic middlewares keep working; concrete backends override this to honor the profile.

Reimplemented in carla::ros2::FastDDSSubscriberMiddleware< S >.

Definition at line 42 of file ISubscriberMiddleware.h.

References Init().

◆ IsAlive()

virtual bool carla::ros2::ISubscriberMiddleware::IsAlive ( ) const
pure virtual
Returns
true if at least one publisher is matched.

Implemented in carla::ros2::FastDDSSubscriberMiddleware< S >, and MockSubscriberMiddleware.


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