Class HandlerRegistry
Defined in File handler_registry.hpp
Class Documentation
-
class HandlerRegistry
Registry for topic handler factories.
The registry manages handler factories and creates handler instances. Teams can register custom handlers for specific topic types.
Built-in handlers:
”camera_data”: Image scaling, JPEG compression, protobuf conversion
For simple topic forwarding (without custom processing), use the gateway with explicit_topics instead of creating a handler.
Usage:
// Register a custom handler HandlerRegistry::instance().registerHandler("my_sensor", [](rclcpp::Node* n, const HandlerConfig& c, FoxgloveLogger* l) { return std::make_unique<MySensorHandler>(n, c, l); }); // Create a handler for a topic auto handler = registry.createHandler("my_sensor", node, config, logger);
Public Functions
-
inline void registerHandler(const std::string &type_name, HandlerFactory factory)
Register a handler factory.
- Parameters:
type_name – Unique name for this handler type
factory – Factory function to create handler instances
-
inline std::unique_ptr<TopicHandler> createHandler(const std::string &type_name, rclcpp::Node *node, const HandlerConfig &config, FoxgloveLogger *logger)
Create a handler instance.
- Parameters:
type_name – Handler type (must be registered)
node – ROS node for subscriptions/publishers
config – Handler configuration
logger – Foxglove logger for publishing
- Returns:
Handler instance, or nullptr if type not found
-
inline bool hasHandler(const std::string &type_name) const
Check if a handler type is registered.
-
inline std::vector<std::string> getRegisteredTypes() const
Get list of registered handler types.
Public Static Functions
-
static inline HandlerRegistry &instance()
Get the singleton registry instance.