Skip to content

Commit

Permalink
Revert "[rcl action] Addresses peer review comments (ros2#329)"
Browse files Browse the repository at this point in the history
This reverts commit d487533.
  • Loading branch information
nburek committed Nov 26, 2018
1 parent 51f50ba commit d4bc684
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 48 deletions.
58 changes: 16 additions & 42 deletions rcl_action/include/rcl_action/names.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ extern "C"
#endif

#include "rcl_action/visibility_control.h"
#include "rcl_action/types.h"

#include "rcl/allocator.h"
#include "rcl/macros.h"
Expand All @@ -42,19 +41,14 @@ extern "C"
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] action_name The name of the action whose goal service name is
* being returned.
* \param[in] action_name The non-empty name of the action whose goal
* service name is being returned.
* \param[in] allocator A valid allocator to be used.
* \param[out] goal_service_name Either an allocated string with the action
* goal service name, or `NULL` if the function failed to allocate memory
* for it. Must refer to a `NULL` pointer upon call.
* \return `RCL_RET_OK` if the action goal service name was returned, or
* \return `RCL_RET_ACTION_NAME_INVALID` if the action name is not valid
* (i.e. empty), or
* \return `RCL_RET_INVALID_ARGUMENT` if the action name is `NULL`, or
* \return `RCL_RET_INVALID_ARGUMENT` if the allocator is invalid, or
* \return `RCL_RET_INVALID_ARGUMENT` if the goal service name pointer is
* `NULL` or points to a non-`NULL` pointer, or
* \return `RCL_RET_INVALID_ARGUMENT` if any arguments are invalid, or
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed.
*/
RCL_ACTION_PUBLIC
Expand All @@ -79,19 +73,14 @@ rcl_action_get_goal_service_name(
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] action_name The name of the action whose cancel service name
* is being returned.
* \param[in] action_name The non-empty name of the action whose cancel
* service name is being returned.
* \param[in] allocator A valid allocator to be used.
* \param[out] cancel_service_name Either an allocated string with the action
* cancel service name, or `NULL` if the function failed to allocate memory
* for it. Must refer to a `NULL` pointer upon call.
* \return `RCL_RET_OK` if the action cancel service name was returned, or
* \return `RCL_RET_ACTION_NAME_INVALID` if the action name is not valid
* (i.e. empty), or
* \return `RCL_RET_INVALID_ARGUMENT` if the action name is `NULL`, or
* \return `RCL_RET_INVALID_ARGUMENT` if the allocator is invalid, or
* \return `RCL_RET_INVALID_ARGUMENT` if the cancel service name is `NULL` or
* points to a non-`NULL` pointer, or
* \return `RCL_RET_INVALID_ARGUMENT` if any arguments are invalid, or
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed.
*/
RCL_ACTION_PUBLIC
Expand All @@ -116,19 +105,14 @@ rcl_action_get_cancel_service_name(
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] action_name The name of the action whose result service name
* is being returned.
* \param[in] action_name The non-empty name of the action whose result service
* name is being returned.
* \param[in] allocator A valid allocator to be used.
* \param[out] result_service_name Either an allocated string with the action
* result service name, or `NULL` if the function failed to allocate memory
* for it. Must refer to a `NULL` pointer upon call.
* \return `RCL_RET_OK` if the action result service name was returned, or
* \return `RCL_RET_ACTION_NAME_INVALID` if the action name is not valid
* (i.e. empty), or
* \return `RCL_RET_INVALID_ARGUMENT` if the action name is `NULL`, or
* \return `RCL_RET_INVALID_ARGUMENT` if the allocator is invalid, or
* \return `RCL_RET_INVALID_ARGUMENT` if the result service name pointer is
* `NULL` or points to a non-`NULL` pointer, or
* \return `RCL_RET_INVALID_ARGUMENT` if any arguments are invalid, or
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed.
*/
RCL_ACTION_PUBLIC
Expand All @@ -153,19 +137,14 @@ rcl_action_get_result_service_name(
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] action_name The name of the action whose feedback topic name
* is being returned.
* \param[in] action_name The non-empty name of the action whose feedback
* topic name is being returned.
* \param[in] allocator A valid allocator to be used.
* \param[out] feedback_topic_name Either an allocated string with the action
* \param[out] result_service_name Either an allocated string with the action
* feedback topic name, or `NULL` if the function failed to allocate memory
* for it. Must refer to a `NULL` pointer upon call.
* \return `RCL_RET_OK` if the action feedback topic name was returned, or
* \return `RCL_RET_ACTION_NAME_INVALID` if the action name is not valid
* (i.e. empty), or
* \return `RCL_RET_INVALID_ARGUMENT` if the action name is `NULL`, or
* \return `RCL_RET_INVALID_ARGUMENT` if the allocator is invalid, or
* \return `RCL_RET_INVALID_ARGUMENT` if the feedback topic name pointer is
* `NULL` or points to a non-`NULL` pointer, or
* \return `RCL_RET_INVALID_ARGUMENT` if any arguments are invalid, or
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed.
*/
RCL_ACTION_PUBLIC
Expand All @@ -190,19 +169,14 @@ rcl_action_get_feedback_topic_name(
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] action_name The name of the action whose status topic
* \param[in] action_name The non-empty name of the action whose status topic
* name is being returned.
* \param[in] allocator A valid allocator to be used.
* \param[out] status_topic_name Either an allocated string with the action
* \param[out] result_service_name Either an allocated string with the action
* status topic name, or `NULL` if the function failed to allocate memory
* for it. Must refer to a `NULL` pointer upon call.
* \return `RCL_RET_OK` if the action status topic name was returned, or
* \return `RCL_RET_ACTION_NAME_INVALID` if the action name is not valid
* (i.e. empty), or
* \return `RCL_RET_INVALID_ARGUMENT` if the action name is `NULL`, or
* \return `RCL_RET_INVALID_ARGUMENT` if the allocator is invalid, or
* \return `RCL_RET_INVALID_ARGUMENT` if the status topic name pointer is
* `NULL` or points to a non-`NULL` pointer, or
* \return `RCL_RET_INVALID_ARGUMENT` if any arguments are invalid, or
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed.
*/
RCL_ACTION_PUBLIC
Expand Down
11 changes: 6 additions & 5 deletions rcl_action/src/rcl_action/names.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ rcl_action_get_goal_service_name(
RCL_CHECK_ARGUMENT_FOR_NULL(action_name, RCL_RET_INVALID_ARGUMENT);
if (0 == strlen(action_name)) {
RCL_SET_ERROR_MSG("invalid empty action name");
return RCL_RET_ACTION_NAME_INVALID;
return RCL_RET_INVALID_ARGUMENT;
}
RCL_CHECK_ARGUMENT_FOR_NULL(goal_service_name, RCL_RET_INVALID_ARGUMENT);
if (NULL != *goal_service_name) {
Expand All @@ -57,9 +57,10 @@ rcl_action_get_cancel_service_name(
{
RCL_CHECK_ALLOCATOR_WITH_MSG(&allocator, "allocator is invalid", return RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(action_name, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(action_name, RCL_RET_INVALID_ARGUMENT);
if (0 == strlen(action_name)) {
RCL_SET_ERROR_MSG("invalid empty action name");
return RCL_RET_ACTION_NAME_INVALID;
return RCL_RET_INVALID_ARGUMENT;
}
RCL_CHECK_ARGUMENT_FOR_NULL(cancel_service_name, RCL_RET_INVALID_ARGUMENT);
if (NULL != *cancel_service_name) {
Expand All @@ -84,7 +85,7 @@ rcl_action_get_result_service_name(
RCL_CHECK_ARGUMENT_FOR_NULL(action_name, RCL_RET_INVALID_ARGUMENT);
if (0 == strlen(action_name)) {
RCL_SET_ERROR_MSG("invalid empty action name");
return RCL_RET_ACTION_NAME_INVALID;
return RCL_RET_INVALID_ARGUMENT;
}
RCL_CHECK_ARGUMENT_FOR_NULL(result_service_name, RCL_RET_INVALID_ARGUMENT);
if (NULL != *result_service_name) {
Expand All @@ -109,7 +110,7 @@ rcl_action_get_feedback_topic_name(
RCL_CHECK_ARGUMENT_FOR_NULL(action_name, RCL_RET_INVALID_ARGUMENT);
if (0 == strlen(action_name)) {
RCL_SET_ERROR_MSG("invalid empty action name");
return RCL_RET_ACTION_NAME_INVALID;
return RCL_RET_INVALID_ARGUMENT;
}
RCL_CHECK_ARGUMENT_FOR_NULL(feedback_topic_name, RCL_RET_INVALID_ARGUMENT);
if (NULL != *feedback_topic_name) {
Expand All @@ -134,7 +135,7 @@ rcl_action_get_status_topic_name(
RCL_CHECK_ARGUMENT_FOR_NULL(action_name, RCL_RET_INVALID_ARGUMENT);
if (0 == strlen(action_name)) {
RCL_SET_ERROR_MSG("invalid empty action name");
return RCL_RET_ACTION_NAME_INVALID;
return RCL_RET_INVALID_ARGUMENT;
}
RCL_CHECK_ARGUMENT_FOR_NULL(status_topic_name, RCL_RET_INVALID_ARGUMENT);
if (NULL != *status_topic_name) {
Expand Down
2 changes: 1 addition & 1 deletion rcl_action/test/rcl_action/test_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ TEST_P(TestActionDerivedName, validate_action_derived_getter)
ret = test_subject.get_action_derived_name(
invalid_action_name, default_allocator,
&action_derived_name);
EXPECT_EQ(RCL_RET_ACTION_NAME_INVALID, ret);
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, ret);

action_derived_name = NULL;
rcl_allocator_t invalid_allocator =
Expand Down

0 comments on commit d4bc684

Please sign in to comment.