/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #pragma once #include #include #include #include #include #include #include #include #include namespace ROS2SimulationInterfaces { class ROS2SimulationInterfacesSystemComponent : public AZ::Component , public ROS2SimulationInterfacesRequestBus::Handler { public: AZ_COMPONENT_DECL(ROS2SimulationInterfacesSystemComponent); static void Reflect(AZ::ReflectContext* context); static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible); static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required); static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent); ROS2SimulationInterfacesSystemComponent() = default; ~ROS2SimulationInterfacesSystemComponent() = default; protected: // AZ::Component interface implementation void Activate() override; void Deactivate() override; // ROS2SimulationInterfacesRequestBus override AZStd::unordered_set GetSimulationFeatures() override; void AddSimulationFeatures(const AZStd::unordered_set& features) override; private: AZStd::unordered_map> m_availableRos2Interface; AZStd::unordered_set m_externallyRegisteredFeatures; template void RegisterInterface(rclcpp::Node::SharedPtr ros2Node) { AZStd::shared_ptr handler = AZStd::make_shared(); handler->Initialize(ros2Node); if (handler->IsValid()) { m_availableRos2Interface[handler->GetTypeName()] = AZStd::move(handler); } handler.reset(); }; }; } // namespace ROS2SimulationInterfaces