12#include <fastdds/dds/topic/IContentFilter.hpp>
13#include <fastdds/dds/topic/IContentFilterFactory.hpp>
14#include <fastdds/dds/topic/TopicDataType.hpp>
16#include "Converter.hpp"
17#include "CustomKeyFilter.hpp"
50 const char* filter_class_name,
51 const char* type_name,
52 const eprosima::fastdds::dds::TopicDataType* data_type,
54 const ParameterSeq& filter_parameters,
55 eprosima::fastdds::dds::IContentFilter*& filter_instance)
override {
57 if (std::string(filter_class_name) !=
"CUSTOM_KEY_FILTER") {
58 return ReturnCode_t::RETCODE_BAD_PARAMETER;
61 if (filter_parameters.length() < 1) {
return ReturnCode_t::RETCODE_BAD_PARAMETER; }
63 if (filter_instance ==
nullptr) {
65 filter_instance =
new CustomKeyFilter(data_type, type_name, filter_parameters);
66 }
catch (
const std::runtime_error& err) {
67 std::cerr << err.what() << std::endl;
68 return ReturnCode_t::RETCODE_BAD_PARAMETER;
72 if (std::string(filter_parameters[0]) !=
"|GUID UNKNOWN|") {
78 instance->
add_type(data_type, type_name, filter_parameters);
80 }
catch (
const std::runtime_error& err) {
81 std::cerr << err.what() << std::endl;
82 return ReturnCode_t::RETCODE_BAD_PARAMETER;
87 return ReturnCode_t::RETCODE_OK;
101 const char* filter_class_name,
102 eprosima::fastdds::dds::IContentFilter* filter_instance)
override {
103 if (std::string(filter_class_name) !=
"CUSTOM_KEY_FILTER" || !filter_instance) {
104 return ReturnCode_t::RETCODE_BAD_PARAMETER;
108 return ReturnCode_t::RETCODE_OK;
A custom content filter factory for dynamic types.
Definition: CustomKeyFilterFactory.hpp:31
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.
Definition: CustomKeyFilterFactory.hpp:49
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.
Definition: CustomKeyFilterFactory.hpp:100
Custom key filter for dynamic data topics.
Definition: CustomKeyFilter.hpp:99
bool has_reader_GUID(const std::string &guid)
Check if the filter has registered reader with given GUID.
Definition: CustomKeyFilter.hpp:124
bool add_type(const eprosima::fastdds::dds::TopicDataType *data_type, const std::string &type_name, const eprosima::fastdds::dds::LoanableTypedCollection< const char * > ¶meters)
Registers a new data type with associated dynamic data type pointer.
Definition: CustomKeyFilter.cpp:13
Definition: auxiliaries.cpp:26