DynamicTypeMember.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Copyright 2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef TYPES_DYNAMIC_TYPE_MEMBER_H
  15. #define TYPES_DYNAMIC_TYPE_MEMBER_H
  16. #include <fastrtps/types/TypesBase.h>
  17. #include <fastrtps/types/MemberDescriptor.h>
  18. namespace eprosima {
  19. namespace fastrtps {
  20. namespace types {
  21. class AnnotationDescriptor;
  22. class DynamicType;
  23. class DynamicTypeMember
  24. {
  25. protected:
  26. DynamicType* parent_;
  27. MemberDescriptor descriptor_;
  28. MemberId id_;
  29. uint32_t get_index() const;
  30. void set_index(uint32_t index);
  31. void set_parent(DynamicType* pType);
  32. friend class DynamicTypeBuilder;
  33. friend class DynamicType;
  34. friend class DynamicData;
  35. public:
  36. DynamicTypeMember();
  37. DynamicTypeMember(const DynamicTypeMember* other);
  38. DynamicTypeMember(
  39. const MemberDescriptor* descriptor,
  40. MemberId id);
  41. ~DynamicTypeMember();
  42. ReturnCode_t apply_annotation(AnnotationDescriptor& descriptor);
  43. ReturnCode_t apply_annotation(
  44. const std::string& annotation_name,
  45. const std::string& key,
  46. const std::string& value);
  47. bool equals(const DynamicTypeMember*) const;
  48. ReturnCode_t get_annotation(
  49. AnnotationDescriptor& descriptor,
  50. uint32_t idx);
  51. uint32_t get_annotation_count();
  52. bool key_annotation() const;
  53. std::vector<uint64_t> get_union_labels() const;
  54. ReturnCode_t get_descriptor(MemberDescriptor* descriptor) const;
  55. MemberId get_id() const;
  56. std::string get_name() const;
  57. bool is_default_union_value() const;
  58. const MemberDescriptor* get_descriptor() const
  59. {
  60. return &descriptor_;
  61. }
  62. };
  63. } // namespace types
  64. } // namespace fastrtps
  65. } // namespace eprosima
  66. #endif // TYPES_DYNAMIC_TYPE_MEMBER_H