WriterListener.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Copyright 2016 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 WriterListener.h
  16. */
  17. #ifndef _FASTDDS_RTPS_WRITERLISTENER_H_
  18. #define _FASTDDS_RTPS_WRITERLISTENER_H_
  19. #include <fastdds/rtps/common/MatchingInfo.h>
  20. #include <fastrtps/qos/LivelinessLostStatus.h>
  21. #include <fastdds/dds/core/status/PublicationMatchedStatus.hpp>
  22. namespace eprosima{
  23. namespace fastrtps{
  24. namespace rtps{
  25. class RTPSWriter;
  26. struct CacheChange_t;
  27. /**
  28. * Class WriterListener with virtual method so the user can implement callbacks to certain events.
  29. * @ingroup WRITER_MODULE
  30. */
  31. class RTPS_DllAPI WriterListener
  32. {
  33. public:
  34. WriterListener() = default;
  35. virtual ~WriterListener() = default;
  36. /**
  37. * This method is called when a new Reader is matched with this Writer by the builtin protocols
  38. * @param writer Pointer to the RTPSWriter.
  39. * @param info Matching Information.
  40. */
  41. virtual void onWriterMatched(
  42. RTPSWriter* writer,
  43. MatchingInfo& info)
  44. {
  45. (void)writer;
  46. (void)info;
  47. }
  48. /**
  49. * This method is called when a new Reader is matched with this Writer by the builtin protocols
  50. * @param writer Pointer to the RTPSWriter.
  51. * @param info Publication matching information.
  52. */
  53. virtual void onWriterMatched(
  54. RTPSWriter* writer,
  55. const eprosima::fastdds::dds::PublicationMatchedStatus& info)
  56. {
  57. (void)writer;
  58. (void)info;
  59. }
  60. /**
  61. * This method is called when all the readers matched with this Writer acknowledge that a cache
  62. * change has been received.
  63. * @param writer Pointer to the RTPSWriter.
  64. * @param change Pointer to the affected CacheChange_t.
  65. */
  66. virtual void onWriterChangeReceivedByAll(
  67. RTPSWriter* writer,
  68. CacheChange_t* change)
  69. {
  70. (void)writer;
  71. (void)change;
  72. }
  73. /**
  74. * @brief Method called when the livelivess of a writer is lost
  75. * @param writer The writer
  76. * @param status The liveliness lost status
  77. */
  78. virtual void on_liveliness_lost(
  79. RTPSWriter* writer,
  80. const LivelinessLostStatus& status)
  81. {
  82. (void)writer;
  83. (void)status;
  84. }
  85. };
  86. } /* namespace rtps */
  87. } /* namespace fastrtps */
  88. } /* namespace eprosima */
  89. #endif /* _FASTDDS_RTPS_WRITERLISTENER_H_ */