PublisherAttributes.h 3.7 KB

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