CARLA
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | Static Private Member Functions | List of all members
carla::ros2::MiddlewareConfig Class Reference

Process-wide runtime configuration shared by every ROS 2 middleware implementation (FastDDS, CycloneDDS, and future ones such as Zenoh). More...

#include <MiddlewareConfig.h>

Classes

struct  Data
 

Static Public Member Functions

static int GetDomainId ()
 
static int GetEffectiveDomainId ()
 
static ResolvedDomainId ResolveEffective ()
 Resolve the effective domain id and its source from the configured value, the ROS_DOMAIN_ID environment variable, and the default.
 
static void SetDomainId (int id)
 Configure the ROS 2 domain id for all subsequent transport contexts.
 

Static Private Member Functions

static Data & Storage ()
 Function-local static: a single instance shared across all translation units.
 

Detailed Description

Process-wide runtime configuration shared by every ROS 2 middleware implementation (FastDDS, CycloneDDS, and future ones such as Zenoh).

This belongs to the middleware abstraction layer, not to any single vendor: each concrete middleware reads this configuration when it establishes its transport context (a DDS DomainParticipant, a Zenoh session, ...) and translates the abstract values into its own mechanism, mapping kUnsetDomainId to its native default.

Set once at startup (via ROS2::Enable) before any publisher or subscriber is created. Reads after that point are stable. Because it is set before any entity exists, no synchronisation is required.

Definition at line 103 of file MiddlewareConfig.h.

Member Function Documentation

◆ GetDomainId()

static int carla::ros2::MiddlewareConfig::GetDomainId ( )
inlinestatic
Returns
The configured domain id, or kUnsetDomainId if none was set.

Definition at line 112 of file MiddlewareConfig.h.

References carla::ros2::MiddlewareConfig::Data::domain_id, and Storage().

Referenced by ResolveEffective(), TEST_F(), TEST_F(), and TEST_F().

◆ GetEffectiveDomainId()

static int carla::ros2::MiddlewareConfig::GetEffectiveDomainId ( )
inlinestatic
Returns
The effective domain id every middleware should use, after applying the command-line value, the ROS_DOMAIN_ID environment variable and the default in that order.

Definition at line 126 of file MiddlewareConfig.h.

References carla::ros2::ResolvedDomainId::id, and ResolveEffective().

Referenced by carla::ros2::FastDDSSharedParticipant::acquire(), TEST_F(), TEST_F(), and TEST_F().

◆ ResolveEffective()

static ResolvedDomainId carla::ros2::MiddlewareConfig::ResolveEffective ( )
inlinestatic

Resolve the effective domain id and its source from the configured value, the ROS_DOMAIN_ID environment variable, and the default.

See ResolveDomainId for the priority order.

Definition at line 119 of file MiddlewareConfig.h.

References GetDomainId(), carla::ros2::kRosDomainIdEnvVar, and carla::ros2::ResolveDomainId().

Referenced by GetEffectiveDomainId(), and carla::ros2::SetActiveDomainId().

◆ SetDomainId()

static void carla::ros2::MiddlewareConfig::SetDomainId ( int  id)
inlinestatic

Configure the ROS 2 domain id for all subsequent transport contexts.

Pass kUnsetDomainId to keep each middleware's native default.

Definition at line 107 of file MiddlewareConfig.h.

References carla::ros2::MiddlewareConfig::Data::domain_id, and Storage().

Referenced by carla::ros2::SetActiveDomainId(), RosDomainIdEnvFixture::SetUp(), MiddlewareConfigFixture::TearDown(), RosDomainIdEnvFixture::TearDown(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ Storage()

static Data & carla::ros2::MiddlewareConfig::Storage ( )
inlinestaticprivate

Function-local static: a single instance shared across all translation units.

Definition at line 136 of file MiddlewareConfig.h.

Referenced by GetDomainId(), and SetDomainId().


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