Skip to content

Commit

Permalink
Uncrustify compliance and log_error=false on loading profiles
Browse files Browse the repository at this point in the history
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Oct 25, 2019
1 parent f4691ab commit 4675d06
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 49 deletions.
30 changes: 15 additions & 15 deletions rmw_fastrtps_cpp/src/rmw_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,35 +89,35 @@ rmw_create_client(
}
}

// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill subscriber attributes with a subscriber profile profile located
// based of topic name defined by _create_topic_name(). If no profile is found, a search with profile_name "service"
// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill subscriber attributes with a subscriber
// profile profile located based of topic name defined by _create_topic_name(). If no profile is
// found, a search with profile_name "service"
// is attempted. Else, use the default attributes.
std::string topic_name_fallback = "client";
eprosima::fastrtps::SubscriberAttributes subscriberParam;
eprosima::fastrtps::fixed_string<255> sub_topic_name = _create_topic_name(
qos_policies, ros_service_response_prefix, service_name, "Reply");
Domain::getDefaultSubscriberAttributes(subscriberParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr)
{
if (XMLProfileManager::fillSubscriberAttributes(sub_topic_name.to_string(), subscriberParam) !=
XMLP_ret::XML_OK)
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr) {
if (XMLProfileManager::fillSubscriberAttributes(sub_topic_name.to_string(),
subscriberParam, false) != XMLP_ret::XML_OK)
{
XMLProfileManager::fillSubscriberAttributes(topic_name_fallback, subscriberParam);
XMLProfileManager::fillSubscriberAttributes(topic_name_fallback, subscriberParam, false);
}
}
// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill publisher attributes with a publisher profile profile located
// based of topic name defined by _create_topic_name(). If no profile is found, a search with profile_name "service"
// is attempted. Else, use the default attributes.

// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill publisher attributes with a publisher profile
// profile located based of topic name defined by _create_topic_name(). If no profile is found, a
// search with profile_name "service" is attempted. Else, use the default attributes.
eprosima::fastrtps::fixed_string<255> pub_topic_name = _create_topic_name(
qos_policies, ros_service_requester_prefix, service_name, "Request");
eprosima::fastrtps::PublisherAttributes publisherParam;
Domain::getDefaultPublisherAttributes(publisherParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr)
{
if (XMLProfileManager::fillPublisherAttributes(pub_topic_name.to_string(), publisherParam) !=
XMLP_ret::XML_OK)
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr) {
if (XMLProfileManager::fillPublisherAttributes(pub_topic_name.to_string(),
publisherParam, false) != XMLP_ret::XML_OK)
{
XMLProfileManager::fillPublisherAttributes(topic_name_fallback, publisherParam);
XMLProfileManager::fillPublisherAttributes(topic_name_fallback, publisherParam, false);
}
}

Expand Down
11 changes: 5 additions & 6 deletions rmw_fastrtps_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,13 @@ rmw_create_publisher(
return nullptr;
}

// If the user exported FASTRTPS_DEFAULT_PROFILES_FILE, try to load publisher which profile name matches
// with topic_name. If such profile does not exist, or FASTRTPS_DEFAULT_PROFILES_FILE is not defined,
// then use the default attributes.
// If the user exported FASTRTPS_DEFAULT_PROFILES_FILE, try to load publisher which profile name
// matches with topic_name. If such profile does not exist, or FASTRTPS_DEFAULT_PROFILES_FILE is
// not defined, then use the default attributes.
eprosima::fastrtps::PublisherAttributes publisherParam;
Domain::getDefaultPublisherAttributes(publisherParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr)
{
XMLProfileManager::fillPublisherAttributes(topic_name, publisherParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr) {
XMLProfileManager::fillPublisherAttributes(topic_name, publisherParam, false);
}

// TODO(karsten1987) Verify consequences for std::unique_ptr?
Expand Down
30 changes: 14 additions & 16 deletions rmw_fastrtps_cpp/src/rmw_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,35 +101,33 @@ rmw_create_service(
}
}

// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill subscriber attributes with a subscriber profile profile located
// based of topic name defined by _create_topic_name(). If no profile is found, a search with profile_name "service"
// is attempted. Else, use the default attributes.
// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill subscriber attributes with a subscriber
// profile profile located based of topic name defined by _create_topic_name(). If no profile is
// found, a search with profile_name "service" is attempted. Else, use the default attributes.
std::string topic_name_fallback = "service";
eprosima::fastrtps::SubscriberAttributes subscriberParam;
eprosima::fastrtps::fixed_string<255> sub_topic_name = _create_topic_name(
qos_policies, ros_service_requester_prefix, service_name, "Request");
Domain::getDefaultSubscriberAttributes(subscriberParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr)
{
if (XMLProfileManager::fillSubscriberAttributes(sub_topic_name.to_string(), subscriberParam) !=
XMLP_ret::XML_OK)
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr) {
if (XMLProfileManager::fillSubscriberAttributes(sub_topic_name.to_string(),
subscriberParam, false) != XMLP_ret::XML_OK)
{
XMLProfileManager::fillSubscriberAttributes(topic_name_fallback, subscriberParam);
XMLProfileManager::fillSubscriberAttributes(topic_name_fallback, subscriberParam, false);
}
}
// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill publisher attributes with a publisher profile profile located
// based of topic name defined by _create_topic_name(). If no profile is found, a search with profile_name "service"
// is attempted. Else, use the default attributes.
// If FASTRTPS_DEFAULT_PROFILES_FILE defined, fill publisher attributes with a publisher profile
// profile located based of topic name defined by _create_topic_name(). If no profile is found, a
// search with profile_name "service" is attempted. Else, use the default attributes.
eprosima::fastrtps::fixed_string<255> pub_topic_name = _create_topic_name(
qos_policies, ros_service_response_prefix, service_name, "Reply");
eprosima::fastrtps::PublisherAttributes publisherParam;
Domain::getDefaultPublisherAttributes(publisherParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr)
{
if (XMLProfileManager::fillPublisherAttributes(pub_topic_name.to_string(), publisherParam) !=
XMLP_ret::XML_OK)
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr) {
if (XMLProfileManager::fillPublisherAttributes(pub_topic_name.to_string(),
publisherParam, false) != XMLP_ret::XML_OK)
{
XMLProfileManager::fillPublisherAttributes(topic_name_fallback, publisherParam);
XMLProfileManager::fillPublisherAttributes(topic_name_fallback, publisherParam, false);
}
}

Expand Down
11 changes: 5 additions & 6 deletions rmw_fastrtps_cpp/src/rmw_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,13 @@ rmw_create_subscription(
// // Load default XML profile.
// Domain::getDefaultSubscriberAttributes(subscriberParam);

// If the user exported FASTRTPS_DEFAULT_PROFILES_FILE, try to load subscriber which profile name matches
// with topic_name. If such profile does not exist, or FASTRTPS_DEFAULT_PROFILES_FILE is not defined,
// then use the default attributes.
// If the user exported FASTRTPS_DEFAULT_PROFILES_FILE, try to load subscriber which profile
// name matches with topic_name. If such profile does not exist, or
// FASTRTPS_DEFAULT_PROFILES_FILE is not defined, then use the default attributes.
eprosima::fastrtps::SubscriberAttributes subscriberParam;
Domain::getDefaultSubscriberAttributes(subscriberParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr)
{
XMLProfileManager::fillSubscriberAttributes(topic_name, subscriberParam);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr) {
XMLProfileManager::fillSubscriberAttributes(topic_name, subscriberParam, false);
}


Expand Down
11 changes: 5 additions & 6 deletions rmw_fastrtps_shared_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,13 @@ __rmw_create_node(
}


// If the user exported FASTRTPS_DEFAULT_PROFILES_FILE, try to load participant attributes using node name as
// profile_name. If such profile does not exist, or FASTRTPS_DEFAULT_PROFILES_FILE is not defined,
// then use the default attributes.
// If the user exported FASTRTPS_DEFAULT_PROFILES_FILE, try to load participant attributes using
// node name as profile_name. If such profile does not exist, or FASTRTPS_DEFAULT_PROFILES_FILE
// is not defined, then use the default attributes.
ParticipantAttributes participantAttrs;
Domain::getDefaultParticipantAttributes(participantAttrs);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr)
{
XMLProfileManager::fillParticipantAttributes(name, participantAttrs);
if (std::getenv("FASTRTPS_DEFAULT_PROFILES_FILE") != nullptr) {
XMLProfileManager::fillParticipantAttributes(name, participantAttrs, false);
}

participantAttrs.rtps.builtin.domainId = static_cast<uint32_t>(domain_id);
Expand Down

0 comments on commit 4675d06

Please sign in to comment.