2
0

PublisherConfiguration.cpp 1.7 KB

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