PublisherListener.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 PublisherListener.h
  16. */
  17. #ifndef PUBLISHERLISTENER_H_
  18. #define PUBLISHERLISTENER_H_
  19. #include <fastrtps/rtps/common/MatchingInfo.h>
  20. #include <fastrtps/qos/DeadlineMissedStatus.h>
  21. #include <fastrtps/qos/LivelinessLostStatus.h>
  22. namespace eprosima {
  23. namespace fastrtps {
  24. class Publisher;
  25. /**
  26. * Class PublisherListener, allows the end user to implement callbacks triggered by certain events.
  27. * @ingroup FASTRTPS_MODULE
  28. * @snippet fastrtps_example.cpp ex_PublisherListener
  29. */
  30. class RTPS_DllAPI PublisherListener
  31. {
  32. public:
  33. PublisherListener(){}
  34. virtual ~PublisherListener(){}
  35. /**
  36. * This method is called when the Publisher is matched (or unmatched) against an endpoint.
  37. * @param pub Pointer to the associated Publisher
  38. * @param info Information regarding the matched subscriber
  39. */
  40. virtual void onPublicationMatched(
  41. Publisher* pub,
  42. rtps::MatchingInfo& info)
  43. {
  44. (void)pub;
  45. (void)info;
  46. }
  47. /**
  48. * A method called when a deadline is missed
  49. * @param pub Pointer to the associated Publisher
  50. * @param status The deadline missed status
  51. */
  52. virtual void on_offered_deadline_missed(
  53. Publisher* pub,
  54. const OfferedDeadlineMissedStatus& status)
  55. {
  56. (void)pub;
  57. (void)status;
  58. }
  59. /**
  60. * @brief Method called when the livelivess of a publisher is lost
  61. * @param pub The publisher
  62. * @param status The liveliness lost status
  63. */
  64. virtual void on_liveliness_lost(
  65. Publisher* pub,
  66. const LivelinessLostStatus& status)
  67. {
  68. (void)pub;
  69. (void)status;
  70. }
  71. };
  72. } /* namespace rtps */
  73. } /* namespace eprosima */
  74. #endif /* PUBLISHERLISTENER_H_ */