/src/Fast-DDS/src/cpp/xmlparser/attributes/PublisherAttributes.hpp
Line | Count | Source |
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 | | /** |
16 | | * @file PublisherAttributes.hpp |
17 | | */ |
18 | | |
19 | | #ifndef FASTDDS_XMLPARSER_ATTRIBUTES__PUBLISHERATTRIBUTES_HPP |
20 | | #define FASTDDS_XMLPARSER_ATTRIBUTES__PUBLISHERATTRIBUTES_HPP |
21 | | |
22 | | #include <cstdint> |
23 | | |
24 | | #include <fastdds/dds/publisher/qos/WriterQos.hpp> |
25 | | #include <fastdds/rtps/attributes/ExternalLocators.hpp> |
26 | | #include <fastdds/rtps/attributes/PropertyPolicy.hpp> |
27 | | #include <fastdds/rtps/attributes/ResourceManagement.hpp> |
28 | | #include <fastdds/rtps/attributes/WriterAttributes.hpp> |
29 | | #include <fastdds/rtps/common/Locator.hpp> |
30 | | #include <fastdds/rtps/common/Time_t.hpp> |
31 | | #include <fastdds/utils/collections/ResourceLimitedContainerConfig.hpp> |
32 | | |
33 | | #include <xmlparser/attributes/TopicAttributes.hpp> |
34 | | |
35 | | namespace eprosima { |
36 | | namespace fastdds { |
37 | | namespace xmlparser { |
38 | | |
39 | | /** |
40 | | * Class PublisherAttributes, used by the user to define the attributes of a Publisher. |
41 | | * @ingroup FASTDDS_ATTRIBUTES_MODULE |
42 | | */ |
43 | | class PublisherAttributes |
44 | | { |
45 | | public: |
46 | | |
47 | 60.7k | PublisherAttributes() = default; |
48 | | |
49 | 58.7k | virtual ~PublisherAttributes() = default; |
50 | | |
51 | | bool operator ==( |
52 | | const PublisherAttributes& b) const |
53 | 0 | { |
54 | 0 | return (this->m_userDefinedID == b.m_userDefinedID) && |
55 | 0 | (this->m_entityID == b.m_entityID) && |
56 | 0 | (this->topic == b.topic) && |
57 | 0 | (this->qos == b.qos) && |
58 | 0 | (this->times == b.times) && |
59 | 0 | (this->unicastLocatorList == b.unicastLocatorList) && |
60 | 0 | (this->multicastLocatorList == b.multicastLocatorList) && |
61 | 0 | (this->remoteLocatorList == b.remoteLocatorList) && |
62 | 0 | (this->historyMemoryPolicy == b.historyMemoryPolicy) && |
63 | 0 | (this->properties == b.properties) && |
64 | 0 | (this->matched_subscriber_allocation == b.matched_subscriber_allocation); |
65 | 0 | } |
66 | | |
67 | | //! Topic Attributes for the Publisher |
68 | | fastdds::xmlparser::TopicAttributes topic; |
69 | | |
70 | | //! QOS for the Publisher |
71 | | dds::WriterQos qos; |
72 | | |
73 | | //! Writer Attributes |
74 | | rtps::WriterTimes times; |
75 | | |
76 | | //! Unicast locator list |
77 | | rtps::LocatorList_t unicastLocatorList; |
78 | | |
79 | | //! Multicast locator list |
80 | | rtps::LocatorList_t multicastLocatorList; |
81 | | |
82 | | //! Remote locator list |
83 | | rtps::LocatorList_t remoteLocatorList; |
84 | | |
85 | | //! The collection of external locators to use for communication. |
86 | | rtps::ExternalLocators external_unicast_locators; |
87 | | |
88 | | //! Whether locators that don't match with the announced locators should be kept. |
89 | | bool ignore_non_matching_locators = false; |
90 | | |
91 | | //! Underlying History memory policy |
92 | | rtps::MemoryManagementPolicy_t historyMemoryPolicy = |
93 | | rtps::MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; |
94 | | |
95 | | //! Properties |
96 | | rtps::PropertyPolicy properties; |
97 | | |
98 | | //! Allocation limits on the matched subscribers collections |
99 | | fastdds::ResourceLimitedContainerConfig matched_subscriber_allocation; |
100 | | |
101 | | /** |
102 | | * Get the user defined ID |
103 | | * @return User defined ID |
104 | | */ |
105 | | inline int16_t getUserDefinedID() const |
106 | 0 | { |
107 | 0 | return m_userDefinedID; |
108 | 0 | } |
109 | | |
110 | | /** |
111 | | * Get the entity defined ID |
112 | | * @return Entity ID |
113 | | */ |
114 | | inline int16_t getEntityID() const |
115 | 0 | { |
116 | 0 | return m_entityID; |
117 | 0 | } |
118 | | |
119 | | /** |
120 | | * Set the user defined ID |
121 | | * @param id User defined ID to be set |
122 | | */ |
123 | | inline void setUserDefinedID( |
124 | | uint8_t id) |
125 | 0 | { |
126 | 0 | m_userDefinedID = id; |
127 | 0 | } |
128 | | |
129 | | /** |
130 | | * Set the entity ID |
131 | | * @param id Entity ID to be set |
132 | | */ |
133 | | inline void setEntityID( |
134 | | uint8_t id) |
135 | 0 | { |
136 | 0 | m_entityID = id; |
137 | 0 | } |
138 | | |
139 | | private: |
140 | | |
141 | | //! User Defined ID, used for StaticEndpointDiscovery, default value -1. |
142 | | int16_t m_userDefinedID = -1; |
143 | | //! Entity ID, if the user want to specify the EntityID of the enpoint, default value -1. |
144 | | int16_t m_entityID = -1; |
145 | | }; |
146 | | |
147 | | } // namespace xmlparser |
148 | | } // namespace fastdds |
149 | | } // namespace eprosima |
150 | | |
151 | | #endif // FASTDDS_XMLPARSER_ATTRIBUTES__PUBLISHERATTRIBUTES_HPP |