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

Wait set two words #271

Merged
merged 5 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rmw_connext_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions rmw_connext_cpp/src/rmw_wait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConnextStaticSubscriberInfo, ConnextStaticServiceInfo, ConnextStaticClientInfo>(
rti_connext_identifier, subscriptions, guard_conditions, services, clients, waitset,
rti_connext_identifier, subscriptions, guard_conditions, services, clients, wait_set,
wait_timeout);
}
} // extern "C"
Original file line number Diff line number Diff line change
Expand Up @@ -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"
14 changes: 7 additions & 7 deletions rmw_connext_dynamic_cpp/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<CustomSubscriberInfo, ConnextDynamicServiceInfo, ConnextDynamicClientInfo>
(rti_connext_dynamic_identifier, subscriptions, guard_conditions, services, clients,
waitset,
wait_set,
wait_timeout);
}

Expand Down
2 changes: 1 addition & 1 deletion rmw_connext_shared_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct ConnextPublisherGID

struct ConnextWaitSetInfo
{
DDSWaitSet * waitset;
DDSWaitSet * wait_set;
DDSConditionSeq * active_conditions;
DDSConditionSeq * attached_conditions;
};
Expand Down
82 changes: 41 additions & 41 deletions rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/wait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<ConnextWaitSetInfo *>(waitset->data);
if (!waitset_info) {
ConnextWaitSetInfo * wait_set_info = static_cast<ConnextWaitSetInfo *>(wait_set->data);
if (!wait_set_info) {
RMW_SET_ERROR_MSG("WaitSet implementation struct is null");
return;
}

DDSWaitSet * dds_waitset = static_cast<DDSWaitSet *>(waitset_info->waitset);
if (!dds_waitset) {
RMW_SET_ERROR_MSG("DDS waitset handle is null");
DDSWaitSet * dds_wait_set = static_cast<DDSWaitSet *>(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<DDSConditionSeq *>(waitset_info->attached_conditions);
static_cast<DDSConditionSeq *>(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 handle,
wait_set->implementation_identifier, implementation_identifier,
return RMW_RET_ERROR);

ConnextWaitSetInfo * waitset_info = static_cast<ConnextWaitSetInfo *>(waitset->data);
if (!waitset_info) {
ConnextWaitSetInfo * wait_set_info = static_cast<ConnextWaitSetInfo *>(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<DDSWaitSet *>(waitset_info->waitset);
if (!dds_waitset) {
RMW_SET_ERROR_MSG("DDS waitset handle is null");
DDSWaitSet * dds_wait_set = static_cast<DDSWaitSet *>(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<DDSConditionSeq *>(waitset_info->active_conditions);
static_cast<DDSConditionSeq *>(wait_set_info->active_conditions);
if (!active_conditions) {
RMW_SET_ERROR_MSG("DDS condition sequence handle is null");
return RMW_RET_ERROR;
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -222,10 +222,10 @@ wait(
timeout.nanosec = static_cast<DDS_Long>(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;
}

Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
// 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"

#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_
#endif // RMW_CONNEXT_SHARED_CPP__WAIT_SET_HPP_
6 changes: 3 additions & 3 deletions rmw_connext_shared_cpp/src/condition_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading