From 9f51f6f9dc864901328bf6e2f37cdffa972a65ef Mon Sep 17 00:00:00 2001 From: Firas Sahli Date: Wed, 5 Dec 2018 16:00:20 +0100 Subject: [PATCH] Rename get and set filter functions for topic Signed-off-by: Firas Sahli --- src/core/ddsc/include/ddsc/dds.h | 13 +++++++++++++ src/core/ddsc/src/dds_topic.c | 21 +++++++++++++++++++-- src/core/ddsc/tests/entity_status.c | 14 +++++++------- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/core/ddsc/include/ddsc/dds.h b/src/core/ddsc/include/ddsc/dds.h index 38efb10..9a183cb 100644 --- a/src/core/ddsc/include/ddsc/dds.h +++ b/src/core/ddsc/include/ddsc/dds.h @@ -1061,6 +1061,13 @@ typedef bool (*dds_topic_filter_fn) (const void * sample); */ _Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) DDS_EXPORT void +dds_set_topic_filter( + dds_entity_t topic, + dds_topic_filter_fn filter); + +_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) +DDS_EXPORT void +DDS_DEPRECATED_EXPORT dds_topic_set_filter( dds_entity_t topic, dds_topic_filter_fn filter); @@ -1074,6 +1081,12 @@ dds_topic_set_filter( */ _Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) DDS_EXPORT dds_topic_filter_fn +dds_get_topic_filter( + dds_entity_t topic); + +_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) +DDS_EXPORT dds_topic_filter_fn +DDS_DEPRECATED_EXPORT dds_topic_get_filter( dds_entity_t topic); diff --git a/src/core/ddsc/src/dds_topic.c b/src/core/ddsc/src/dds_topic.c index 5e88b9d..15d66f5 100644 --- a/src/core/ddsc/src/dds_topic.c +++ b/src/core/ddsc/src/dds_topic.c @@ -528,7 +528,7 @@ dds_topic_mod_filter( _Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) void -dds_topic_set_filter( +dds_set_topic_filter( dds_entity_t topic, dds_topic_filter_fn filter) { @@ -537,9 +537,18 @@ dds_topic_set_filter( dds_topic_mod_filter (topic, &chaining, &realf, true); } +_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) +void +dds_topic_set_filter( + dds_entity_t topic, + dds_topic_filter_fn filter) +{ + dds_set_topic_filter(topic, filter); +} + _Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) dds_topic_filter_fn -dds_topic_get_filter( +dds_get_topic_filter( dds_entity_t topic) { dds_topic_intern_filter_fn filter; @@ -548,6 +557,14 @@ dds_topic_get_filter( return (filter == dds_topic_chaining_filter) ? (dds_topic_filter_fn)ctx : 0; } +_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC) +dds_topic_filter_fn +dds_topic_get_filter( + dds_entity_t topic) +{ + return dds_get_topic_filter(topic); +} + void dds_topic_set_filter_with_ctx( dds_entity_t topic, diff --git a/src/core/ddsc/tests/entity_status.c b/src/core/ddsc/tests/entity_status.c index ebc42e7..ac41795 100644 --- a/src/core/ddsc/tests/entity_status.c +++ b/src/core/ddsc/tests/entity_status.c @@ -351,20 +351,20 @@ Test(ddsc_entity, inconsistent_topic) dds_inconsistent_topic_status_t topic_status; top = dds_create_topic(participant, &RoundTripModule_DataType_desc, "RoundTrip1", NULL, NULL); - cr_assert_gt(top, 0, "fails %d", dds_err_nr(top)); + CU_ASSERT_FATAL(top > 0); /*Set reader topic and writer topic statuses enabled*/ ret = dds_set_status_mask(top, DDS_INCONSISTENT_TOPIC_STATUS); - cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK); + CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK); ret = dds_set_status_mask(top, DDS_INCONSISTENT_TOPIC_STATUS); - cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK); + CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK); /* Wait for pub inconsistent topic status callback */ ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout); CU_ASSERT_EQUAL_FATAL(ret, (dds_return_t)wsresultsize); ret = dds_get_inconsistent_topic_status (top, &topic_status); - cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK); - cr_assert_gt(topic_status.total_count, 0); + CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK); + CU_ASSERT_FATAL(topic_status.total_count > 0); /*Getting the status should have reset the trigger, waitset should timeout */ status = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, shortTimeout); @@ -374,8 +374,8 @@ Test(ddsc_entity, inconsistent_topic) ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout); CU_ASSERT_EQUAL_FATAL(status, wsresultsize); ret = dds_get_inconsistent_topic_status (top, &topic_status); - cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK); - cr_assert_gt(topic_status.total_count, 0); + CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK); + CU_ASSERT_FATAL(topic_status.total_count > 0); /*Getting the status should have reset the trigger, waitset should timeout */ status = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, shortTimeout);