Ask Your Question

NodeHandle namespaces

asked 2018-10-02 10:59:13 -0600

dlae gravatar image

This is just an question about a very specific corner-case of the NodeHandle API, that is not covered by its documentation. I have no bug for you to solve or anything, I just need to know whether the scenario I'm describing in a second is possible, for my Master Thesis.

So, in this C++ code snippet

using namespace ros;
NodeHandle nh("outer_namespace/inner_namespace");

a NodeHandle is specifying a nested namespace in its constructor. Does outer_namespace have to exist before nh is constructed, or will it be created on the spot? In other words, can NodHandle define a hierarchy of namespaces, or should all but the rightmost namespace exist at creation time?

Basically, does NodeHandle nh("outer_namespace/inner_namespace"); behave like the UNIX command mkdir outer_namespace/inner_namespace or like mkdir -p outer_namespace/inner_namespace?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-10-02 11:26:08 -0600

gvdhoorn gravatar image

namespaces don't "exist", they're just prefixes on names (ie: strings) and the semantics are given to them by humans.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-10-02 10:58:26 -0600

Seen: 375 times

Last updated: Oct 02 '18