dds-fmu 0.5.1
DDS-FMU communication integration
ddsfmu::detail::CustomKeyFilterFactory Class Reference

A custom content filter factory for dynamic types. More...

#include <CustomKeyFilterFactory.hpp>

+ Inheritance diagram for ddsfmu::detail::CustomKeyFilterFactory:

Public Member Functions

eprosima::fastrtps::types::ReturnCode_t create_content_filter (const char *filter_class_name, const char *type_name, const eprosima::fastdds::dds::TopicDataType *data_type, const char *, const ParameterSeq &filter_parameters, eprosima::fastdds::dds::IContentFilter *&filter_instance) override
 Create a ContentFilteredTopic using this factory. More...
 
eprosima::fastrtps::types::ReturnCode_t delete_content_filter (const char *filter_class_name, eprosima::fastdds::dds::IContentFilter *filter_instance) override
 Delete a ContentFilteredTopic created by this factory. More...
 

Detailed Description

This filter implements the fastdds IContentFilterFactory interface. It is designed specifically as a workaround for https://github.com/eProsima/Fast-DDS/issues/3296. This implementation allows the user to register content filters for key annotated dynamic types, where a sample is dropped unless the key members match the user-provided values.

Member Function Documentation

◆ create_content_filter()

eprosima::fastrtps::types::ReturnCode_t ddsfmu::detail::CustomKeyFilterFactory::create_content_filter ( const char *  filter_class_name,
const char *  type_name,
const eprosima::fastdds::dds::TopicDataType *  data_type,
const char *  ,
const ParameterSeq &  filter_parameters,
eprosima::fastdds::dds::IContentFilter *&  filter_instance 
)
inlineoverride

Updating the filter will not delete the old one. Once a reader is added, it cannot be removed.

Parameters
filter_class_nameCustom filter name
type_nameData type name
data_typeData type pointer, which must be DynamicPubSubType*
filter_parametersParameters required by the filter
filter_instanceInstance of the filter to be evaluated
Returns
eprosima::fastrtps::types::ReturnCode_t::RETCODE_BAD_PARAMETER if the requirements for creating the ContentFilteredTopic using this factory are not met eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK if the ContentFilteredTopic is correctly created

◆ delete_content_filter()

eprosima::fastrtps::types::ReturnCode_t ddsfmu::detail::CustomKeyFilterFactory::delete_content_filter ( const char *  filter_class_name,
eprosima::fastdds::dds::IContentFilter *  filter_instance 
)
inlineoverride
Parameters
filter_class_nameCustom filter name
filter_instanceInstance of the filter to be deleted. After returning, the passed pointer becomes invalid.
Returns
eprosima::fastrtps::types::ReturnCode_t::RETCODE_BAD_PARAMETER if the instance was created with another factory eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK if correctly deleted