TopicDescription.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. /**
  15. * @file TopicDescription.hpp
  16. */
  17. #ifndef _FASTDDS_TOPIC_DESCRIPTION_HPP_
  18. #define _FASTDDS_TOPIC_DESCRIPTION_HPP_
  19. #include <string>
  20. namespace eprosima {
  21. namespace fastdds {
  22. namespace dds {
  23. class DomainParticipant;
  24. class TopicDescriptionImpl;
  25. /**
  26. * Class TopicDescription, represents the fact that both publications
  27. * and subscriptions are tied to a single data-type
  28. * @ingroup FASTDDS_MODULE
  29. */
  30. class TopicDescription
  31. {
  32. public:
  33. /**
  34. * Get the DomainParticipant to which the TopicDescription belongs.
  35. * @return The DomainParticipant to which the TopicDescription belongs.
  36. */
  37. virtual DomainParticipant* get_participant() const = 0;
  38. /**
  39. * Get the name used to create this TopicDescription.
  40. * @return the name used to create this TopicDescription.
  41. */
  42. const std::string& get_name() const
  43. {
  44. return name_;
  45. }
  46. /**
  47. * Get the associated type name.
  48. * @return the type name.
  49. */
  50. const std::string& get_type_name() const
  51. {
  52. return type_name_;
  53. }
  54. /**
  55. * Get the TopicDescriptionImpl
  56. * @return pointer to TopicDescriptionImpl
  57. */
  58. virtual TopicDescriptionImpl* get_impl() const = 0;
  59. protected:
  60. /**
  61. * @brief Constructor using topic name and data type name
  62. * @param name Name for the topic
  63. * @param type_name Data type name
  64. */
  65. TopicDescription(
  66. const std::string& name,
  67. const std::string& type_name)
  68. : name_(name)
  69. , type_name_(type_name)
  70. {
  71. }
  72. /**
  73. * @brief Destructor
  74. */
  75. virtual ~TopicDescription()
  76. {
  77. }
  78. protected:
  79. //! Name that allows the TopicDescription to be retrieved locally
  80. std::string name_;
  81. //! Name that defines a unique resulting type for the publication or the subscription
  82. std::string type_name_;
  83. };
  84. } /* namespace dds */
  85. } /* namespace fastdds */
  86. } /* namespace eprosima */
  87. #endif /* _FASTDDS_TOPIC_DESCRIPTION_HPP_ */