use return_loaned_message_from (#523)

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
This commit is contained in:
Karsten Knese 2019-10-21 20:47:12 -07:00 committed by Michael Carroll
parent cdf1b4d17d
commit 68c93c8c6d
4 changed files with 11 additions and 10 deletions

View file

@ -199,7 +199,7 @@ rcl_publisher_get_default_options(void);
/// Borrow a loaned message. /// Borrow a loaned message.
/** /**
* The memory allocated for the ros message belongs to the middleware and must not be deallocated * The memory allocated for the ros message belongs to the middleware and must not be deallocated
* other than by a call to \sa rcl_return_loaned_message. * other than by a call to \sa rcl_return_loaned_message_from_publisher.
* *
* <hr> * <hr>
* Attribute | Adherence * Attribute | Adherence
@ -228,7 +228,7 @@ rcl_borrow_loaned_message(
const rosidl_message_type_support_t * type_support, const rosidl_message_type_support_t * type_support,
void ** ros_message); void ** ros_message);
/// Return a loaned message /// Return a loaned message previously borrowed from a publisher.
/** /**
* The ownership of the passed in ros message will be transferred back to the middleware. * The ownership of the passed in ros message will be transferred back to the middleware.
* The middleware might deallocate and destroy the message so that the pointer is no longer * The middleware might deallocate and destroy the message so that the pointer is no longer
@ -252,7 +252,7 @@ rcl_borrow_loaned_message(
RCL_PUBLIC RCL_PUBLIC
RCL_WARN_UNUSED RCL_WARN_UNUSED
rcl_ret_t rcl_ret_t
rcl_return_loaned_message( rcl_return_loaned_message_from_publisher(
const rcl_publisher_t * publisher, const rcl_publisher_t * publisher,
void * loaned_message); void * loaned_message);

View file

@ -349,10 +349,10 @@ rcl_take_loaned_message(
rmw_message_info_t * message_info, rmw_message_info_t * message_info,
rmw_subscription_allocation_t * allocation); rmw_subscription_allocation_t * allocation);
/// Release a loaned message from a topic using a rcl subscription. /// Return a loaned message from a topic using a rcl subscription.
/** /**
* If a loaned message was previously obtained from the middleware with a call to * If a loaned message was previously obtained from the middleware with a call to
* \sa rcl_take_loaned_message, this message has to be released to indicate to the middleware * \sa rcl_take_loaned_message, this message has to be returned to indicate to the middleware
* that the user no longer needs that memory. * that the user no longer needs that memory.
* The user must not delete the message. * The user must not delete the message.
* *
@ -375,7 +375,7 @@ rcl_take_loaned_message(
RCL_PUBLIC RCL_PUBLIC
RCL_WARN_UNUSED RCL_WARN_UNUSED
rcl_ret_t rcl_ret_t
rcl_release_loaned_message( rcl_return_loaned_message_from_subscription(
const rcl_subscription_t * subscription, const rcl_subscription_t * subscription,
void * loaned_message); void * loaned_message);

View file

@ -265,7 +265,7 @@ rcl_borrow_loaned_message(
} }
rcl_ret_t rcl_ret_t
rcl_return_loaned_message( rcl_return_loaned_message_from_publisher(
const rcl_publisher_t * publisher, const rcl_publisher_t * publisher,
void * loaned_message) void * loaned_message)
{ {
@ -273,7 +273,7 @@ rcl_return_loaned_message(
return RCL_RET_PUBLISHER_INVALID; // error already set return RCL_RET_PUBLISHER_INVALID; // error already set
} }
RCL_CHECK_ARGUMENT_FOR_NULL(loaned_message, RCL_RET_INVALID_ARGUMENT); RCL_CHECK_ARGUMENT_FOR_NULL(loaned_message, RCL_RET_INVALID_ARGUMENT);
return rmw_return_loaned_message(publisher->impl->rmw_handle, loaned_message); return rmw_return_loaned_message_from_publisher(publisher->impl->rmw_handle, loaned_message);
} }
rcl_ret_t rcl_ret_t

View file

@ -356,7 +356,7 @@ rcl_take_loaned_message(
} }
rcl_ret_t rcl_ret_t
rcl_release_loaned_message( rcl_return_loaned_message_from_subscription(
const rcl_subscription_t * subscription, const rcl_subscription_t * subscription,
void * loaned_message) void * loaned_message)
{ {
@ -365,7 +365,8 @@ rcl_release_loaned_message(
return RCL_RET_SUBSCRIPTION_INVALID; // error already set return RCL_RET_SUBSCRIPTION_INVALID; // error already set
} }
RCL_CHECK_ARGUMENT_FOR_NULL(loaned_message, RCL_RET_INVALID_ARGUMENT); RCL_CHECK_ARGUMENT_FOR_NULL(loaned_message, RCL_RET_INVALID_ARGUMENT);
return rmw_release_loaned_message(subscription->impl->rmw_handle, loaned_message); return rmw_return_loaned_message_from_subscription(
subscription->impl->rmw_handle, loaned_message);
} }
const char * const char *