DynamicDataHelper.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright 2019 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 _FASTRTPS_TYPES_DYNAMICDATAHELPER_HPP_
  15. #define _FASTRTPS_TYPES_DYNAMICDATAHELPER_HPP_
  16. #include <fastrtps/types/AnnotationDescriptor.h>
  17. #include <fastrtps/types/TypeDescriptor.h>
  18. #include <fastrtps/types/DynamicType.h>
  19. #include <fastrtps/types/DynamicData.h>
  20. #include <fastrtps/types/DynamicDataPtr.h>
  21. #include <fastrtps/types/DynamicTypeMember.h>
  22. namespace eprosima {
  23. namespace fastrtps {
  24. namespace types {
  25. class DynamicDataHelper
  26. {
  27. public:
  28. RTPS_DllAPI static void print(
  29. const DynamicData_ptr& data);
  30. RTPS_DllAPI static void print(
  31. const DynamicData* data);
  32. protected:
  33. static void print_basic_element(
  34. DynamicData* data,
  35. MemberId id,
  36. TypeKind kind);
  37. static void print_collection(
  38. DynamicData* data,
  39. const std::string& tabs = "");
  40. static void fill_array_positions(
  41. const std::vector<uint32_t>& bounds,
  42. std::vector<std::vector<uint32_t>>& positions);
  43. static void get_index_position(
  44. uint32_t index,
  45. const std::vector<uint32_t>& bounds,
  46. std::vector<uint32_t>& position);
  47. static void aux_index_position(
  48. uint32_t index,
  49. uint32_t inner_index,
  50. const std::vector<uint32_t>& bounds,
  51. std::vector<uint32_t>& position);
  52. static void print_basic_collection(
  53. DynamicData* data);
  54. static void print_complex_collection(
  55. DynamicData* data,
  56. const std::string& tabs = "");
  57. static void print_complex_element(
  58. DynamicData* data,
  59. MemberId id,
  60. const std::string& tabs = "");
  61. static void print_member(
  62. DynamicData* data,
  63. const DynamicTypeMember* type,
  64. const std::string& tabs = "");
  65. };
  66. } // namespace types
  67. } // namespace fastrtps
  68. } // namespace eprosima
  69. #endif // _FASTRTPS_TYPES_DYNAMICDATAHELPER_HPP_