Skip to content

Commit

Permalink
code style only: wrap after open parenthesis if not in one line (#347)
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
  • Loading branch information
dirk-thomas authored Feb 4, 2020
1 parent 3adf852 commit bd5507b
Show file tree
Hide file tree
Showing 20 changed files with 160 additions and 116 deletions.
12 changes: 8 additions & 4 deletions rmw_fastrtps_cpp/src/rmw_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,19 @@ rmw_create_client(
std::string request_type_name = _create_type_name(request_members);
std::string response_type_name = _create_type_name(response_members);

if (!Domain::getRegisteredType(participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
if (
!Domain::getRegisteredType(
participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
{
info->request_type_support_ = new RequestTypeSupport_cpp(service_members);
_register_type(participant, info->request_type_support_);
}

if (!Domain::getRegisteredType(participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
if (
!Domain::getRegisteredType(
participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
{
info->response_type_support_ = new ResponseTypeSupport_cpp(service_members);
_register_type(participant, info->response_type_support_);
Expand Down
6 changes: 4 additions & 2 deletions rmw_fastrtps_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ rmw_create_publisher(

auto callbacks = static_cast<const message_type_support_callbacks_t *>(type_support->data);
std::string type_name = _create_type_name(callbacks);
if (!Domain::getRegisteredType(participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
if (
!Domain::getRegisteredType(
participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
{
info->type_support_ = new (std::nothrow) MessageTypeSupport_cpp(callbacks);
if (!info->type_support_) {
Expand Down
12 changes: 8 additions & 4 deletions rmw_fastrtps_cpp/src/rmw_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,19 @@ rmw_create_service(
std::string request_type_name = _create_type_name(request_members);
std::string response_type_name = _create_type_name(response_members);

if (!Domain::getRegisteredType(participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
if (
!Domain::getRegisteredType(
participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
{
info->request_type_support_ = new RequestTypeSupport_cpp(service_members);
_register_type(participant, info->request_type_support_);
}

if (!Domain::getRegisteredType(participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
if (
!Domain::getRegisteredType(
participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
{
info->response_type_support_ = new ResponseTypeSupport_cpp(service_members);
_register_type(participant, info->response_type_support_);
Expand Down
6 changes: 4 additions & 2 deletions rmw_fastrtps_cpp/src/rmw_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ rmw_create_subscription(

auto callbacks = static_cast<const message_type_support_callbacks_t *>(type_support->data);
std::string type_name = _create_type_name(callbacks);
if (!Domain::getRegisteredType(participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
if (
!Domain::getRegisteredType(
participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
{
info->type_support_ = new (std::nothrow) MessageTypeSupport_cpp(callbacks);
if (!info->type_support_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,9 @@ inline void deserialize_field<std::string>(
}

for (size_t i = 0; i < cpp_string_vector.size(); ++i) {
if (!rosidl_generator_c__String__assign(&string_sequence_field.data[i],
cpp_string_vector[i].c_str()))
if (
!rosidl_generator_c__String__assign(
&string_sequence_field.data[i], cpp_string_vector[i].c_str()))
{
throw std::runtime_error("unable to assign rosidl_generator_c__String");
}
Expand Down
30 changes: 16 additions & 14 deletions rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,30 +106,32 @@ rmw_create_client(

untyped_request_members =
get_request_ptr(type_support->data, info->typesupport_identifier_);
untyped_response_members = get_response_ptr(type_support->data,
info->typesupport_identifier_);
untyped_response_members = get_response_ptr(
type_support->data, info->typesupport_identifier_);

info->request_type_support_impl_ = untyped_request_members;
info->response_type_support_impl_ = untyped_response_members;

std::string request_type_name = _create_type_name(untyped_request_members,
info->typesupport_identifier_);
std::string response_type_name = _create_type_name(untyped_response_members,
info->typesupport_identifier_);
std::string request_type_name = _create_type_name(
untyped_request_members, info->typesupport_identifier_);
std::string response_type_name = _create_type_name(
untyped_response_members, info->typesupport_identifier_);

if (!Domain::getRegisteredType(participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
if (!Domain::getRegisteredType(
participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
{
info->request_type_support_ = _create_request_type_support(type_support->data,
info->typesupport_identifier_);
info->request_type_support_ = _create_request_type_support(
type_support->data, info->typesupport_identifier_);
_register_type(participant, info->request_type_support_);
}

if (!Domain::getRegisteredType(participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
if (!Domain::getRegisteredType(
participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
{
info->response_type_support_ = _create_response_type_support(type_support->data,
info->typesupport_identifier_);
info->response_type_support_ = _create_response_type_support(
type_support->data, info->typesupport_identifier_);
_register_type(participant, info->response_type_support_);
}

Expand Down
9 changes: 5 additions & 4 deletions rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ rmw_create_publisher(

std::string type_name = _create_type_name(
type_support->data, info->typesupport_identifier_);
if (!Domain::getRegisteredType(participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
if (!Domain::getRegisteredType(
participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
{
info->type_support_ = _create_message_type_support(type_support->data,
info->typesupport_identifier_);
info->type_support_ = _create_message_type_support(
type_support->data, info->typesupport_identifier_);
_register_type(participant, info->type_support_);
}

Expand Down
30 changes: 16 additions & 14 deletions rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,32 @@ rmw_create_service(

untyped_request_members =
get_request_ptr(type_support->data, info->typesupport_identifier_);
untyped_response_members = get_response_ptr(type_support->data,
info->typesupport_identifier_);
untyped_response_members = get_response_ptr(
type_support->data, info->typesupport_identifier_);

info->request_type_support_impl_ = untyped_request_members;
info->response_type_support_impl_ = untyped_response_members;

std::string request_type_name = _create_type_name(untyped_request_members,
info->typesupport_identifier_);
std::string response_type_name = _create_type_name(untyped_response_members,
info->typesupport_identifier_);
std::string request_type_name = _create_type_name(
untyped_request_members, info->typesupport_identifier_);
std::string response_type_name = _create_type_name(
untyped_response_members, info->typesupport_identifier_);

if (!Domain::getRegisteredType(participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
if (!Domain::getRegisteredType(
participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
{
info->request_type_support_ = _create_request_type_support(type_support->data,
info->typesupport_identifier_);
info->request_type_support_ = _create_request_type_support(
type_support->data, info->typesupport_identifier_);
_register_type(participant, info->request_type_support_);
}

if (!Domain::getRegisteredType(participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
if (!Domain::getRegisteredType(
participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
{
info->response_type_support_ = _create_response_type_support(type_support->data,
info->typesupport_identifier_);
info->response_type_support_ = _create_response_type_support(
type_support->data, info->typesupport_identifier_);
_register_type(participant, info->response_type_support_);
}

Expand Down
9 changes: 5 additions & 4 deletions rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ rmw_create_subscription(

std::string type_name = _create_type_name(
type_support->data, info->typesupport_identifier_);
if (!Domain::getRegisteredType(participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
if (!Domain::getRegisteredType(
participant, type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->type_support_)))
{
info->type_support_ = _create_message_type_support(type_support->data,
info->typesupport_identifier_);
info->type_support_ = _create_message_type_support(
type_support->data, info->typesupport_identifier_);
_register_type(participant, info->type_support_);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ class TopicCache
auto participant_guid = iHandle2GUID(rtpsParticipantKey);
initializeParticipantMap(participant_to_topics_, participant_guid);
initializeTopicTypesMap(topic_name, participant_to_topics_[entity_guid]);
if (rcutils_logging_logger_is_enabled_for("rmw_fastrtps_shared_cpp",
RCUTILS_LOG_SEVERITY_DEBUG))
if (
rcutils_logging_logger_is_enabled_for(
"rmw_fastrtps_shared_cpp", RCUTILS_LOG_SEVERITY_DEBUG))
{
std::stringstream guid_stream;
guid_stream << entity_guid;
Expand Down Expand Up @@ -216,11 +217,13 @@ class TopicCache
}
{
auto & type_vec = topic_name_to_topic_data_[topic_name];
type_vec.erase(std::find_if(type_vec.begin(), type_vec.end(),
[type_name, entity_guid](const auto & topic_data) {
return type_name.compare(topic_data.topic_type) == 0 &&
entity_guid == topic_data.entity_guid;
}));
type_vec.erase(
std::find_if(
type_vec.begin(), type_vec.end(),
[type_name, entity_guid](const auto & topic_data) {
return type_name.compare(topic_data.topic_type) == 0 &&
entity_guid == topic_data.entity_guid;
}));
if (type_vec.empty()) {
topic_name_to_topic_data_.erase(topic_name);
}
Expand Down Expand Up @@ -259,7 +262,8 @@ inline std::ostream & operator<<(
stream << " Topics: " << std::endl;
for (auto & types : elem.second) {
stream << " " << types.first << ": ";
std::copy(types.second.begin(), types.second.end(),
std::copy(
types.second.begin(), types.second.end(),
std::ostream_iterator<std::string>(stream, ","));
stream << std::endl;
}
Expand All @@ -269,8 +273,9 @@ inline std::ostream & operator<<(
topics_ss << "Cumulative TopicToTypes: " << std::endl;
for (auto & elem : topic_cache.getTopicToTypes()) {
std::ostringstream stream;
std::copy(elem.second.begin(), elem.second.end(), std::ostream_iterator<std::string>(stream,
","));
std::copy(
elem.second.begin(), elem.second.end(), std::ostream_iterator<std::string>(
stream, ","));
topics_ss << " " << elem.first << " : " << stream.str() << std::endl;
}
ostream << map_ss.str() << topics_ss.str();
Expand Down
6 changes: 4 additions & 2 deletions rmw_fastrtps_shared_cpp/src/TypeSupport_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ std::function<uint32_t()> TypeSupport::getSerializedSizeProvider(void * data)
auto ser = static_cast<eprosima::fastcdr::Cdr *>(ser_data->data);
return static_cast<uint32_t>(ser->getSerializedDataLength());
}
return static_cast<uint32_t>(this->getEstimatedSerializedSize(ser_data->data,
ser_data->impl));
return static_cast<uint32_t>(
this->getEstimatedSerializedSize(
ser_data->data,
ser_data->impl));
};
return ser_size;
}
Expand Down
12 changes: 8 additions & 4 deletions rmw_fastrtps_shared_cpp/src/demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ _demangle_service_from_topic(const std::string & topic_name)
suffix_position = topic_name.rfind(suffix);
if (suffix_position != std::string::npos) {
if (topic_name.length() - suffix_position - suffix.length() != 0) {
RCUTILS_LOG_WARN_NAMED("rmw_fastrtps_shared_cpp",
RCUTILS_LOG_WARN_NAMED(
"rmw_fastrtps_shared_cpp",
"service topic has service prefix and a suffix, but not at the end"
", report this: '%s'", topic_name.c_str());
continue;
Expand All @@ -95,7 +96,8 @@ _demangle_service_from_topic(const std::string & topic_name)
}
}
if (std::string::npos == suffix_position) {
RCUTILS_LOG_WARN_NAMED("rmw_fastrtps_shared_cpp",
RCUTILS_LOG_WARN_NAMED(
"rmw_fastrtps_shared_cpp",
"service topic has prefix but no suffix"
", report this: '%s'", topic_name.c_str());
return "";
Expand Down Expand Up @@ -127,7 +129,8 @@ _demangle_service_type_only(const std::string & dds_type_name)
suffix_position = dds_type_name.rfind(suffix);
if (suffix_position != std::string::npos) {
if (dds_type_name.length() - suffix_position - suffix.length() != 0) {
RCUTILS_LOG_WARN_NAMED("rmw_fastrtps_shared_cpp",
RCUTILS_LOG_WARN_NAMED(
"rmw_fastrtps_shared_cpp",
"service type contains 'dds_::' and a suffix, but not at the end"
", report this: '%s'", dds_type_name.c_str());
continue;
Expand All @@ -137,7 +140,8 @@ _demangle_service_type_only(const std::string & dds_type_name)
}
}
if (std::string::npos == suffix_position) {
RCUTILS_LOG_WARN_NAMED("rmw_fastrtps_shared_cpp",
RCUTILS_LOG_WARN_NAMED(
"rmw_fastrtps_shared_cpp",
"service type contains 'dds_::' but does not have a suffix"
", report this: '%s'", dds_type_name.c_str());
return "";
Expand Down
6 changes: 4 additions & 2 deletions rmw_fastrtps_shared_cpp/src/rmw_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ __rmw_count_publishers(
std::vector<std::string> topic_fqdns;
topic_fqdns.push_back(topic_name);
if (topic_name[0] == '/') {
std::for_each(ros_prefixes.begin(), ros_prefixes.end(),
std::for_each(
ros_prefixes.begin(), ros_prefixes.end(),
[&topic_fqdns, &topic_name](const std::string & prefix) {
topic_fqdns.push_back(prefix + topic_name);
});
Expand Down Expand Up @@ -113,7 +114,8 @@ __rmw_count_subscribers(
std::vector<std::string> topic_fqdns;
topic_fqdns.push_back(topic_name);
if (topic_name[0] == '/') {
std::for_each(ros_prefixes.begin(), ros_prefixes.end(),
std::for_each(
ros_prefixes.begin(), ros_prefixes.end(),
[&topic_fqdns, &topic_name](const std::string & prefix) {
topic_fqdns.push_back(prefix + topic_name);
});
Expand Down
3 changes: 2 additions & 1 deletion rmw_fastrtps_shared_cpp/src/rmw_get_topic_endpoint_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ _get_topic_fqdns(const char * topic_name, bool no_mangle)
if (!no_mangle) {
auto ros_prefixes = _get_all_ros_prefixes();
// Build the list of all possible topic FQDN
std::for_each(ros_prefixes.begin(), ros_prefixes.end(),
std::for_each(
ros_prefixes.begin(), ros_prefixes.end(),
[&topic_fqdns, &topic_name](const std::string & prefix) {
topic_fqdns.push_back(prefix + topic_name);
});
Expand Down
Loading

0 comments on commit bd5507b

Please sign in to comment.