ROS2-Gem-DemoSystemComponent.cpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // {BEGIN_LICENSE}
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. // {END_LICENSE}
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include <AzCore/Serialization/EditContext.h>
  12. #include <AzCore/Serialization/EditContextConstants.inl>
  13. #include "ROS2-Gem-DemoSystemComponent.h"
  14. namespace ROS2_Gem_Demo
  15. {
  16. void ROS2_Gem_DemoSystemComponent::Reflect(AZ::ReflectContext* context)
  17. {
  18. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  19. {
  20. serialize->Class<ROS2_Gem_DemoSystemComponent, AZ::Component>()
  21. ->Version(0)
  22. ;
  23. if (AZ::EditContext* ec = serialize->GetEditContext())
  24. {
  25. ec->Class<ROS2_Gem_DemoSystemComponent>("ROS2_Gem_Demo", "[Description of functionality provided by this System Component]")
  26. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  27. ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
  28. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  29. ;
  30. }
  31. }
  32. }
  33. void ROS2_Gem_DemoSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  34. {
  35. provided.push_back(AZ_CRC("ROS2_Gem_DemoService"));
  36. }
  37. void ROS2_Gem_DemoSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  38. {
  39. incompatible.push_back(AZ_CRC("ROS2_Gem_DemoService"));
  40. }
  41. void ROS2_Gem_DemoSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  42. {
  43. }
  44. void ROS2_Gem_DemoSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  45. {
  46. }
  47. ROS2_Gem_DemoSystemComponent::ROS2_Gem_DemoSystemComponent()
  48. {
  49. if (ROS2_Gem_DemoInterface::Get() == nullptr)
  50. {
  51. ROS2_Gem_DemoInterface::Register(this);
  52. }
  53. }
  54. ROS2_Gem_DemoSystemComponent::~ROS2_Gem_DemoSystemComponent()
  55. {
  56. if (ROS2_Gem_DemoInterface::Get() == this)
  57. {
  58. ROS2_Gem_DemoInterface::Unregister(this);
  59. }
  60. }
  61. void ROS2_Gem_DemoSystemComponent::Init()
  62. {
  63. }
  64. void ROS2_Gem_DemoSystemComponent::Activate()
  65. {
  66. ROS2_Gem_DemoRequestBus::Handler::BusConnect();
  67. }
  68. void ROS2_Gem_DemoSystemComponent::Deactivate()
  69. {
  70. ROS2_Gem_DemoRequestBus::Handler::BusDisconnect();
  71. }
  72. }