LidarRegistrarSystemComponent.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include <Lidar/LidarSystem.h>
  11. #include <ROS2Sensors/Lidar/LidarRegistrarBus.h>
  12. #include <ROS2Sensors/ROS2SensorsTypeIds.h>
  13. namespace ROS2Sensors
  14. {
  15. //! A Component that manages LidarSystems' registration and storage of their metadata.
  16. class LidarRegistrarSystemComponent
  17. : public AZ::Component
  18. , protected LidarRegistrarRequestBus::Handler
  19. {
  20. public:
  21. AZ_COMPONENT(LidarRegistrarSystemComponent, ROS2Sensors::LidarRegistrarSystemComponentTypeId);
  22. static void Reflect(AZ::ReflectContext* context);
  23. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  24. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  25. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  26. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  27. LidarRegistrarSystemComponent();
  28. virtual ~LidarRegistrarSystemComponent();
  29. protected:
  30. void Init() override;
  31. void Activate() override;
  32. void Deactivate() override;
  33. // LidarRegistrarRequestBus overrides
  34. void RegisterLidarSystem(const char* name, const char* description, const LidarSystemFeatures& features) override;
  35. AZStd::vector<AZStd::string> GetRegisteredLidarSystems() const override;
  36. const LidarSystemMetaData* GetLidarSystemMetaData(const AZStd::string& name) const override;
  37. private:
  38. LidarSystem m_physxLidarSystem;
  39. AZStd::unordered_map<AZ::Crc32, LidarSystemMetaData> m_registeredLidarSystems;
  40. };
  41. } // namespace ROS2Sensors