Participant.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 Participant.h
  16. *
  17. */
  18. #ifndef PARTICIPANT_H_
  19. #define PARTICIPANT_H_
  20. #include <fastdds/rtps/common/Guid.h>
  21. #include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
  22. #include <utility>
  23. namespace eprosima {
  24. namespace fastrtps{
  25. class ParticipantImpl;
  26. class ParticipantAttributes;
  27. namespace rtps
  28. {
  29. class WriterProxyData;
  30. class ReaderProxyData;
  31. class ResourceEvent;
  32. class RTPSParticipant;
  33. }
  34. /**
  35. * Class Participant used to group Publishers and Subscribers into a single working unit.
  36. * @ingroup FASTRTPS_MODULE
  37. */
  38. class RTPS_DllAPI Participant
  39. {
  40. public:
  41. /**
  42. * Get the rtps::GUID_t of the associated RTPSParticipant.
  43. * @return rtps::GUID_t
  44. */
  45. const rtps::GUID_t& getGuid() const;
  46. /**
  47. * Get the ParticipantAttributes.
  48. * @return ParticipantAttributes.
  49. */
  50. const ParticipantAttributes& getAttributes() const;
  51. /**
  52. * Called when using a StaticEndpointDiscovery mechanism different that the one
  53. * included in FastRTPS, for example when communicating with other implementations.
  54. * It indicates to the Participant that an Endpoint from the XML has been discovered and
  55. * should be activated.
  56. * @param partguid Participant rtps::GUID_t.
  57. * @param userId User defined ID as shown in the XML file.
  58. * @param kind EndpointKind (WRITER or READER)
  59. * @return True if correctly found and activated.
  60. */
  61. bool newRemoteEndpointDiscovered(
  62. const rtps::GUID_t& partguid,
  63. uint16_t userId,
  64. rtps::EndpointKind_t kind);
  65. /**
  66. * Returns a list with the participant names.
  67. * @return list of participant names.
  68. */
  69. std::vector<std::string> getParticipantNames() const;
  70. /**
  71. * @brief Asserts liveliness of manual by participant publishers
  72. */
  73. void assert_liveliness();
  74. rtps::ResourceEvent& get_resource_event() const;
  75. private:
  76. Participant();
  77. virtual ~Participant();
  78. ParticipantImpl* mp_impl;
  79. friend class Domain;
  80. friend class ParticipantImpl;
  81. };
  82. }
  83. } /* namespace eprosima */
  84. #endif /* PARTICIPANT_H_ */