TopicConfiguration.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  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/EditContext.h>
  9. #include <ROS2/Communication/TopicConfiguration.h>
  10. #include <ROS2/Utilities/ROS2Names.h>
  11. namespace ROS2
  12. {
  13. void TopicConfiguration::Reflect(AZ::ReflectContext* context)
  14. {
  15. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serializeContext->Class<TopicConfiguration>()
  18. ->Version(1)
  19. ->Field("Type", &TopicConfiguration::m_type)
  20. ->Field("Topic", &TopicConfiguration::m_topic)
  21. ->Field("QoS", &TopicConfiguration::m_qos);
  22. if (AZ::EditContext* ec = serializeContext->GetEditContext())
  23. {
  24. ec->Class<TopicConfiguration>("Publisher configuration", "")
  25. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  26. ->DataElement(AZ::Edit::UIHandlers::Default, &TopicConfiguration::m_type, "Type", "Type of topic messages")
  27. ->DataElement(AZ::Edit::UIHandlers::Default, &TopicConfiguration::m_topic, "Topic", "Topic with no namespace")
  28. ->Attribute(AZ::Edit::Attributes::ChangeValidate, &ROS2Names::ValidateTopicField)
  29. ->DataElement(AZ::Edit::UIHandlers::Default, &TopicConfiguration::m_qos, "QoS", "Quality of Service");
  30. }
  31. }
  32. };
  33. } // namespace ROS2