AnnotationDescriptor.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_ANNOTATION_DESCRIPTOR_H
  15. #define TYPES_ANNOTATION_DESCRIPTOR_H
  16. #include <fastrtps/types/TypesBase.h>
  17. #include <fastrtps/types/DynamicTypePtr.h>
  18. namespace eprosima{
  19. namespace fastrtps{
  20. namespace types{
  21. class MemberDescriptor;
  22. class DynamicType;
  23. class AnnotationDescriptor
  24. {
  25. protected:
  26. friend class DynamicTypeBuilderFactory;
  27. DynamicType_ptr type_;
  28. std::map<std::string, std::string> value_;
  29. public:
  30. AnnotationDescriptor();
  31. ~AnnotationDescriptor();
  32. AnnotationDescriptor(const AnnotationDescriptor* descriptor);
  33. AnnotationDescriptor(DynamicType_ptr p_type);
  34. ReturnCode_t copy_from(const AnnotationDescriptor* other);
  35. bool equals(const AnnotationDescriptor*) const;
  36. bool is_consistent() const;
  37. bool key_annotation() const;
  38. ReturnCode_t get_value(
  39. std::string& value,
  40. const std::string& key);
  41. ReturnCode_t get_value(std::string& value); // key = "value"
  42. ReturnCode_t get_all_value(std::map<std::string, std::string>& value) const;
  43. ReturnCode_t set_value(
  44. const std::string& key,
  45. const std::string& value);
  46. void set_type(DynamicType_ptr pType);
  47. const DynamicType_ptr type() const
  48. {
  49. return type_;
  50. }
  51. };
  52. } // namespace types
  53. } // namespace fastrtps
  54. } // namespace eprosima
  55. #endif // TYPES_ANNOTATION_DESCRIPTOR_H