RTI Connext Modern C++ API  Version 5.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rti::topic::WriterContentFilterHelper< T, CompileData, WriterFilterData > Class Template Referenceabstract

<<extension>> A class to inherit from when implementing a writer-side custom content filter. More...

#include <rti/topic/ContentFilter.hpp>

Inheritance diagram for rti::topic::WriterContentFilterHelper< T, CompileData, WriterFilterData >:
rti::topic::WriterContentFilter< T, CompileData, WriterFilterData > rti::topic::ContentFilter< T, CompileData >

Public Member Functions

virtual void writer_evaluate_helper (WriterFilterData &writer_filter_data, const T &sample, const FilterSampleInfo &meta_data)=0
 A writer-side filtering API to compile an instance of the content filter according to the filter expression and parameters specified by a matching dds::sub::DataReader.
 
- Public Member Functions inherited from rti::topic::WriterContentFilter< T, CompileData, WriterFilterData >
virtual void writer_compile (WriterFilterData &writer_filter_data, ExpressionProperty &prop, const std::string &expression, const dds::core::StringSeq &parameters, const dds::core::optional< dds::core::xtypes::DynamicType > &type_code, const std::string &type_class_name, const rti::core::Cookie &cookie)=0
 A writer-side filtering API to compile an instance of the content filter according to the filter expression and parameters specified by a matching dds::sub::DataReader.
 
virtual rti::core::CookieSeq & writer_evaluate (WriterFilterData &writer_filter_data, const T &sample, const FilterSampleInfo &meta_data)=0
 A writer-side filtering API to compile an instance of the content filter according to the filter expression and parameters specified by a matching dds::sub::DataReader.
 
virtual void writer_finalize (WriterFilterData &writer_filter_data, const rti::core::Cookie &cookie)=0
 A writer-side filtering API to clean up a previously compiled instance of the content filter.
 
virtual WriterFilterData & writer_attach ()=0
 A writer-side filtering API to create some state that can facilitate filtering on the writer side.
 
virtual void writer_detach (WriterFilterData &writer_filter_data)=0
 A writer-side filtering API to clean up a previously created state using writer_attach.
 
virtual void writer_return_loan (WriterFilterData &writer_filter_data, rti::core::CookieSeq &cookies)=0
 A writer-side filtering API to return the loan on the list of DataReaders returned by writer_evaluate.
 
- Public Member Functions inherited from rti::topic::ContentFilter< T, CompileData >
virtual CompileData & compile (const std::string &expression, const dds::core::StringSeq &parameters, const dds::core::optional< dds::core::xtypes::DynamicType > &type_code, const std::string &type_class_name, CompileData *old_compile_data)=0
 Compile an instance of the content filter according to the filter expression and parameters of the given data type.
 
virtual bool evaluate (CompileData &compile_data, const T &sample, const FilterSampleInfo &meta_data)=0
 Evaluate whether the sample is passing the filter or not according to the sample content.
 
virtual void finalize (CompileData &compile_data)=0
 A previously compiled instance of the content filter is no longer in use and resources can now be cleaned up.
 

Protected Member Functions

void add_cookie (rti::core::Cookie &cookie)
 A helper function which will add a rti::core::Cookie to the CookieSeq that is then returned by the writer_evaluate function.
 

Detailed Description

template<typename T, typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
class rti::topic::WriterContentFilterHelper< T, CompileData, WriterFilterData >

<<extension>> A class to inherit from when implementing a writer-side custom content filter.

This class manages for you the rti::core::CookieSeq which maintains a list of Cookies associated with the DataReaders whose filters pass the sample.

This class has a private CookieSeq member that you can add cookies too using the helper method, add_cookie(), and the sequence is automatically cleared for you in the return_loan method, meaning that you do not need to implement that method yourself.

For an example of how to create a custom content filter see Creating Custom Content Filters

Template Parameters
TThe type of the samples that this ContentFilter will filter
CompileDatathe type of the data that the compile function will return. If your compile function will not return data, you can leave this template parameter to the default no_compile_data_t type and return rti::topic::no_compile_data in your compile function
WriterFilterDatathe type of the data that the writer_attach function will return. If your writer_attach function will not return data, you can leave this template parameter to the default no_compile_data_t type and return rti::topic::no_compile_data in your compile function
See Also
rti::topic::CustomFilter
rti::topic::WriterContentFilter
rti::topic::ContentFilter
dds::domain::DomainParticipant::register_contentfilter()

Member Function Documentation

template<typename T , typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
virtual void rti::topic::WriterContentFilterHelper< T, CompileData, WriterFilterData >::writer_evaluate_helper ( WriterFilterData &  writer_filter_data,
const T &  sample,
const FilterSampleInfo meta_data 
)
pure virtual

A writer-side filtering API to compile an instance of the content filter according to the filter expression and parameters specified by a matching dds::sub::DataReader.

This method is called every time a dds::pub::DataWriter writes a new sample. Its purpose is to evaluate the sample for all the readers for which the dds::pub::DataWriter is performing writer-side filtering and return the list of Cookie_t structures associated with the DataReaders whose filters pass the sample.

It is possible for multiple threads to be calling into this function at the same time

When using the WriterContentFilterHelper helper class, you implement this method instead of writer_evaluate. The writer_evaluate function calls this method and then returns the CookieSeq for you.

Parameters
writer_filter_dataThe state created using the writer_compile method
sampleA deserialized sample to be filtered.
meta_dataMeta data associated with the sample.
template<typename T , typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
void rti::topic::WriterContentFilterHelper< T, CompileData, WriterFilterData >::add_cookie ( rti::core::Cookie cookie)
inlineprotected

A helper function which will add a rti::core::Cookie to the CookieSeq that is then returned by the writer_evaluate function.

Call this method from writer_evaluate_helper whenever you need to add a Cookie for a DataReader whose filter has passed a particular sample.

Parameters
cookieThe cookie to add to the CookieSeq

RTI Connext Modern C++ API Version 5.2.0 Copyright © Sun Jun 21 2015 Real-Time Innovations, Inc