Skip to content

Commit

Permalink
rename interfaces and structure
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Lihui <[email protected]>
  • Loading branch information
Chen Lihui committed Oct 26, 2021
1 parent 8d356f4 commit dc7b0df
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 120 deletions.
2 changes: 1 addition & 1 deletion rmw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(rmw_sources
"src/qos_string_conversions.c"
"src/sanity_checks.c"
"src/security_options.c"
"src/subscription_content_filtered_topic_options.c"
"src/subscription_content_filter_options.c"
"src/subscription_options.c"
"src/time.c"
"src/topic_endpoint_info_array.c"
Expand Down
22 changes: 11 additions & 11 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ rmw_subscription_get_actual_qos(
const rmw_subscription_t * subscription,
rmw_qos_profile_t * qos);

/// Set the content filtered topic options for the subscription.
/// Set the content filter options for the subscription.
/**
* This function will set a filter expression and an array of expression parameters
* for the given subscription.
Expand All @@ -1130,8 +1130,8 @@ rmw_subscription_get_actual_qos(
* Lock-Free | Maybe [1]
* <i>[1] implementation defined, check the implementation documentation</i>
*
* \param[in] subscription The subscription to set content filtered topic options.
* \param[in] options The content filtered topic options.
* \param[in] subscription The subscription to set content filter options.
* \param[in] options The content filter options.
* Use `options.filter_expression` with an empty("") string to
* reset/clean content filtered topic for the subscription.
* \return `RMW_RET_OK` if successful, or
Expand All @@ -1144,13 +1144,13 @@ rmw_subscription_get_actual_qos(
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_subscription_set_cft_expression_parameters(
rmw_subscription_set_content_filter(
rmw_subscription_t * subscription,
const rmw_subscription_content_filtered_topic_options_t * options);
const rmw_subscription_content_filter_options_t * options);

/// Retrieve the content filtered topic options of the subscription.
/// Retrieve the content filter options of the subscription.
/**
* This function will return a content filtered topic options by the given subscription.
* This function will return a content filter options by the given subscription.
*
* <hr>
* Attribute | Adherence
Expand All @@ -1162,8 +1162,8 @@ rmw_subscription_set_cft_expression_parameters(
* <i>[1] implementation defined, check the implementation documentation</i>
*
* \param[in] subscription The subscription object to inspect.
* \param[in] allocator Allocator to be used when populating the content filtered topic options.
* \param[out] options The content filtered topic options.
* \param[in] allocator Allocator to be used when populating the content filter options.
* \param[out] options The content filter options.
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INVALID_ARGUMENT` if an argument is null, or
* \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if the `subscription` implementation
Expand All @@ -1175,10 +1175,10 @@ rmw_subscription_set_cft_expression_parameters(
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_subscription_get_cft_expression_parameters(
rmw_subscription_get_content_filter(
const rmw_subscription_t * subscription,
rcutils_allocator_t * allocator,
rmw_subscription_content_filtered_topic_options_t * options);
rmw_subscription_content_filter_options_t * options);

/// Take an incoming ROS message.
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW__SUBSCRIPTION_CONTENT_FILTERED_TOPIC_OPTIONS_H_
#define RMW__SUBSCRIPTION_CONTENT_FILTERED_TOPIC_OPTIONS_H_
#ifndef RMW__SUBSCRIPTION_CONTENT_FILTER_OPTIONS_H_
#define RMW__SUBSCRIPTION_CONTENT_FILTER_OPTIONS_H_

#ifdef __cplusplus
extern "C"
Expand All @@ -27,7 +27,7 @@ extern "C"
#include "rmw/ret_types.h"
#include "rmw/visibility_control.h"

typedef struct RMW_PUBLIC_TYPE rmw_subscription_content_filtered_topic_options_s
typedef struct RMW_PUBLIC_TYPE rmw_subscription_content_filter_options_s
{
/**
* specify the criteria to select the data samples of interest.
Expand All @@ -44,88 +44,88 @@ typedef struct RMW_PUBLIC_TYPE rmw_subscription_content_filtered_topic_options_s
* (i.e., it cannot be greater than 100 on RTI_Connext.)
*/
rcutils_string_array_t * expression_parameters;
} rmw_subscription_content_filtered_topic_options_t;
} rmw_subscription_content_filter_options_t;


/// Get zero initialized content filtered topic options.
/// Get zero initialized content filter options.
RMW_PUBLIC
rmw_subscription_content_filtered_topic_options_t
rmw_get_zero_initialized_content_filtered_topic_options();
rmw_subscription_content_filter_options_t
rmw_get_zero_initialized_content_filter_options();


