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