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

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

#include <IPublisherMiddleware.h>

+ Inheritance diagram for carla::ros2::IPublisherMiddleware:

Public Member Functions

virtual std::string GetTopicName () const =0
 
virtual bool Init (const std::string &topic_name)=0
 Initialize the underlying middleware entities.
 
virtual bool Init (const std::string &topic_name, const QosProfile &qos)
 Initialize with an explicit per-topic QoS profile (see QosProfile.h).
 
virtual bool IsAlive () const =0
 
virtual bool Publish (void *message_data)=0
 Serialize and write a message to the network.
 
virtual ~IPublisherMiddleware ()=default
 

Detailed Description

Type-erased abstract interface for a publisher middleware.

Concrete implementations handle all vendor-specific entity creation, type registration, and data writing.

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 IPublisherMiddleware.h.

Constructor & Destructor Documentation

◆ ~IPublisherMiddleware()

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

Member Function Documentation

◆ GetTopicName()

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

Implemented in carla::ros2::FastDDSPublisherMiddleware< T >, and MockPublisherMiddleware.

◆ Init() [1/2]

virtual bool carla::ros2::IPublisherMiddleware::Init ( const std::string &  topic_name)
pure virtual

Initialize the underlying middleware entities.

Parameters
topic_nameFull topic name including "rt/" prefix.
Returns
true on success.

Implemented in carla::ros2::FastDDSPublisherMiddleware< T >, and MockPublisherMiddleware.

Referenced by Init().

◆ Init() [2/2]

virtual bool carla::ros2::IPublisherMiddleware::Init ( const std::string &  topic_name,
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::FastDDSPublisherMiddleware< T >.

Definition at line 36 of file IPublisherMiddleware.h.

References Init().

◆ IsAlive()

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

Implemented in carla::ros2::FastDDSPublisherMiddleware< T >, and MockPublisherMiddleware.

◆ Publish()

virtual bool carla::ros2::IPublisherMiddleware::Publish ( void *  message_data)
pure virtual

Serialize and write a message to the network.

Parameters
message_dataPointer to the message object (type-erased, cast internally).
Returns
true if the write succeeded.

Implemented in carla::ros2::FastDDSPublisherMiddleware< T >, and MockPublisherMiddleware.


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