/// Initialize the given content filtered topic options.
/// Initialize the given content filter options.
/**
* \param[in] filter_expression The filter expression.
* \param[in] expression_parameters_argc The expression parameters argc.
* \param[in] expression_parameter_argv The expression parameters argv.
* \param[in] allocator The allocator used when copying data to the content filtered topic options.
* \param[out] options The content filtered topic options to be set.
* \param[in] allocator The allocator used when copying data to the content filter options.
* \param[out] options The content filter options to be set.
* \returns RMW_RET_INVALID_ARGUMENT, or
* \returns RMW_RET_BAD_ALLOC, or
* \returns RMW_RET_OK
*/
RMW_PUBLIC
rmw_ret_t
rmw_subscription_content_filtered_topic_options_init(
rmw_subscription_content_filter_options_init(
const char * filter_expression,
size_t expression_parameters_argc,
const char * expression_parameter_argv[],
const rcutils_allocator_t * allocator,
rmw_subscription_content_filtered_topic_options_t * options);
rmw_subscription_content_filter_options_t * options);

/// Set the given content filtered topic options.
/// Set the given content filter options.
/**
* \param[in] filter_expression The filter expression.
* \param[in] expression_parameters_argc The expression parameters argc.
* \param[in] expression_parameter_argv The expression parameters argv.
* \param[in] allocator The allocator used when copying data to the content filtered topic options.
* \param[out] options The content filtered topic options to be set.
* \param[in] allocator The allocator used when copying data to the content filter options.
* \param[out] options The content filter options to be set.
* \returns RMW_RET_INVALID_ARGUMENT, or
* \returns RMW_RET_BAD_ALLOC, or
* \returns RMW_RET_OK
*/
RMW_PUBLIC
rmw_ret_t
rmw_subscription_content_filtered_topic_options_set(
rmw_subscription_content_filter_options_set(
const char * filter_expression,
size_t expression_parameters_argc,
const char * expression_parameter_argv[],
const rcutils_allocator_t * allocator,
rmw_subscription_content_filtered_topic_options_t * options);
rmw_subscription_content_filter_options_t * options);

/// Copy the given content filtered topic options.
/// Copy the given content filter options.
/**
* \param[in] src content filtered topic options to be copied.
* \param[in] allocator allocator used when copying data to the new content filtered topic options.
* \param[out] dst content filtered topic options to be set.
* \param[in] src content filter options to be copied.
* \param[in] allocator allocator used when copying data to the new content filter options.
* \param[out] dst content filter options to be set.
* \returns RMW_RET_INVALID_ARGUMENT, or
* \returns RMW_RET_BAD_ALLOC, or
* \returns RMW_RET_OK
*/
RMW_PUBLIC
rmw_ret_t
rmw_subscription_content_filtered_topic_options_copy(
const rmw_subscription_content_filtered_topic_options_t * src,
rmw_subscription_content_filter_options_copy(
const rmw_subscription_content_filter_options_t * src,
const rcutils_allocator_t * allocator,
rmw_subscription_content_filtered_topic_options_t * dst);
rmw_subscription_content_filter_options_t * dst);


/// Finalize the content filtered topic options.
/// Finalize the content filter options.
/**
* \param[in] options content filtered topic options to be finalized.
* \param[in] allocator allocator used to deallocate the content filtered topic options.
* \param[in] options content filter options to be finalized.
* \param[in] allocator allocator used to deallocate the content filter options.
* \returns RMW_RET_INVALID_ARGUMENT, or
* \returns RMW_RET_ERROR, or
* \returns RMW_RET_OK
*/
RMW_PUBLIC
rmw_ret_t
rmw_subscription_content_filtered_topic_options_fini(
rmw_subscription_content_filtered_topic_options_t * options,
rmw_subscription_content_filter_options_fini(
rmw_subscription_content_filter_options_t * options,
const rcutils_allocator_t * allocator);

#ifdef __cplusplus
}
#endif

#endif // RMW__SUBSCRIPTION_CONTENT_FILTERED_TOPIC_OPTIONS_H_
#endif // RMW__SUBSCRIPTION_CONTENT_FILTER_OPTIONS_H_
6 changes: 3 additions & 3 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern "C"
#include "rmw/ret_types.h"
#include "rmw/security_options.h"
#include "rmw/serialized_message.h"
#include "rmw/subscription_content_filtered_topic_options.h"
#include "rmw/subscription_content_filter_options.h"
#include "rmw/time.h"
#include "rmw/visibility_control.h"

Expand Down Expand Up @@ -179,8 +179,8 @@ typedef struct RMW_PUBLIC_TYPE rmw_subscription_options_s
*/
rmw_unique_network_flow_endpoints_requirement_t require_unique_network_flow_endpoints;

/// Used to create a content filtered topic during subscription creation.
rmw_subscription_content_filtered_topic_options_t * content_filtered_topic_options;
/// Used to create a content filter options during subscription creation.
rmw_subscription_content_filter_options_t * content_filter_options;
} rmw_subscription_options_t;

typedef struct RMW_PUBLIC_TYPE rmw_subscription_s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
#include "rcutils/strdup.h"

#include "rmw/error_handling.h"
#include "rmw/subscription_content_filtered_topic_options.h"
#include "rmw/subscription_content_filter_options.h"

