File tree Expand file tree Collapse file tree 8 files changed +92
-34
lines changed
include/fastdds/dds/core/policy Expand file tree Collapse file tree 8 files changed +92
-34
lines changed Original file line number Diff line number Diff line change 36
36
#include < fastrtps/types/TypeObject.h>
37
37
#include < fastrtps/utils/collections/ResourceLimitedVector.hpp>
38
38
39
-
40
39
namespace eprosima {
41
40
namespace fastdds {
42
41
namespace dds {
Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ set(${PROJECT_NAME}_source_files
161
161
fastdds/core/condition/StatusCondition.cpp
162
162
fastdds/core/condition/WaitSet.cpp
163
163
fastdds/core/policy/ParameterList.cpp
164
+ fastdds/core/policy/QosPolicyUtils.cpp
164
165
fastdds/publisher/qos/WriterQos.cpp
165
166
fastdds/subscriber/qos/ReaderQos.cpp
166
167
rtps/builtin/BuiltinProtocols.cpp
Original file line number Diff line number Diff line change
1
+ // Copyright 2021 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 QosPolicyUtils.cpp
17
+ *
18
+ */
19
+
20
+ #include < fastdds/core/policy/QosPolicyUtils.hpp>
21
+
22
+ #include < utils/Host.hpp>
23
+
24
+ namespace eprosima {
25
+ namespace fastdds {
26
+ namespace dds {
27
+ namespace utils {
28
+
29
+ // Compute the default DataSharing domain ID
30
+ uint64_t default_domain_id ()
31
+ {
32
+ uint64_t id = 0 ;
33
+ Host::uint48 mac_id = Host::instance ().mac_id ();
34
+ for (size_t i = 0 ; i < Host::mac_id_length; ++i)
35
+ {
36
+ id |= static_cast <uint64_t >(mac_id.value [i]) << (56 - (i * 8 ));
37
+ }
38
+ return id;
39
+ }
40
+
41
+ } // namespace utils
42
+ } // namespace dds
43
+ } // namespace fastdds
44
+ } // namespace eprosima
45
+
Original file line number Diff line number Diff line change
1
+ // Copyright 2021 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 QosPolicyUtils.hpp
17
+ *
18
+ */
19
+
20
+ #ifndef _FASTDDS_DDS_QOS_QOSPOLICYUTILS_HPP_
21
+ #define _FASTDDS_DDS_QOS_QOSPOLICYUTILS_HPP_
22
+
23
+ #include < stdint.h>
24
+
25
+ namespace eprosima {
26
+ namespace fastdds {
27
+ namespace dds {
28
+ namespace utils {
29
+
30
+ // Compute the default DataSharing domain ID
31
+ uint64_t default_domain_id ();
32
+
33
+ } // namespace utils
34
+ } // namespace dds
35
+ } // namespace fastdds
36
+ } // namespace eprosima
37
+
38
+ #endif // _FASTDDS_DDS_QOS_QOSPOLICYUTILS_HPP_
Original file line number Diff line number Diff line change 35
35
36
36
#include < fastdds/dds/log/Log.hpp>
37
37
#include < fastrtps/utils/TimeConversion.h>
38
- #include < utils/Host.hpp>
39
38
#include < fastdds/rtps/resources/ResourceEvent.h>
40
39
#include < fastdds/rtps/resources/TimedEvent.h>
41
40
#include < fastdds/rtps/builtin/liveliness/WLP.h>
42
41
#include < fastdds/core/policy/ParameterSerializer.hpp>
42
+ #include < fastdds/core/policy/QosPolicyUtils.hpp>
43
43
44
44
#include < rtps/history/TopicPayloadPoolRegistry.hpp>
45
45
#include < rtps/DataSharing/DataSharingPayloadPool.hpp>
@@ -205,13 +205,7 @@ ReturnCode_t DataWriterImpl::enable()
205
205
DataSharingQosPolicy datasharing (qos_.data_sharing ());
206
206
if (datasharing.domain_ids ().empty ())
207
207
{
208
- uint64_t id = 0 ;
209
- Host::uint48 mac_id = Host::instance ().mac_id ();
210
- for (size_t i = 0 ; i < Host::mac_id_length; ++i)
211
- {
212
- id |= mac_id.value [i] << (64 - i);
213
- }
214
- datasharing.add_domain_id (id);
208
+ datasharing.add_domain_id (utils::default_domain_id ());
215
209
}
216
210
w_att.endpoint .set_data_sharing_configuration (datasharing);
217
211
}
Original file line number Diff line number Diff line change 18
18
*/
19
19
20
20
#include < fastdds/dds/publisher/qos/DataWriterQos.hpp>
21
- #include < utils/Host .hpp>
21
+ #include < fastdds/core/policy/QosPolicyUtils .hpp>
22
22
23
23
using namespace eprosima ::fastdds::dds;
24
24
@@ -58,13 +58,7 @@ WriterQos DataWriterQos::get_writerqos(
58
58
if (qos.data_sharing .kind () != OFF &&
59
59
qos.data_sharing .domain_ids ().empty ())
60
60
{
61
- uint64_t id = 0 ;
62
- Host::uint48 mac_id = Host::instance ().mac_id ();
63
- for (size_t i = 0 ; i < Host::mac_id_length; ++i)
64
- {
65
- id |= static_cast <uint64_t >(mac_id.value [i]) << (56 - (i * 8 ));
66
- }
67
- qos.data_sharing .add_domain_id (id);
61
+ qos.data_sharing .add_domain_id (utils::default_domain_id ());
68
62
}
69
63
70
64
return qos;
Original file line number Diff line number Diff line change 36
36
#include < fastdds/rtps/reader/RTPSReader.h>
37
37
#include < fastdds/rtps/resources/ResourceEvent.h>
38
38
#include < fastdds/rtps/resources/TimedEvent.h>
39
+ #include < fastdds/core/policy/QosPolicyUtils.hpp>
39
40
40
41
#include < fastdds/subscriber/SubscriberImpl.hpp>
41
42
#include < fastdds/subscriber/DataReaderImpl/ReadTakeCommand.hpp>
42
43
#include < fastdds/subscriber/DataReaderImpl/StateFilter.hpp>
43
44
44
45
#include < fastrtps/utils/TimeConversion.h>
45
- #include < utils/Host.hpp>
46
46
#include < fastrtps/subscriber/SampleInfo.h>
47
47
48
48
#include < rtps/history/TopicPayloadPoolRegistry.hpp>
@@ -202,13 +202,7 @@ ReturnCode_t DataReaderImpl::enable()
202
202
DataSharingQosPolicy datasharing (qos_.data_sharing ());
203
203
if (datasharing.domain_ids ().empty ())
204
204
{
205
- uint64_t id = 0 ;
206
- Host::uint48 mac_id = Host::instance ().mac_id ();
207
- for (size_t i = 0 ; i < Host::mac_id_length; ++i)
208
- {
209
- id |= mac_id.value [i] << (64 - i);
210
- }
211
- datasharing.add_domain_id (id);
205
+ datasharing.add_domain_id (utils::default_domain_id ());
212
206
}
213
207
att.endpoint .set_data_sharing_configuration (datasharing);
214
208
}
Original file line number Diff line number Diff line change 18
18
*/
19
19
20
20
#include < fastdds/dds/subscriber/qos/DataReaderQos.hpp>
21
- #include < utils/Host.hpp>
22
- #include < fastdds/dds/log/Log.hpp>
21
+ #include < fastdds/core/policy/QosPolicyUtils.hpp>
23
22
24
23
namespace eprosima {
25
24
namespace fastdds {
@@ -54,13 +53,7 @@ ReaderQos DataReaderQos::get_readerqos(
54
53
if (qos.data_sharing .kind () != OFF &&
55
54
qos.data_sharing .domain_ids ().empty ())
56
55
{
57
- uint64_t id = 0 ;
58
- Host::uint48 mac_id = Host::instance ().mac_id ();
59
- for (size_t i = 0 ; i < Host::mac_id_length; ++i)
60
- {
61
- id |= static_cast <uint64_t >(mac_id.value [i]) << (56 - (i * 8 ));
62
- }
63
- qos.data_sharing .add_domain_id (id);
56
+ qos.data_sharing .add_domain_id (utils::default_domain_id ());
64
57
}
65
58
66
59
return qos;
You can’t perform that action at this time.
0 commit comments