SpawnEntityServiceHandler.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 "ROS2ServiceBase.h"
  10. #include <AzCore/std/string/regex.h>
  11. #include <AzCore/std/string/string_view.h>
  12. #include <simulation_interfaces/srv/spawn_entity.hpp>
  13. namespace ROS2SimulationInterfaces
  14. {
  15. class SpawnEntityServiceHandler : public ROS2ServiceBase<simulation_interfaces::srv::SpawnEntity>
  16. {
  17. public:
  18. AZStd::string_view GetTypeName() const override
  19. {
  20. return "SpawnEntity";
  21. }
  22. AZStd::string_view GetDefaultName() const override
  23. {
  24. return "spawn_entity";
  25. }
  26. AZStd::unordered_set<AZ::u8> GetProvidedFeatures() override;
  27. AZStd::optional<Response> HandleServiceRequest(const std::shared_ptr<rmw_request_id_t> header, const Request& request) override;
  28. private:
  29. bool ValidateEntityName(const AZStd::string& entityName);
  30. bool ValidateFrameName(const AZStd::string& frameName);
  31. };
  32. } // namespace ROS2SimulationInterfaces