SubscriberAttributes.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 SubscriberAttributes.h
  16. */
  17. #ifndef SUBSCRIBERATTRIBUTES_H_
  18. #define SUBSCRIBERATTRIBUTES_H_
  19. #include <fastdds/rtps/resources/ResourceManagement.h>
  20. #include <fastdds/rtps/common/Time_t.h>
  21. #include <fastdds/rtps/common/Locator.h>
  22. #include <fastdds/rtps/attributes/ReaderAttributes.h>
  23. #include <fastrtps/attributes/TopicAttributes.h>
  24. #include <fastrtps/qos/ReaderQos.h>
  25. #include <fastdds/rtps/attributes/PropertyPolicy.h>
  26. namespace eprosima {
  27. namespace fastrtps {
  28. /**
  29. * Class SubscriberAttributes, used by the user to define the attributes of a Subscriber.
  30. * @ingroup FASTRTPS_ATTRIBUTES_MODULE
  31. */
  32. class SubscriberAttributes
  33. {
  34. public:
  35. //!Topic Attributes
  36. TopicAttributes topic;
  37. //!Reader QOs.
  38. ReaderQos qos;
  39. //!Times for a RELIABLE Reader
  40. rtps::ReaderTimes times;
  41. //!Unicast locator list
  42. rtps::LocatorList_t unicastLocatorList;
  43. //!Multicast locator list
  44. rtps::LocatorList_t multicastLocatorList;
  45. //!Remote locator list
  46. rtps::LocatorList_t remoteLocatorList;
  47. //!Expects Inline QOS
  48. bool expectsInlineQos;
  49. //!Underlying History memory policy
  50. rtps::MemoryManagementPolicy_t historyMemoryPolicy;
  51. //!Properties
  52. rtps::PropertyPolicy properties;
  53. //!Matched publishers allocation limits
  54. ResourceLimitedContainerConfig matched_publisher_allocation;
  55. SubscriberAttributes()
  56. : expectsInlineQos(false)
  57. , historyMemoryPolicy(rtps::PREALLOCATED_MEMORY_MODE)
  58. , m_userDefinedID(-1)
  59. , m_entityID(-1)
  60. {}
  61. virtual ~SubscriberAttributes(){}
  62. bool operator==(const SubscriberAttributes& b) const
  63. {
  64. return (this->topic == b.topic) &&
  65. (this->qos == b.qos) &&
  66. (this->times == b.times) &&
  67. (this->unicastLocatorList == b.unicastLocatorList) &&
  68. (this->multicastLocatorList == b.multicastLocatorList) &&
  69. (this->remoteLocatorList == b.remoteLocatorList) &&
  70. (this->historyMemoryPolicy == b.historyMemoryPolicy) &&
  71. (this->properties == b.properties);
  72. }
  73. bool operator!=(const SubscriberAttributes& b) const
  74. {
  75. return !(*this == b);
  76. }
  77. /**
  78. * Get the user defined ID
  79. * @return User defined ID
  80. */
  81. inline int16_t getUserDefinedID() const { return m_userDefinedID; }
  82. /**
  83. * Get the entity defined ID
  84. * @return Entity ID
  85. */
  86. inline int16_t getEntityID() const { return m_entityID; }
  87. /**
  88. * Set the user defined ID
  89. * @param id User defined ID to be set
  90. */
  91. inline void setUserDefinedID(uint8_t id) { m_userDefinedID = id; }
  92. /**
  93. * Set the entity ID
  94. * @param id Entity ID to be set
  95. */
  96. inline void setEntityID(uint8_t id) { m_entityID = id; }
  97. private:
  98. //!User Defined ID, used for StaticEndpointDiscovery, default value -1.
  99. int16_t m_userDefinedID;
  100. //!Entity ID, if the user want to specify the EntityID of the enpoint, default value -1.
  101. int16_t m_entityID;
  102. };
  103. } /* namespace fastrtps */
  104. } /* namespace eprosima */
  105. #endif /* SUBSCRIBERPARAMS_H_ */