microRTPS: use char-by-char comparison instead of stringstream comparison

This commit is contained in:
TSC21
2020-03-05 12:56:44 +00:00
committed by Nuno Marques
parent 80c658c1ae
commit db7d98c16f
2 changed files with 12 additions and 8 deletions

View File

@@ -129,14 +129,16 @@ void @(topic)_Publisher::PubListener::onPublicationMatched(Publisher* pub, Match
{
// The first 6 values of the ID guidPrefix of an entity in a DDS-RTPS Domain
// are the same for all its subcomponents (publishers, subscribers)
std::stringstream own_endpoint, remote_endpoint;
bool is_different_endpoint = false;
for (size_t i = 0; i < 6; i++) {
own_endpoint << pub->getGuid().guidPrefix.value[i];
remote_endpoint << info.remoteEndpointGuid.guidPrefix.value[i];
if (pub->getGuid().guidPrefix.value[i] != info.remoteEndpointGuid.guidPrefix.value[i]) {
is_different_endpoint = true;
break;
}
}
// If the matching happens for the same entity, do not make a match
if (own_endpoint.str() != remote_endpoint.str()) {
if (is_different_endpoint) {
if (info.status == MATCHED_MATCHING)
{
n_matched++;

View File

@@ -129,14 +129,16 @@ void @(topic)_Subscriber::SubListener::onSubscriptionMatched(Subscriber* sub, Ma
{
// The first 6 values of the ID guidPrefix of an entity in a DDS-RTPS Domain
// are the same for all its subcomponents (publishers, subscribers)
std::stringstream own_endpoint, remote_endpoint;
bool is_different_endpoint = false;
for (size_t i = 0; i < 6; i++) {
own_endpoint << sub->getGuid().guidPrefix.value[i];
remote_endpoint << info.remoteEndpointGuid.guidPrefix.value[i];
if (sub->getGuid().guidPrefix.value[i] != info.remoteEndpointGuid.guidPrefix.value[i]) {
is_different_endpoint = true;
break;
}
}
// If the matching happens for the same entity, do not make a match
if (own_endpoint.str() != remote_endpoint.str()) {
if (is_different_endpoint) {
if (info.status == MATCHED_MATCHING)
{
n_matched++;