Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
pass context to wait set and fini context (#343)
Browse files Browse the repository at this point in the history
* pass context to wait set and fini context

Signed-off-by: William Woodall <[email protected]>

* use nullptr in C++
  • Loading branch information
wjwwood authored Jan 25, 2019
1 parent f08e97c commit 937432d
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
14 changes: 14 additions & 0 deletions rmw_connext_cpp/src/rmw_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)

rmw_ret_t
rmw_shutdown(rmw_context_t * context)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(context, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
context,
context->implementation_identifier,
rti_connext_identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
// Nothing to do here for now.
// This is just the middleware's notification that shutdown was called.
return RMW_RET_OK;
}

rmw_ret_t
rmw_context_fini(rmw_context_t * context)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(context, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
Expand Down
4 changes: 2 additions & 2 deletions rmw_connext_cpp/src/rmw_wait_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
extern "C"
{
rmw_wait_set_t *
rmw_create_wait_set(size_t max_conditions)
rmw_create_wait_set(rmw_context_t * context, size_t max_conditions)
{
return create_wait_set(rti_connext_identifier, max_conditions);
return create_wait_set(rti_connext_identifier, context, max_conditions);
}

rmw_ret_t
Expand Down
18 changes: 16 additions & 2 deletions rmw_connext_dynamic_cpp/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)

rmw_ret_t
rmw_shutdown(rmw_context_t * context)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(context, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
context,
context->implementation_identifier,
rti_connext_dynamic_identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
// Nothing to do here for now.
// This is just the middleware's notification that shutdown was called.
return RMW_RET_OK;
}

rmw_ret_t
rmw_context_fini(rmw_context_t * context)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(context, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
Expand Down Expand Up @@ -1480,9 +1494,9 @@ rmw_trigger_guard_condition(const rmw_guard_condition_t * guard_condition_handle
}

rmw_wait_set_t *
rmw_create_wait_set(size_t max_conditions)
rmw_create_wait_set(rmw_context_t * context, size_t max_conditions)
{
return create_wait_set(rti_connext_dynamic_identifier, max_conditions);
return create_wait_set(rti_connext_dynamic_identifier, context, max_conditions);
}

rmw_ret_t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

RMW_CONNEXT_SHARED_CPP_PUBLIC
rmw_wait_set_t *
create_wait_set(const char * implementation_identifier, size_t max_conditions);
create_wait_set(
const char * implementation_identifier,
rmw_context_t * context,
size_t max_conditions);

RMW_CONNEXT_SHARED_CPP_PUBLIC
rmw_ret_t
Expand Down
13 changes: 12 additions & 1 deletion rmw_connext_shared_cpp/src/wait_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,19 @@
#include "rmw_connext_shared_cpp/shared_functions.hpp"

rmw_wait_set_t *
create_wait_set(const char * implementation_identifier, size_t max_conditions)
create_wait_set(
const char * implementation_identifier,
rmw_context_t * context,
size_t max_conditions)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(context, NULL);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
init context,
context->implementation_identifier,
implementation_identifier,
// TODO(wjwwood): replace this with RMW_RET_INCORRECT_RMW_IMPLEMENTATION when refactored
return nullptr);

rmw_wait_set_t * wait_set = rmw_wait_set_allocate();

ConnextWaitSetInfo * wait_set_info = nullptr;
Expand Down

0 comments on commit 937432d

Please sign in to comment.