Function rmw_destroy_node

Function Documentation

rmw_ret_t rmw_destroy_node(rmw_node_t *node)

Finalize a given node handle, reclaim the resources, and deallocate the node handle.

This function will return early if a logical error, such as RMW_RET_INVALID_ARGUMENT or RMW_RET_INCORRECT_RMW_IMPLEMENTATION, ensues, leaving the given node handle unchanged. Otherwise, it will proceed despite errors, freeing as many resources as it can, including the node handle. Usage of a deallocated node handle is undefined behavior.

Parameters:

node[in] the node handle to be destroyed

Pre:

All publishers, subscribers, services, and clients created from this node must have been destroyed prior to this call. Some rmw implementations may verify this, returning RMW_RET_ERROR and setting a human readable error message if any entity created from this node has not yet been destroyed. However, this is not guaranteed and so callers should ensure that this is the case before calling this function.

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_INVALID_ARGUMENT if node is invalid, or

Returns:

RMW_RET_INCORRECT_RMW_IMPLEMENTATION if the implementation identifier does not match, or

Returns:

RMW_RET_ERROR if an unexpected error occurs.