rmw_subscription_content_filtered_topic_options_t
rmw_get_zero_initialized_content_filtered_topic_options()
rmw_subscription_content_filter_options_t
rmw_get_zero_initialized_content_filter_options()
{
static rmw_subscription_content_filtered_topic_options_t zero_initialized_options = {
static rmw_subscription_content_filter_options_t zero_initialized_options = {
.filter_expression = NULL,
.expression_parameters = NULL,
};
Expand All @@ -31,12 +31,12 @@ rmw_get_zero_initialized_content_filtered_topic_options()
}

rmw_ret_t
rmw_subscription_content_filtered_topic_options_init(
rmw_subscription_content_filter_options_init(
const char * filter_expression,
size_t expression_parameters_argc,
const char * expression_parameter_argv[],
const rcutils_allocator_t * allocator,
rmw_subscription_content_filtered_topic_options_t * options)
rmw_subscription_content_filter_options_t * options)
{
RMW_CHECK_ARGUMENT_FOR_NULL(filter_expression, RMW_RET_INVALID_ARGUMENT);
if (expression_parameters_argc > 0) {
Expand Down Expand Up @@ -105,19 +105,19 @@ rmw_subscription_content_filtered_topic_options_init(
}

rmw_ret_t
rmw_subscription_content_filtered_topic_options_set(
rmw_subscription_content_filter_options_set(
const char * filter_expression,
size_t expression_parameters_argc,
const char * expression_parameter_argv[],
const rcutils_allocator_t * allocator,
rmw_subscription_content_filtered_topic_options_t * options)
rmw_subscription_content_filter_options_t * options)
{
rmw_ret_t ret = rmw_subscription_content_filtered_topic_options_fini(options, allocator);
rmw_ret_t ret = rmw_subscription_content_filter_options_fini(options, allocator);
if (ret != RMW_RET_OK) {
return ret;
}

return rmw_subscription_content_filtered_topic_options_init(
return rmw_subscription_content_filter_options_init(
filter_expression,
expression_parameters_argc,
expression_parameter_argv,
Expand All @@ -127,10 +127,10 @@ rmw_subscription_content_filtered_topic_options_set(
}

rmw_ret_t
rmw_subscription_content_filtered_topic_options_copy(
const rmw_subscription_content_filtered_topic_options_t * src,
rmw_subscription_content_filter_options_copy(
const rmw_subscription_content_filter_options_t * src,
const rcutils_allocator_t * allocator,
rmw_subscription_content_filtered_topic_options_t * dst)
rmw_subscription_content_filter_options_t * dst)
{
RMW_CHECK_ARGUMENT_FOR_NULL(src, RMW_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ALLOCATOR(allocator, return RMW_RET_INVALID_ARGUMENT);
Expand All @@ -141,12 +141,12 @@ rmw_subscription_content_filtered_topic_options_copy(
expression_parameters_size = src->expression_parameters->size;
expression_parameters_data = src->expression_parameters->data;
}
rmw_ret_t ret = rmw_subscription_content_filtered_topic_options_fini(dst, allocator);
rmw_ret_t ret = rmw_subscription_content_filter_options_fini(dst, allocator);
if (ret != RMW_RET_OK) {
return ret;
}

return rmw_subscription_content_filtered_topic_options_init(
return rmw_subscription_content_filter_options_init(
src->filter_expression,
expression_parameters_size,
(const char **)expression_parameters_data,
Expand All @@ -156,8 +156,8 @@ rmw_subscription_content_filtered_topic_options_copy(
}

rmw_ret_t
rmw_subscription_content_filtered_topic_options_fini(
rmw_subscription_content_filtered_topic_options_t * options,
rmw_subscription_content_filter_options_fini(
rmw_subscription_content_filter_options_t * options,
const rcutils_allocator_t * allocator)
{
RMW_CHECK_ARGUMENT_FOR_NULL(options, RMW_RET_INVALID_ARGUMENT);
Expand Down
2 changes: 1 addition & 1 deletion rmw/src/subscription_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rmw_get_default_subscription_options(void)
.rmw_specific_subscription_payload = NULL,
.ignore_local_publications = false,
.require_unique_network_flow_endpoints = RMW_UNIQUE_NETWORK_FLOW_ENDPOINTS_NOT_REQUIRED,
.content_filtered_topic_options = NULL,
.content_filter_options = NULL,
};
return subscription_options;
}
Expand Down
8 changes: 4 additions & 4 deletions rmw/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ if(TARGET test_network_flow_endpoint_array)
osrf_testing_tools_cpp::memory_tools)
endif()

ament_add_gmock(test_subscription_content_filtered_topic_options
test_subscription_content_filtered_topic_options.cpp
ament_add_gmock(test_subscription_content_filter_options
test_subscription_content_filter_options.cpp
# Append the directory of librmw so it is found at test time.
APPEND_LIBRARY_DIRS "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
if(TARGET test_subscription_content_filtered_topic_options)
target_link_libraries(test_subscription_content_filtered_topic_options ${PROJECT_NAME})
if(TARGET test_subscription_content_filter_options)
target_link_libraries(test_subscription_content_filter_options ${PROJECT_NAME})
endif()
Loading

0 comments on commit dc7b0df

Please sign in to comment.