DataReaderListener.hpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 DataReaderListener.hpp
  16. */
  17. #ifndef _FASTRTPS_DATAREADERLISTENER_HPP_
  18. #define _FASTRTPS_DATAREADERLISTENER_HPP_
  19. #include <fastrtps/fastrtps_dll.h>
  20. #include <fastrtps/qos/DeadlineMissedStatus.h>
  21. #include <fastrtps/qos/LivelinessChangedStatus.h>
  22. #include <fastrtps/qos/SampleRejectedStatus.hpp>
  23. #include <fastdds/dds/core/status/IncompatibleQosStatus.hpp>
  24. #include <fastdds/dds/core/status/BaseStatus.hpp>
  25. #include <fastdds/dds/core/status/SubscriptionMatchedStatus.hpp>
  26. namespace eprosima {
  27. namespace fastdds {
  28. namespace dds {
  29. class DataReader;
  30. /**
  31. * Class DataReaderListener, it should be used by the end user to implement specific callbacks to certain actions.
  32. * @ingroup FASTDDS_MODULE
  33. */
  34. class DataReaderListener
  35. {
  36. public:
  37. /**
  38. * @brief Constructor
  39. */
  40. RTPS_DllAPI DataReaderListener()
  41. {
  42. }
  43. /**
  44. * @brief Destructor
  45. */
  46. RTPS_DllAPI virtual ~DataReaderListener()
  47. {
  48. }
  49. /**
  50. * Virtual function to be implemented by the user containing the actions to be performed when a new Data Message is received.
  51. * @param reader DataReader
  52. */
  53. RTPS_DllAPI virtual void on_data_available(
  54. DataReader* reader)
  55. {
  56. (void)reader;
  57. }
  58. /**
  59. * Virtual method to be called when the subscriber is matched with a new Writer (or unmatched); i.e., when a writer publishing in the same topic is discovered.
  60. * @param reader DataReader
  61. * @param info The subscription matched status
  62. */
  63. RTPS_DllAPI virtual void on_subscription_matched(
  64. DataReader* reader,
  65. const fastdds::dds::SubscriptionMatchedStatus& info)
  66. {
  67. (void)reader;
  68. (void)info;
  69. }
  70. /**
  71. * Virtual method to be called when a topic misses the deadline period
  72. * @param reader DataReader
  73. * @param status The requested deadline missed status
  74. */
  75. RTPS_DllAPI virtual void on_requested_deadline_missed(
  76. DataReader* reader,
  77. const fastrtps::RequestedDeadlineMissedStatus& status)
  78. {
  79. (void)reader;
  80. (void)status;
  81. }
  82. /**
  83. * @brief Method called when the liveliness status associated to a subscriber changes
  84. * @param reader The DataReader
  85. * @param status The liveliness changed status
  86. */
  87. RTPS_DllAPI virtual void on_liveliness_changed(
  88. DataReader* reader,
  89. const fastrtps::LivelinessChangedStatus& status)
  90. {
  91. (void)reader;
  92. (void)status;
  93. }
  94. /**
  95. * @brief Method called when a sample was rejected.
  96. * @param reader The DataReader
  97. * @param status The rejected status
  98. */
  99. RTPS_DllAPI virtual void on_sample_rejected(
  100. DataReader* reader,
  101. const fastrtps::SampleRejectedStatus& status)
  102. {
  103. (void)reader;
  104. (void)status;
  105. }
  106. /**
  107. * @brief Method called an incompatible QoS was requested.
  108. * @param reader The DataReader
  109. * @param status The requested incompatible QoS status
  110. */
  111. RTPS_DllAPI virtual void on_requested_incompatible_qos(
  112. DataReader* reader,
  113. const RequestedIncompatibleQosStatus& status)
  114. {
  115. (void)reader;
  116. (void)status;
  117. }
  118. /**
  119. * @brief Method called when a sample was lost.
  120. * @param reader The DataReader
  121. * @param status The sample lost status
  122. */
  123. RTPS_DllAPI virtual void on_sample_lost(
  124. DataReader* reader,
  125. const SampleLostStatus& status)
  126. {
  127. (void)reader;
  128. (void)status;
  129. }
  130. };
  131. } /* namespace dds */
  132. } /* namespace fastdds */
  133. } /* namespace eprosima */
  134. #endif /* _FASTRTPS_DATAREADERLISTENER_HPP_ */