ROS2-Gem-DemoSystemComponent.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #include <AzCore/Serialization/SerializeContext.h>
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/EditContextConstants.inl>
  11. #include "ROS2-Gem-DemoSystemComponent.h"
  12. namespace ROS2_Gem_Demo
  13. {
  14. void ROS2_Gem_DemoSystemComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  17. {
  18. serialize->Class<ROS2_Gem_DemoSystemComponent, AZ::Component>()
  19. ->Version(0)
  20. ;
  21. if (AZ::EditContext* ec = serialize->GetEditContext())
  22. {
  23. ec->Class<ROS2_Gem_DemoSystemComponent>("ROS2_Gem_Demo", "[Description of functionality provided by this System Component]")
  24. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  25. ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
  26. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  27. ;
  28. }
  29. }
  30. }
  31. void ROS2_Gem_DemoSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  32. {
  33. provided.push_back(AZ_CRC("ROS2_Gem_DemoService"));
  34. }
  35. void ROS2_Gem_DemoSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  36. {
  37. incompatible.push_back(AZ_CRC("ROS2_Gem_DemoService"));
  38. }
  39. void ROS2_Gem_DemoSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  40. {
  41. }
  42. void ROS2_Gem_DemoSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  43. {
  44. }
  45. ROS2_Gem_DemoSystemComponent::ROS2_Gem_DemoSystemComponent()
  46. {
  47. if (ROS2_Gem_DemoInterface::Get() == nullptr)
  48. {
  49. ROS2_Gem_DemoInterface::Register(this);
  50. }
  51. }
  52. ROS2_Gem_DemoSystemComponent::~ROS2_Gem_DemoSystemComponent()
  53. {
  54. if (ROS2_Gem_DemoInterface::Get() == this)
  55. {
  56. ROS2_Gem_DemoInterface::Unregister(this);
  57. }
  58. }
  59. void ROS2_Gem_DemoSystemComponent::Init()
  60. {
  61. }
  62. void ROS2_Gem_DemoSystemComponent::Activate()
  63. {
  64. ROS2_Gem_DemoRequestBus::Handler::BusConnect();
  65. }
  66. void ROS2_Gem_DemoSystemComponent::Deactivate()
  67. {
  68. ROS2_Gem_DemoRequestBus::Handler::BusDisconnect();
  69. }
  70. }