File routing_config.hpp

File List > astutedds > routing > routing_config.hpp

Go to the documentation of this file

//
// Copyright (c) 2026, Astute Systems PTY LTD
//
// This file is part of the Astute DDS developed by Astute Systems.
//
// See the commercial LICENSE file in the project root for full license details.
//
// @file routing_config.hpp
// @brief Configuration data structures and XML loader for the routing service.
//
// The on-disk format is a small XML schema that mirrors the OMG DDS routing
// service concepts while remaining implementation-agnostic and human-editable.
//
// Example:
//   <routing_service name="domain_bridge">
//     <domain_route name="bridge_0_to_5">
//       <participant name="input"  domain_id="0"/>
//       <participant name="output" domain_id="5"/>
//       <topic_route name="squares">
//         <input  topic="Square"   type="ShapeType"/>
//         <output topic="Square"   type="ShapeType"/>
//         <filter>color = 'RED'</filter>
//       </topic_route>
//     </domain_route>
//   </routing_service>
//

#ifndef ASTUTEDDS_ROUTING_ROUTING_CONFIG_HPP
#define ASTUTEDDS_ROUTING_ROUTING_CONFIG_HPP

#include <cstdint>
#include <stdexcept>
#include <string>
#include <vector>

namespace astutedds::routing
{

// ── Per-topic bridging rule ────────────────────────────────────────────────

struct TopicRouteConfig
{
    std::string name;             
    std::string input_topic;      
    std::string output_topic;     
    std::string type_name;        
    std::string filter_expression; 
};

// ── Per domain-pair bridge ─────────────────────────────────────────────────

struct DomainRouteConfig
{
    std::string name;                        
    uint32_t input_domain_id{0};             
    uint32_t output_domain_id{0};            
    std::vector<TopicRouteConfig> topic_routes;
};

// ── Top-level service config ───────────────────────────────────────────────

struct RoutingServiceConfig
{
    std::string name;                            
    std::vector<DomainRouteConfig> domain_routes;

    static RoutingServiceConfig from_xml_file(const std::string& path);

    static RoutingServiceConfig from_xml_string(const std::string& xml);
};

} // namespace astutedds::routing

#endif // ASTUTEDDS_ROUTING_ROUTING_CONFIG_HPP