RTPSMessageSenderInterface.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 RTPSMessageSenderInterface.hpp
  16. *
  17. */
  18. #ifndef _FASTDDS_RTPS_MESSAGES_RTPSMESSAGESENDERINTERFACE_HPP_
  19. #define _FASTDDS_RTPS_MESSAGES_RTPSMESSAGESENDERINTERFACE_HPP_
  20. #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
  21. #include <fastdds/rtps/messages/CDRMessage.h>
  22. #include <fastdds/rtps/common/Guid.h>
  23. #include <vector>
  24. namespace eprosima {
  25. namespace fastrtps {
  26. namespace rtps {
  27. /**
  28. * An interface used in \ref RTPSMessageGroup to handle destinations management
  29. * and message sending.
  30. */
  31. class RTPSMessageSenderInterface
  32. {
  33. public:
  34. virtual ~RTPSMessageSenderInterface() = default;
  35. /**
  36. * Check if the destinations managed by this sender interface have changed.
  37. *
  38. * @return true if destinations have changed, false otherwise.
  39. */
  40. virtual bool destinations_have_changed() const = 0;
  41. /**
  42. * Get a GUID prefix representing all destinations.
  43. *
  44. * @return When all the destinations share the same prefix (i.e. belong to the same participant)
  45. * that prefix is returned. When there are no destinations, or they belong to different
  46. * participants, c_GuidPrefix_Unknown is returned.
  47. */
  48. virtual GuidPrefix_t destination_guid_prefix() const = 0;
  49. /**
  50. * Get the GUID prefix of all the destination participants.
  51. *
  52. * @return a const reference to a vector with the GUID prefix of all destination participants.
  53. */
  54. virtual const std::vector<GuidPrefix_t>& remote_participants() const = 0;
  55. /**
  56. * Get the GUID of all destinations.
  57. *
  58. * @return a const reference to a vector with the GUID of all destinations.
  59. */
  60. virtual const std::vector<GUID_t>& remote_guids() const = 0;
  61. /**
  62. * Send a message through this interface.
  63. *
  64. * @param message Pointer to the buffer with the message already serialized.
  65. * @param max_blocking_time_point Future timepoint where blocking send should end.
  66. */
  67. virtual bool send(
  68. CDRMessage_t* message,
  69. std::chrono::steady_clock::time_point& max_blocking_time_point) const = 0;
  70. };
  71. } /* namespace rtps */
  72. } /* namespace fastrtps */
  73. } /* namespace eprosima */
  74. #endif
  75. #endif /* _FASTDDS_RTPS_MESSAGES_RTPSMESSAGESENDERINTERFACE_HPP_ */