65,180
社区成员




class ROSCPP_DECL NodeHandle
{
public:
/**
* \brief Constructor
*
* When a NodeHandle is constructed, it checks to see if the global
* node state has already been started. If so, it increments a
* global reference count. If not, it starts the node with
* ros::start() and sets the reference count to 1.
*
* \param ns Namespace for this NodeHandle. This acts in addition to any namespace assigned to this ROS node.
* eg. If the node's namespace is "/a" and the namespace passed in here is "b", all
* topics/services/parameters will be prefixed with "/a/b/"
* \param remappings Remappings for this NodeHandle.
* \throws InvalidNameException if the namespace is not a valid graph resource name
*/
NodeHandle(const std::string& ns = std::string(), const M_string& remappings = M_string());
/**
* \brief Copy constructor
*
* When a NodeHandle is copied, it inherits the namespace of the
* NodeHandle being copied, and increments the reference count of
* the global node state by 1.
*/
NodeHandle(const NodeHandle& rhs);
/**
* \brief Parent constructor
*
* This version of the constructor takes a "parent" NodeHandle, and is equivalent to:
\verbatim
NodeHandle child(parent.getNamespace() + "/" + ns);
\endverbatim
*
* When a NodeHandle is copied, it inherits the namespace of the
* NodeHandle being copied, and increments the reference count of
* the global node state by 1.
*
* \throws InvalidNameException if the namespace is not a valid
* graph resource name
*/
NodeHandle(const NodeHandle& parent, const std::string& ns);
/**
* \brief Parent constructor
*
* This version of the constructor takes a "parent" NodeHandle, and is equivalent to:
\verbatim
NodeHandle child(parent.getNamespace() + "/" + ns, remappings);
\endverbatim
*
* This version also lets you pass in name remappings that are specific to this NodeHandle
*
* When a NodeHandle is copied, it inherits the namespace of the NodeHandle being copied,
* and increments the reference count of the global node state
* by 1.
* \throws InvalidNameException if the namespace is not a valid graph resource name
*/
NodeHandle(const NodeHandle& parent, const std::string& ns, const M_string& remappings);
/**
* \brief Destructor
*
* When a NodeHandle is destroyed, it decrements a global reference
* count by 1, and if the reference count is now 0, shuts down the
* node.
*/
NodeHandle(const NodeHandle& rhs)
显然是NodeHandle的拷贝构造函数,但是NodeHandle(const NodeHandle& parent, const std::string& ns), NodeHandle(const NodeHandle& parent, const std::string& ns, const M_string& remappings)
这两个从注释来看,应该也是起拷贝作用。所以就在想如果一个类有多个拷贝构造函数,那么编译器是怎么判断调用哪个拷贝构造函数的呢?