Skip to content

Commit 6a78844

Browse files
committed
Refs #21197. Apply suggestions
Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
1 parent 38151b1 commit 6a78844

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

include/fastdds/rtps/common/ProductVersion_t.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* @file ProductVersion_t.hpp
1717
*/
1818

19-
#ifndef _FASTDDS_RTPS_COMMON_PRODUCTVERSIONT_HPP_
20-
#define _FASTDDS_RTPS_COMMON_PRODUCTVERSIONT_HPP_
19+
#ifndef FASTDDS_RTPS_COMMON__PRODUCTVERSION_T_HPP
20+
#define FASTDDS_RTPS_COMMON__PRODUCTVERSION_T_HPP
2121

2222
#include <cstdint>
2323
#include <iomanip>
@@ -40,10 +40,10 @@ struct ProductVersion_t
4040
} // namespace eprosima
4141

4242
/**
43-
* @brief ostream operator<< for VendorId_t
43+
* @brief ostream operator<< for ProductVersion_t
4444
*
4545
* @param output: the output stream
46-
* @param vendor_id: the vendor id to append to the output stream
46+
* @param product_version: the product version to append to the output stream
4747
*/
4848
inline std::ostream& operator <<(
4949
std::ostream& output,
@@ -56,4 +56,4 @@ inline std::ostream& operator <<(
5656
return output;
5757
}
5858

59-
#endif /* _FASTDDS_RTPS_COMMON_PRODUCTVERSIONT_HPP_ */
59+
#endif /* FASTDDS_RTPS_COMMON__PRODUCTVERSION_T_HPP */

src/cpp/rtps/builtin/data/ParticipantProxyData.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <fastdds/core/policy/ParameterList.hpp>
2626
#include <fastdds/core/policy/QosPoliciesSerializer.hpp>
2727
#include <fastdds/dds/log/Log.hpp>
28+
#include <fastdds/rtps/common/ProductVersion_t.hpp>
2829
#include <fastdds/rtps/common/VendorId_t.hpp>
2930

3031
#include <rtps/builtin/BuiltinProtocols.h>
@@ -472,11 +473,7 @@ bool ParticipantProxyData::readFromCDRMessage(
472473
}
473474
case fastdds::dds::PID_PRODUCT_VERSION:
474475
{
475-
VendorId_t local_vendor_id = source_vendor_id;
476-
if (c_VendorId_Unknown == local_vendor_id)
477-
{
478-
local_vendor_id = ((c_VendorId_Unknown == m_VendorId) ? c_VendorId_eProsima : m_VendorId);
479-
}
476+
VendorId_t local_vendor_id {select_vendor_id(source_vendor_id)};
480477

481478
// Ignore custom PID when coming from other vendors
482479
if (c_VendorId_eProsima != local_vendor_id)
@@ -533,11 +530,7 @@ bool ParticipantProxyData::readFromCDRMessage(
533530
}
534531
case fastdds::dds::PID_NETWORK_CONFIGURATION_SET:
535532
{
536-
VendorId_t local_vendor_id = source_vendor_id;
537-
if (c_VendorId_Unknown == local_vendor_id)
538-
{
539-
local_vendor_id = ((c_VendorId_Unknown == m_VendorId) ? c_VendorId_eProsima : m_VendorId);
540-
}
533+
VendorId_t local_vendor_id {select_vendor_id(source_vendor_id)};
541534

542535
// Ignore custom PID when coming from other vendors
543536
if (c_VendorId_eProsima != local_vendor_id)
@@ -992,6 +985,17 @@ void ParticipantProxyData::assert_liveliness()
992985
last_received_message_tm_ = std::chrono::steady_clock::now();
993986
}
994987

988+
VendorId_t ParticipantProxyData::select_vendor_id(
989+
const VendorId_t source_vendor_id)
990+
{
991+
VendorId_t ret_vendor_id {source_vendor_id};
992+
if (c_VendorId_Unknown == ret_vendor_id)
993+
{
994+
ret_vendor_id = ((c_VendorId_Unknown == m_VendorId) ? c_VendorId_eProsima : m_VendorId);
995+
}
996+
return ret_vendor_id;
997+
}
998+
995999
} /* namespace rtps */
9961000
} /* namespace fastdds */
9971001
} /* namespace eprosima */

src/cpp/rtps/builtin/data/ParticipantProxyData.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ class ParticipantProxyData
223223
return lease_duration_;
224224
}
225225

226+
VendorId_t select_vendor_id(
227+
const VendorId_t source_vendor_id);
228+
226229
private:
227230

228231
//! Store the last timestamp it was received a RTPS message from the remote participant.

0 commit comments

Comments
 (0)