Skip to content

Get node names and namespaces#545

Merged
mjcarroll merged 3 commits intomasterfrom
get_node_names_and_namespaces
Sep 6, 2018
Merged

Get node names and namespaces#545
mjcarroll merged 3 commits intomasterfrom
get_node_names_and_namespaces

Conversation

@mjcarroll
Copy link
Copy Markdown
Member

Add a new method to return a vector of pair to get both node names and namespaces.

Connects to ros2/rmw#142

@mjcarroll mjcarroll added the in progress Actively being worked on (Kanban column) label Aug 29, 2018
}
if (rcutils_string_array_fini(&node_namespaces_c) != RCUTILS_RET_OK) {
error_msg += std::string(", failed also to cleanup node namespaces, leaking memory: ") +
rcl_get_error_string_safe();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't being done in the existing code either, but you should reset the error with rcl_reset_error().

ret = rcutils_string_array_fini(&node_namespaces_c);
if (ret != RCUTILS_RET_OK) {
// *INDENT-OFF*
// TODO(karsten1987): Append rcutils_error_message once it's in master
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand this TODO (copied here or from the original) @Karsten1987 can you explain?

@@ -163,10 +183,19 @@ NodeGraph::get_node_names() const
std::string("could not destroy node names: "));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exception should only be thrown after trying to fini the node_namespaces_c struct as well.

return node_names;
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Seems like unnecessary vertical whitepsace (https://google.github.io/styleguide/cppguide.html#Vertical_Whitespace)

@mjcarroll mjcarroll force-pushed the get_node_names_and_namespaces branch from 918900c to e4a2ee7 Compare September 4, 2018 20:44
@mjcarroll mjcarroll merged commit 8c6f38a into master Sep 6, 2018
@mjcarroll mjcarroll deleted the get_node_names_and_namespaces branch September 6, 2018 13:02
@mjcarroll mjcarroll removed the in progress Actively being worked on (Kanban column) label Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants