File routing_service.hpp

File List > astutedds > routing > routing_service.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_service.hpp
// @brief RoutingService: top-level DDS routing service.
//
// The RoutingService manages a set of DomainRoutes and provides a simple
// start/stop lifecycle.  Configuration is loaded from XML or built
// programmatically via RoutingServiceConfig.
//
// Typical usage:
//
//   auto cfg = RoutingServiceConfig::from_xml_file("bridge.xml");
//   RoutingService svc(cfg);
//   svc.start();
//   // ... wait for shutdown signal ...
//   svc.stop();
//

#ifndef ASTUTEDDS_ROUTING_ROUTING_SERVICE_HPP
#define ASTUTEDDS_ROUTING_ROUTING_SERVICE_HPP

#include <astutedds/routing/domain_route.hpp>
#include <astutedds/routing/routing_config.hpp>

#include <memory>
#include <vector>

namespace astutedds::routing
{

class RoutingService
{
public:
    explicit RoutingService(const RoutingServiceConfig& cfg);
    ~RoutingService();

    // Non-copyable, non-movable
    RoutingService(const RoutingService&) = delete;
    RoutingService& operator=(const RoutingService&) = delete;
    RoutingService(RoutingService&&) = delete;
    RoutingService& operator=(RoutingService&&) = delete;

    bool start();

    void stop();

    bool is_running() const { return running_; }

    const RoutingServiceConfig& config() const { return config_; }

    const std::vector<std::unique_ptr<DomainRoute>>& domain_routes() const { return routes_; }

private:
    RoutingServiceConfig config_;
    std::vector<std::unique_ptr<DomainRoute>> routes_;
    bool running_{false};
};

} // namespace astutedds::routing

#endif // ASTUTEDDS_ROUTING_ROUTING_SERVICE_HPP