15#if defined(CARLA_ROS2_MIDDLEWARE_FASTDDS) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
20#if defined(CARLA_ROS2_MIDDLEWARE_CYCLONEDDS) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
25#if defined(CARLA_ROS2_MIDDLEWARE_ZENOH) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
53#if defined(CARLA_ROS2_MIDDLEWARE_FASTDDS)
59#if defined(CARLA_ROS2_MIDDLEWARE_CYCLONEDDS)
65#if defined(CARLA_ROS2_MIDDLEWARE_ZENOH)
84 return {
true, requested};
86 return {
false, requested};
102#if defined(CARLA_ROS2_MIDDLEWARE_FASTDDS) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
103 return std::make_unique<FastDDSPublisherMiddleware<T>>();
105 log_error(
"MiddlewareFactory: FastDDS not compiled in");
109#if defined(CARLA_ROS2_MIDDLEWARE_CYCLONEDDS) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
110 return std::make_unique<CycloneDDSPublisherMiddleware<T>>();
112 log_error(
"MiddlewareFactory: CycloneDDS not compiled in");
116#if defined(CARLA_ROS2_MIDDLEWARE_ZENOH) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
117 return std::make_unique<ZenohPublisherMiddleware<T>>();
119 log_error(
"MiddlewareFactory: Zenoh not compiled in");
133#if defined(CARLA_ROS2_MIDDLEWARE_FASTDDS) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
134 return std::make_unique<FastDDSSubscriberMiddleware<S>>();
136 log_error(
"MiddlewareFactory: FastDDS not compiled in");
140#if defined(CARLA_ROS2_MIDDLEWARE_CYCLONEDDS) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
141 return std::make_unique<CycloneDDSSubscriberMiddleware<S>>();
143 log_error(
"MiddlewareFactory: CycloneDDS not compiled in");
147#if defined(CARLA_ROS2_MIDDLEWARE_ZENOH) && !defined(CARLA_ROS2_MIDDLEWARE_TESTING)
148 return std::make_unique<ZenohSubscriberMiddleware<S>>();
150 log_error(
"MiddlewareFactory: Zenoh not compiled in");
162 return active_middleware;
Factory that creates publisher/subscriber middleware based on the active middleware selection.
static void SetMiddleware(Middleware middleware)
Select the middleware for all subsequent publisher/subscriber creation.
static std::string GetAvailableMiddlewareString()
Return a readable list of middleware implementations compiled into this binary.
static MiddlewareResolution ResolveMiddleware(Middleware requested)
Resolve the requested middleware strictly — no fallback to other middleware.
static Middleware GetMiddleware()
static std::unique_ptr< ISubscriberMiddleware > CreateSubscriber()
Create a subscriber middleware for traits type S.
static std::unique_ptr< IPublisherMiddleware > CreatePublisher()
Create a publisher middleware for traits type T.
static bool IsMiddlewareAvailable(Middleware middleware)
Check whether a specific middleware was compiled into this binary.
static Middleware & GetActiveMiddleware()
Returns reference to the active middleware selection (function-local static for C++11 thread safety).
Middleware
Enumeration of available middleware implementations.
std::string GetAvailableMiddlewareString()
Return a readable list of middleware implementations compiled into this binary.
This file contains definitions of common data structures used in traffic manager.
static void log_error(Args &&... args)
Result of middleware resolution — whether resolution succeeded and which middleware to use.