From e7fd9b9be6713aa71673a2753bfcbdd6840083c3 Mon Sep 17 00:00:00 2001 From: Mikael Arguedas Date: Wed, 22 Nov 2017 14:00:34 -0800 Subject: [PATCH 1/5] rename *waitset* to *wait_set* --- rmw_connext_cpp/src/{rmw_waitset.cpp => rmw_wait_set.cpp} | 0 .../include/rmw_connext_shared_cpp/{waitset.hpp => wait_set.hpp} | 0 rmw_connext_shared_cpp/src/{waitset.cpp => wait_set.cpp} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename rmw_connext_cpp/src/{rmw_waitset.cpp => rmw_wait_set.cpp} (100%) rename rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/{waitset.hpp => wait_set.hpp} (100%) rename rmw_connext_shared_cpp/src/{waitset.cpp => wait_set.cpp} (100%) diff --git a/rmw_connext_cpp/src/rmw_waitset.cpp b/rmw_connext_cpp/src/rmw_wait_set.cpp similarity index 100% rename from rmw_connext_cpp/src/rmw_waitset.cpp rename to rmw_connext_cpp/src/rmw_wait_set.cpp diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/waitset.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp similarity index 100% rename from rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/waitset.hpp rename to rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp diff --git a/rmw_connext_shared_cpp/src/waitset.cpp b/rmw_connext_shared_cpp/src/wait_set.cpp similarity index 100% rename from rmw_connext_shared_cpp/src/waitset.cpp rename to rmw_connext_shared_cpp/src/wait_set.cpp From 2b3dfdaa964a500a40c63bbf9df5d83e455a977f Mon Sep 17 00:00:00 2001 From: Mikael Arguedas Date: Wed, 22 Nov 2017 14:03:01 -0800 Subject: [PATCH 2/5] waitset -> wait_set --- rmw_connext_cpp/CMakeLists.txt | 2 +- rmw_connext_cpp/src/rmw_wait.cpp | 4 +- rmw_connext_cpp/src/rmw_wait_set.cpp | 12 +- rmw_connext_dynamic_cpp/src/functions.cpp | 14 +-- rmw_connext_shared_cpp/CMakeLists.txt | 2 +- .../shared_functions.hpp | 2 +- .../include/rmw_connext_shared_cpp/types.hpp | 2 +- .../include/rmw_connext_shared_cpp/wait.hpp | 82 ++++++------ .../rmw_connext_shared_cpp/wait_set.hpp | 6 +- .../src/condition_error.cpp | 6 +- rmw_connext_shared_cpp/src/wait_set.cpp | 118 +++++++++--------- 11 files changed, 125 insertions(+), 125 deletions(-) diff --git a/rmw_connext_cpp/CMakeLists.txt b/rmw_connext_cpp/CMakeLists.txt index 33eb2887..bde0fe00 100644 --- a/rmw_connext_cpp/CMakeLists.txt +++ b/rmw_connext_cpp/CMakeLists.txt @@ -93,7 +93,7 @@ add_library( src/rmw_topic_names_and_types.cpp src/rmw_trigger_guard_condition.cpp src/rmw_wait.cpp - src/rmw_waitset.cpp) + src/rmw_wait_set.cpp) ament_target_dependencies(rmw_connext_cpp "rcutils" "rmw" diff --git a/rmw_connext_cpp/src/rmw_wait.cpp b/rmw_connext_cpp/src/rmw_wait.cpp index 84b75e4a..4a4e656e 100644 --- a/rmw_connext_cpp/src/rmw_wait.cpp +++ b/rmw_connext_cpp/src/rmw_wait.cpp @@ -29,11 +29,11 @@ rmw_wait( rmw_guard_conditions_t * guard_conditions, rmw_services_t * services, rmw_clients_t * clients, - rmw_waitset_t * waitset, + rmw_wait_set_t * wait_set, const rmw_time_t * wait_timeout) { return wait( - rti_connext_identifier, subscriptions, guard_conditions, services, clients, waitset, + rti_connext_identifier, subscriptions, guard_conditions, services, clients, wait_set, wait_timeout); } } // extern "C" diff --git a/rmw_connext_cpp/src/rmw_wait_set.cpp b/rmw_connext_cpp/src/rmw_wait_set.cpp index ea39c9d6..ad2adde9 100644 --- a/rmw_connext_cpp/src/rmw_wait_set.cpp +++ b/rmw_connext_cpp/src/rmw_wait_set.cpp @@ -14,21 +14,21 @@ #include "rmw/rmw.h" -#include "rmw_connext_shared_cpp/waitset.hpp" +#include "rmw_connext_shared_cpp/wait_set.hpp" #include "rmw_connext_cpp/identifier.hpp" extern "C" { -rmw_waitset_t * -rmw_create_waitset(size_t max_conditions) +rmw_wait_set_t * +rmw_create_wait_set(size_t max_conditions) { - return create_waitset(rti_connext_identifier, max_conditions); + return create_wait_set(rti_connext_identifier, max_conditions); } rmw_ret_t -rmw_destroy_waitset(rmw_waitset_t * waitset) +rmw_destroy_wait_set(rmw_wait_set_t * wait_set) { - return destroy_waitset(rti_connext_identifier, waitset); + return destroy_wait_set(rti_connext_identifier, wait_set); } } // extern "C" diff --git a/rmw_connext_dynamic_cpp/src/functions.cpp b/rmw_connext_dynamic_cpp/src/functions.cpp index db780d3b..508faaf2 100644 --- a/rmw_connext_dynamic_cpp/src/functions.cpp +++ b/rmw_connext_dynamic_cpp/src/functions.cpp @@ -1309,16 +1309,16 @@ rmw_trigger_guard_condition(const rmw_guard_condition_t * guard_condition_handle return trigger_guard_condition(rti_connext_dynamic_identifier, guard_condition_handle); } -rmw_waitset_t * -rmw_create_waitset(size_t max_conditions) +rmw_wait_set_t * +rmw_create_wait_set(size_t max_conditions) { - return create_waitset(rti_connext_dynamic_identifier, max_conditions); + return create_wait_set(rti_connext_dynamic_identifier, max_conditions); } rmw_ret_t -rmw_destroy_waitset(rmw_waitset_t * waitset) +rmw_destroy_wait_set(rmw_wait_set_t * wait_set) { - return destroy_waitset(rti_connext_dynamic_identifier, waitset); + return destroy_wait_set(rti_connext_dynamic_identifier, wait_set); } rmw_ret_t @@ -1327,12 +1327,12 @@ rmw_wait( rmw_guard_conditions_t * guard_conditions, rmw_services_t * services, rmw_clients_t * clients, - rmw_waitset_t * waitset, + rmw_wait_set_t * wait_set, const rmw_time_t * wait_timeout) { return wait (rti_connext_dynamic_identifier, subscriptions, guard_conditions, services, clients, - waitset, + wait_set, wait_timeout); } diff --git a/rmw_connext_shared_cpp/CMakeLists.txt b/rmw_connext_shared_cpp/CMakeLists.txt index a5924013..44680be0 100644 --- a/rmw_connext_shared_cpp/CMakeLists.txt +++ b/rmw_connext_shared_cpp/CMakeLists.txt @@ -45,7 +45,7 @@ add_library( src/service_names_and_types.cpp src/topic_names_and_types.cpp src/trigger_guard_condition.cpp - src/waitset.cpp + src/wait_set.cpp src/types/custom_data_reader_listener.cpp src/types/custom_publisher_listener.cpp src/types/custom_subscriber_listener.cpp) diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp index 3a412a5d..0eafdc7d 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp @@ -30,6 +30,6 @@ #include "trigger_guard_condition.hpp" #include "types.hpp" #include "wait.hpp" -#include "waitset.hpp" +#include "wait_set.hpp" #endif // RMW_CONNEXT_SHARED_CPP__SHARED_FUNCTIONS_HPP_ diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/types.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/types.hpp index 18d9265b..001d6bab 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/types.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/types.hpp @@ -110,7 +110,7 @@ struct ConnextPublisherGID struct ConnextWaitSetInfo { - DDSWaitSet * waitset; + DDSWaitSet * wait_set; DDSConditionSeq * active_conditions; DDSConditionSeq * attached_conditions; }; diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp index 8da26813..1a8ede56 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp @@ -33,7 +33,7 @@ wait( rmw_guard_conditions_t * guard_conditions, rmw_services_t * services, rmw_clients_t * clients, - rmw_waitset_t * waitset, + rmw_wait_set_t * wait_set, const rmw_time_t * wait_timeout) { // To ensure that we properly clean up the wait set, we declare an @@ -44,77 +44,77 @@ wait( ~atexit_t() { // Manually detach conditions and clear sequences, to ensure a clean wait set for next time. - if (!waitset) { - RMW_SET_ERROR_MSG("waitset handle is null"); + if (!wait_set) { + RMW_SET_ERROR_MSG("wait_set handle is null"); return; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( - waitset handle, - waitset->implementation_identifier, implementation_identifier, + wait_set handle, + wait_set->implementation_identifier, implementation_identifier, return ) - ConnextWaitSetInfo * waitset_info = static_cast(waitset->data); - if (!waitset_info) { + ConnextWaitSetInfo * wait_set_info = static_cast(wait_set->data); + if (!wait_set_info) { RMW_SET_ERROR_MSG("WaitSet implementation struct is null"); return; } - DDSWaitSet * dds_waitset = static_cast(waitset_info->waitset); - if (!dds_waitset) { - RMW_SET_ERROR_MSG("DDS waitset handle is null"); + DDSWaitSet * dds_wait_set = static_cast(wait_set_info->wait_set); + if (!dds_wait_set) { + RMW_SET_ERROR_MSG("DDS wait_set handle is null"); return; } DDSConditionSeq * attached_conditions = - static_cast(waitset_info->attached_conditions); + static_cast(wait_set_info->attached_conditions); if (!attached_conditions) { RMW_SET_ERROR_MSG("DDS condition sequence handle is null"); return; } DDS_ReturnCode_t retcode; - retcode = dds_waitset->get_conditions(*attached_conditions); + retcode = dds_wait_set->get_conditions(*attached_conditions); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get attached conditions for waitset"); + RMW_SET_ERROR_MSG("Failed to get attached conditions for wait_set"); return; } for (DDS_Long i = 0; i < attached_conditions->length(); ++i) { - retcode = dds_waitset->detach_condition((*attached_conditions)[i]); + retcode = dds_wait_set->detach_condition((*attached_conditions)[i]); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from waitset"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); } } } - rmw_waitset_t * waitset = NULL; + rmw_wait_set_t * wait_set = NULL; const char * implementation_identifier = NULL; } atexit; - atexit.waitset = waitset; + atexit.wait_set = wait_set; atexit.implementation_identifier = implementation_identifier; - if (!waitset) { - RMW_SET_ERROR_MSG("waitset handle is null"); + if (!wait_set) { + RMW_SET_ERROR_MSG("wait_set handle is null"); return RMW_RET_ERROR; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( - waitset, - waitset->implementation_identifier, implementation_identifier, + wait_set, + wait_set->implementation_identifier, implementation_identifier, return RMW_RET_ERROR); - ConnextWaitSetInfo * waitset_info = static_cast(waitset->data); - if (!waitset_info) { + ConnextWaitSetInfo * wait_set_info = static_cast(wait_set->data); + if (!wait_set_info) { RMW_SET_ERROR_MSG("WaitSet implementation struct is null"); return RMW_RET_ERROR; } - DDSWaitSet * dds_waitset = static_cast(waitset_info->waitset); - if (!dds_waitset) { - RMW_SET_ERROR_MSG("DDS waitset handle is null"); + DDSWaitSet * dds_wait_set = static_cast(wait_set_info->wait_set); + if (!dds_wait_set) { + RMW_SET_ERROR_MSG("DDS wait_set handle is null"); return RMW_RET_ERROR; } DDSConditionSeq * active_conditions = - static_cast(waitset_info->active_conditions); + static_cast(wait_set_info->active_conditions); if (!active_conditions) { RMW_SET_ERROR_MSG("DDS condition sequence handle is null"); return RMW_RET_ERROR; @@ -135,7 +135,7 @@ wait( return RMW_RET_ERROR; } rmw_ret_t rmw_status = check_attach_condition_error( - dds_waitset->attach_condition(read_condition)); + dds_wait_set->attach_condition(read_condition)); if (rmw_status != RMW_RET_OK) { return rmw_status; } @@ -152,7 +152,7 @@ wait( return RMW_RET_ERROR; } rmw_ret_t rmw_status = check_attach_condition_error( - dds_waitset->attach_condition(guard_condition)); + dds_wait_set->attach_condition(guard_condition)); if (rmw_status != RMW_RET_OK) { return rmw_status; } @@ -176,7 +176,7 @@ wait( return RMW_RET_ERROR; } rmw_ret_t rmw_status = check_attach_condition_error( - dds_waitset->attach_condition(read_condition)); + dds_wait_set->attach_condition(read_condition)); if (rmw_status != RMW_RET_OK) { return rmw_status; } @@ -206,7 +206,7 @@ wait( return RMW_RET_ERROR; } rmw_ret_t rmw_status = check_attach_condition_error( - dds_waitset->attach_condition(read_condition)); + dds_wait_set->attach_condition(read_condition)); if (rmw_status != RMW_RET_OK) { return rmw_status; } @@ -222,10 +222,10 @@ wait( timeout.nanosec = static_cast(wait_timeout->nsec); } - DDS_ReturnCode_t status = dds_waitset->wait(*active_conditions, timeout); + DDS_ReturnCode_t status = dds_wait_set->wait(*active_conditions, timeout); if (status != DDS_RETCODE_OK && status != DDS_RETCODE_TIMEOUT) { - RMW_SET_ERROR_MSG("failed to wait on waitset"); + RMW_SET_ERROR_MSG("failed to wait on wait_set"); return RMW_RET_ERROR; } @@ -256,9 +256,9 @@ wait( if (!(j < active_conditions->length())) { subscriptions->subscribers[i] = 0; } - DDS_ReturnCode_t retcode = dds_waitset->detach_condition(read_condition); + DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(read_condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from waitset"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); return RMW_RET_ERROR; } } @@ -292,9 +292,9 @@ wait( if (!(j < active_conditions->length())) { guard_conditions->guard_conditions[i] = 0; } - DDS_ReturnCode_t retcode = dds_waitset->detach_condition(condition); + DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from waitset"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); return RMW_RET_ERROR; } } @@ -327,9 +327,9 @@ wait( if (!(j < active_conditions->length())) { services->services[i] = 0; } - DDS_ReturnCode_t retcode = dds_waitset->detach_condition(read_condition); + DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(read_condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from waitset"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); return RMW_RET_ERROR; } } @@ -362,9 +362,9 @@ wait( if (!(j < active_conditions->length())) { clients->clients[i] = 0; } - DDS_ReturnCode_t retcode = dds_waitset->detach_condition(read_condition); + DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(read_condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from waitset"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); return RMW_RET_ERROR; } } diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp index d1cde4ea..7d3497dc 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp @@ -20,11 +20,11 @@ #include "rmw_connext_shared_cpp/visibility_control.h" RMW_CONNEXT_SHARED_CPP_PUBLIC -rmw_waitset_t * -create_waitset(const char * implementation_identifier, size_t max_conditions); +rmw_wait_set_t * +create_wait_set(const char * implementation_identifier, size_t max_conditions); RMW_CONNEXT_SHARED_CPP_PUBLIC rmw_ret_t -destroy_waitset(const char * implementation_identifier, rmw_waitset_t * waitset); +destroy_wait_set(const char * implementation_identifier, rmw_wait_set_t * wait_set); #endif // RMW_CONNEXT_SHARED_CPP__WAITSET_HPP_ diff --git a/rmw_connext_shared_cpp/src/condition_error.cpp b/rmw_connext_shared_cpp/src/condition_error.cpp index 98d22fa4..20611d96 100644 --- a/rmw_connext_shared_cpp/src/condition_error.cpp +++ b/rmw_connext_shared_cpp/src/condition_error.cpp @@ -24,11 +24,11 @@ check_attach_condition_error(DDS::ReturnCode_t retcode) return RMW_RET_OK; } if (retcode == DDS_RETCODE_OUT_OF_RESOURCES) { - RMW_SET_ERROR_MSG("failed to attach condition to waitset: out of resources"); + RMW_SET_ERROR_MSG("failed to attach condition to wait_set: out of resources"); } else if (retcode == DDS_RETCODE_BAD_PARAMETER) { - RMW_SET_ERROR_MSG("failed to attach condition to waitset: condition pointer was invalid"); + RMW_SET_ERROR_MSG("failed to attach condition to wait_set: condition pointer was invalid"); } else { - RMW_SET_ERROR_MSG("failed to attach condition to waitset"); + RMW_SET_ERROR_MSG("failed to attach condition to wait_set"); } return RMW_RET_ERROR; } diff --git a/rmw_connext_shared_cpp/src/wait_set.cpp b/rmw_connext_shared_cpp/src/wait_set.cpp index d07f70d1..2fe38189 100644 --- a/rmw_connext_shared_cpp/src/wait_set.cpp +++ b/rmw_connext_shared_cpp/src/wait_set.cpp @@ -14,47 +14,47 @@ #include "rmw_connext_shared_cpp/shared_functions.hpp" -rmw_waitset_t * -create_waitset(const char * implementation_identifier, size_t max_conditions) +rmw_wait_set_t * +create_wait_set(const char * implementation_identifier, size_t max_conditions) { - rmw_waitset_t * waitset = rmw_waitset_allocate(); + rmw_wait_set_t * wait_set = rmw_wait_set_allocate(); - ConnextWaitSetInfo * waitset_info = nullptr; + ConnextWaitSetInfo * wait_set_info = nullptr; // From here onward, error results in unrolling in the goto fail block. - if (!waitset) { - RMW_SET_ERROR_MSG("failed to allocate waitset"); + if (!wait_set) { + RMW_SET_ERROR_MSG("failed to allocate wait_set"); goto fail; } - waitset->implementation_identifier = implementation_identifier; - waitset->data = rmw_allocate(sizeof(ConnextWaitSetInfo)); - waitset_info = static_cast(waitset->data); + wait_set->implementation_identifier = implementation_identifier; + wait_set->data = rmw_allocate(sizeof(ConnextWaitSetInfo)); + wait_set_info = static_cast(wait_set->data); - if (!waitset_info) { - RMW_SET_ERROR_MSG("failed to allocate waitset"); + if (!wait_set_info) { + RMW_SET_ERROR_MSG("failed to allocate wait_set"); goto fail; } - waitset_info->waitset = static_cast(rmw_allocate(sizeof(DDSWaitSet))); - if (!waitset_info->waitset) { - RMW_SET_ERROR_MSG("failed to allocate waitset"); + wait_set_info->wait_set = static_cast(rmw_allocate(sizeof(DDSWaitSet))); + if (!wait_set_info->wait_set) { + RMW_SET_ERROR_MSG("failed to allocate wait_set"); goto fail; } RMW_TRY_PLACEMENT_NEW( - waitset_info->waitset, waitset_info->waitset, goto fail, DDSWaitSet, ) + wait_set_info->wait_set, wait_set_info->wait_set, goto fail, DDSWaitSet, ) // Now allocate storage for the ConditionSeq objects - waitset_info->active_conditions = + wait_set_info->active_conditions = static_cast(rmw_allocate(sizeof(DDSConditionSeq))); - if (!waitset_info->active_conditions) { + if (!wait_set_info->active_conditions) { RMW_SET_ERROR_MSG("failed to allocate active_conditions sequence"); goto fail; } - waitset_info->attached_conditions = + wait_set_info->attached_conditions = static_cast(rmw_allocate(sizeof(DDSConditionSeq))); - if (!waitset_info->attached_conditions) { + if (!wait_set_info->attached_conditions) { RMW_SET_ERROR_MSG("failed to allocate attached_conditions sequence"); goto fail; } @@ -62,91 +62,91 @@ create_waitset(const char * implementation_identifier, size_t max_conditions) // If max_conditions is greater than zero, re-allocate both ConditionSeqs to max_conditions if (max_conditions > 0) { RMW_TRY_PLACEMENT_NEW( - waitset_info->active_conditions, waitset_info->active_conditions, goto fail, + wait_set_info->active_conditions, wait_set_info->active_conditions, goto fail, DDSConditionSeq, static_cast(max_conditions)) RMW_TRY_PLACEMENT_NEW( - waitset_info->attached_conditions, waitset_info->attached_conditions, goto fail, + wait_set_info->attached_conditions, wait_set_info->attached_conditions, goto fail, DDSConditionSeq, static_cast(max_conditions)) } else { // Else, don't preallocate: the vectors will size dynamically when rmw_wait is called. // Default-construct the ConditionSeqs. RMW_TRY_PLACEMENT_NEW( - waitset_info->active_conditions, waitset_info->active_conditions, + wait_set_info->active_conditions, wait_set_info->active_conditions, goto fail, DDSConditionSeq, ) RMW_TRY_PLACEMENT_NEW( - waitset_info->attached_conditions, waitset_info->attached_conditions, goto fail, + wait_set_info->attached_conditions, wait_set_info->attached_conditions, goto fail, DDSConditionSeq, ) } - return waitset; + return wait_set; fail: - if (waitset_info) { - if (waitset_info->active_conditions) { + if (wait_set_info) { + if (wait_set_info->active_conditions) { // How to know which constructor threw? RMW_TRY_DESTRUCTOR_FROM_WITHIN_FAILURE( - waitset_info->active_conditions->~DDSConditionSeq(), DDSConditionSeq) - rmw_free(waitset_info->active_conditions); + wait_set_info->active_conditions->~DDSConditionSeq(), DDSConditionSeq) + rmw_free(wait_set_info->active_conditions); } - if (waitset_info->attached_conditions) { + if (wait_set_info->attached_conditions) { RMW_TRY_DESTRUCTOR_FROM_WITHIN_FAILURE( - waitset_info->attached_conditions->~DDSConditionSeq(), DDSConditionSeq) - rmw_free(waitset_info->attached_conditions); + wait_set_info->attached_conditions->~DDSConditionSeq(), DDSConditionSeq) + rmw_free(wait_set_info->attached_conditions); } - if (waitset_info->waitset) { - RMW_TRY_DESTRUCTOR_FROM_WITHIN_FAILURE(waitset_info->waitset->~DDSWaitSet(), DDSWaitSet) - rmw_free(waitset_info->waitset); + if (wait_set_info->wait_set) { + RMW_TRY_DESTRUCTOR_FROM_WITHIN_FAILURE(wait_set_info->wait_set->~DDSWaitSet(), DDSWaitSet) + rmw_free(wait_set_info->wait_set); } - waitset_info = nullptr; + wait_set_info = nullptr; } - if (waitset) { - if (waitset->data) { - rmw_free(waitset->data); + if (wait_set) { + if (wait_set->data) { + rmw_free(wait_set->data); } - rmw_waitset_free(waitset); + rmw_wait_set_free(wait_set); } return nullptr; } rmw_ret_t -destroy_waitset(const char * implementation_identifier, rmw_waitset_t * waitset) +destroy_wait_set(const char * implementation_identifier, rmw_wait_set_t * wait_set) { - if (!waitset) { - RMW_SET_ERROR_MSG("waitset handle is null"); + if (!wait_set) { + RMW_SET_ERROR_MSG("wait_set handle is null"); return RMW_RET_ERROR; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( - waitset handle, - waitset->implementation_identifier, implementation_identifier, + wait_set handle, + wait_set->implementation_identifier, implementation_identifier, return RMW_RET_ERROR) auto result = RMW_RET_OK; - ConnextWaitSetInfo * waitset_info = static_cast(waitset->data); + ConnextWaitSetInfo * wait_set_info = static_cast(wait_set->data); // Explicitly call destructor since the "placement new" was used - if (waitset_info->active_conditions) { + if (wait_set_info->active_conditions) { RMW_TRY_DESTRUCTOR( - waitset_info->active_conditions->~DDSConditionSeq(), ConditionSeq, result = RMW_RET_ERROR) - rmw_free(waitset_info->active_conditions); + wait_set_info->active_conditions->~DDSConditionSeq(), ConditionSeq, result = RMW_RET_ERROR) + rmw_free(wait_set_info->active_conditions); } - if (waitset_info->attached_conditions) { + if (wait_set_info->attached_conditions) { RMW_TRY_DESTRUCTOR( - waitset_info->attached_conditions->~DDSConditionSeq(), ConditionSeq, result = RMW_RET_ERROR) - rmw_free(waitset_info->attached_conditions); + wait_set_info->attached_conditions->~DDSConditionSeq(), ConditionSeq, result = RMW_RET_ERROR) + rmw_free(wait_set_info->attached_conditions); } - if (waitset_info->waitset) { - RMW_TRY_DESTRUCTOR(waitset_info->waitset->~DDSWaitSet(), WaitSet, result = RMW_RET_ERROR) - rmw_free(waitset_info->waitset); + if (wait_set_info->wait_set) { + RMW_TRY_DESTRUCTOR(wait_set_info->wait_set->~DDSWaitSet(), WaitSet, result = RMW_RET_ERROR) + rmw_free(wait_set_info->wait_set); } - waitset_info = nullptr; - if (waitset->data) { - rmw_free(waitset->data); + wait_set_info = nullptr; + if (wait_set->data) { + rmw_free(wait_set->data); } - if (waitset) { - rmw_waitset_free(waitset); + if (wait_set) { + rmw_wait_set_free(wait_set); } return result; } From 263732cb85b27f9a9f8c8a037605f512c4958e68 Mon Sep 17 00:00:00 2001 From: Mikael Arguedas Date: Thu, 23 Nov 2017 08:51:34 -0800 Subject: [PATCH 3/5] [cpplint] header guard --- .../include/rmw_connext_shared_cpp/wait_set.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp index 7d3497dc..f3e5142e 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait_set.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RMW_CONNEXT_SHARED_CPP__WAITSET_HPP_ -#define RMW_CONNEXT_SHARED_CPP__WAITSET_HPP_ +#ifndef RMW_CONNEXT_SHARED_CPP__WAIT_SET_HPP_ +#define RMW_CONNEXT_SHARED_CPP__WAIT_SET_HPP_ #include "rmw/types.h" @@ -27,4 +27,4 @@ RMW_CONNEXT_SHARED_CPP_PUBLIC rmw_ret_t destroy_wait_set(const char * implementation_identifier, rmw_wait_set_t * wait_set); -#endif // RMW_CONNEXT_SHARED_CPP__WAITSET_HPP_ +#endif // RMW_CONNEXT_SHARED_CPP__WAIT_SET_HPP_ From d9c8ce6d14ece1563734a23b65693576d747e96c Mon Sep 17 00:00:00 2001 From: Mikael Arguedas Date: Fri, 24 Nov 2017 15:18:48 -0800 Subject: [PATCH 4/5] use wait set in doc --- .../include/rmw_connext_shared_cpp/wait.hpp | 22 +++++++++---------- .../src/condition_error.cpp | 6 ++--- rmw_connext_shared_cpp/src/wait_set.cpp | 8 +++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp index 1a8ede56..6386eb9c 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp @@ -45,7 +45,7 @@ wait( { // Manually detach conditions and clear sequences, to ensure a clean wait set for next time. if (!wait_set) { - RMW_SET_ERROR_MSG("wait_set handle is null"); + RMW_SET_ERROR_MSG("wait set handle is null"); return; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( @@ -60,7 +60,7 @@ wait( DDSWaitSet * dds_wait_set = static_cast(wait_set_info->wait_set); if (!dds_wait_set) { - RMW_SET_ERROR_MSG("DDS wait_set handle is null"); + RMW_SET_ERROR_MSG("DDS wait set handle is null"); return; } @@ -74,14 +74,14 @@ wait( DDS_ReturnCode_t retcode; retcode = dds_wait_set->get_conditions(*attached_conditions); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get attached conditions for wait_set"); + RMW_SET_ERROR_MSG("Failed to get attached conditions for wait set"); return; } for (DDS_Long i = 0; i < attached_conditions->length(); ++i) { retcode = dds_wait_set->detach_condition((*attached_conditions)[i]); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait set"); } } } @@ -93,7 +93,7 @@ wait( atexit.implementation_identifier = implementation_identifier; if (!wait_set) { - RMW_SET_ERROR_MSG("wait_set handle is null"); + RMW_SET_ERROR_MSG("wait set handle is null"); return RMW_RET_ERROR; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( @@ -109,7 +109,7 @@ wait( DDSWaitSet * dds_wait_set = static_cast(wait_set_info->wait_set); if (!dds_wait_set) { - RMW_SET_ERROR_MSG("DDS wait_set handle is null"); + RMW_SET_ERROR_MSG("DDS wait set handle is null"); return RMW_RET_ERROR; } @@ -225,7 +225,7 @@ wait( DDS_ReturnCode_t status = dds_wait_set->wait(*active_conditions, timeout); if (status != DDS_RETCODE_OK && status != DDS_RETCODE_TIMEOUT) { - RMW_SET_ERROR_MSG("failed to wait on wait_set"); + RMW_SET_ERROR_MSG("failed to wait on wait set"); return RMW_RET_ERROR; } @@ -258,7 +258,7 @@ wait( } DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(read_condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait set"); return RMW_RET_ERROR; } } @@ -294,7 +294,7 @@ wait( } DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait set"); return RMW_RET_ERROR; } } @@ -329,7 +329,7 @@ wait( } DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(read_condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait set"); return RMW_RET_ERROR; } } @@ -364,7 +364,7 @@ wait( } DDS_ReturnCode_t retcode = dds_wait_set->detach_condition(read_condition); if (retcode != DDS_RETCODE_OK) { - RMW_SET_ERROR_MSG("Failed to get detach condition from wait_set"); + RMW_SET_ERROR_MSG("Failed to get detach condition from wait set"); return RMW_RET_ERROR; } } diff --git a/rmw_connext_shared_cpp/src/condition_error.cpp b/rmw_connext_shared_cpp/src/condition_error.cpp index 20611d96..126ea5b9 100644 --- a/rmw_connext_shared_cpp/src/condition_error.cpp +++ b/rmw_connext_shared_cpp/src/condition_error.cpp @@ -24,11 +24,11 @@ check_attach_condition_error(DDS::ReturnCode_t retcode) return RMW_RET_OK; } if (retcode == DDS_RETCODE_OUT_OF_RESOURCES) { - RMW_SET_ERROR_MSG("failed to attach condition to wait_set: out of resources"); + RMW_SET_ERROR_MSG("failed to attach condition to wait set: out of resources"); } else if (retcode == DDS_RETCODE_BAD_PARAMETER) { - RMW_SET_ERROR_MSG("failed to attach condition to wait_set: condition pointer was invalid"); + RMW_SET_ERROR_MSG("failed to attach condition to wait set: condition pointer was invalid"); } else { - RMW_SET_ERROR_MSG("failed to attach condition to wait_set"); + RMW_SET_ERROR_MSG("failed to attach condition to wait set"); } return RMW_RET_ERROR; } diff --git a/rmw_connext_shared_cpp/src/wait_set.cpp b/rmw_connext_shared_cpp/src/wait_set.cpp index 2fe38189..afff3e4c 100644 --- a/rmw_connext_shared_cpp/src/wait_set.cpp +++ b/rmw_connext_shared_cpp/src/wait_set.cpp @@ -23,7 +23,7 @@ create_wait_set(const char * implementation_identifier, size_t max_conditions) // From here onward, error results in unrolling in the goto fail block. if (!wait_set) { - RMW_SET_ERROR_MSG("failed to allocate wait_set"); + RMW_SET_ERROR_MSG("failed to allocate wait set"); goto fail; } wait_set->implementation_identifier = implementation_identifier; @@ -31,13 +31,13 @@ create_wait_set(const char * implementation_identifier, size_t max_conditions) wait_set_info = static_cast(wait_set->data); if (!wait_set_info) { - RMW_SET_ERROR_MSG("failed to allocate wait_set"); + RMW_SET_ERROR_MSG("failed to allocate wait set"); goto fail; } wait_set_info->wait_set = static_cast(rmw_allocate(sizeof(DDSWaitSet))); if (!wait_set_info->wait_set) { - RMW_SET_ERROR_MSG("failed to allocate wait_set"); + RMW_SET_ERROR_MSG("failed to allocate wait set"); goto fail; } @@ -115,7 +115,7 @@ rmw_ret_t destroy_wait_set(const char * implementation_identifier, rmw_wait_set_t * wait_set) { if (!wait_set) { - RMW_SET_ERROR_MSG("wait_set handle is null"); + RMW_SET_ERROR_MSG("wait set handle is null"); return RMW_RET_ERROR; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( From 421ec7c0c78ec943eaeb5a3d180e041065eb8af9 Mon Sep 17 00:00:00 2001 From: dhood Date: Mon, 27 Nov 2017 08:13:48 -0800 Subject: [PATCH 5/5] 'wait_set' -> 'wait set' for error msg strings --- .../include/rmw_connext_shared_cpp/wait.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp index 6386eb9c..d0de9e19 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp @@ -49,7 +49,7 @@ wait( return; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( - wait_set handle, + wait set handle, wait_set->implementation_identifier, implementation_identifier, return ) ConnextWaitSetInfo * wait_set_info = static_cast(wait_set->data); @@ -97,7 +97,7 @@ wait( return RMW_RET_ERROR; } RMW_CHECK_TYPE_IDENTIFIERS_MATCH( - wait_set, + wait set handle, wait_set->implementation_identifier, implementation_identifier, return RMW_RET_ERROR);