File domain_route.hpp

File List > astutedds > routing > domain_route.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 domain_route.hpp
// @brief DomainRoute: pairs two DDS domains and manages their TopicRoutes.
//
// A DomainRoute creates one DomainParticipant on each side and then starts
// all configured TopicRoutes between them.
//

#ifndef ASTUTEDDS_ROUTING_DOMAIN_ROUTE_HPP
#define ASTUTEDDS_ROUTING_DOMAIN_ROUTE_HPP

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

#include <astutedds/dcps/dcps.hpp>

#include <memory>
#include <vector>

namespace astutedds::routing
{

class DomainRoute
{
public:
    explicit DomainRoute(const DomainRouteConfig& cfg);
    ~DomainRoute();

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

    bool start();

    void stop();

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

    const std::vector<std::unique_ptr<TopicRoute>>& topic_routes() const { return routes_; }

private:
    DomainRouteConfig config_;

    // Owned participants (created on start(), deleted on stop())
    dcps::DomainParticipant* input_participant_{nullptr};
    dcps::DomainParticipant* output_participant_{nullptr};

    std::vector<std::unique_ptr<TopicRoute>> routes_;
};

} // namespace astutedds::routing

#endif // ASTUTEDDS_ROUTING_DOMAIN_ROUTE_HPP