RTI Connext Modern C++ API  Version 5.3.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rti::topic::WriterContentFilter< 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::WriterContentFilter< T, CompileData, WriterFilterData >:
rti::topic::ContentFilter< T, CompileData > rti::topic::WriterContentFilterHelper< T, CompileData, WriterFilterData >

Public Member Functions

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.
 

Detailed Description

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

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

This interface can be implemented by an application-provided class and then registered with the DomainParticipant such that samples can be filtered for dds::topic::ContentFilteredTopic with the filter name that the filter is registered with. This class inherits from rti::topic::ContentFilter, therefore you must implement the compile, evaluate, and finalize funtions from that class in addition to the functions in this class.

Note: the API for using a custom content filter is subject to change in a future release.

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::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::WriterContentFilter< T, CompileData, WriterFilterData >::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 
)
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 when the dds::pub::DataWriter discovers a dds::sub::DataReader with a dds::topic::ContentFilteredTopic or when a dds::pub::DataWriter is notified of a change in a DataReader's filter parameter for the locally registered content filter instance.

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

Parameters
writer_filter_dataThe state created using writer_attach
propAn ExpressionProperty that allows you to indicate to RTI Connext if a filter expression can be optimized.
expressionAn std::string with the filter expression. If you want to manipulate this string, you must first make a copy of it.
parametersA string sequence with the expression parameters the ContentFilteredTopic was created with. The string sequence is equal (but not identical) to the string sequence passed to dds::topic::ContentFilteredTopic(). Note that the sequence passed to the compile function is owned by RTI Connext and must not be referenced outside the compile function.
type_codeThe DynamicType for the related Topic of the ContentFilteredTopic. A type code is a description of a type in terms of which types it contains (such as long, string, etc.) and the corresponding member field names in the data type structure. The type code can be used to write custom content filters that can be used with any type.
type_class_nameFully qualified class name of the related Topic.
cookierti::core::Cookie to uniquely identify the DataReader for which writer_compile was called
template<typename T , typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
virtual rti::core::CookieSeq& rti::topic::WriterContentFilter< T, CompileData, WriterFilterData >::writer_evaluate ( 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

Parameters
writer_filter_dataThe state created using the writer_compile method
sampleA deserialized sample to be filtered.
meta_dataMeta data associated with the sample.
Returns
A rti::core::CookieSeq which identifies the set of DataReaders whose filters pass the sample.
template<typename T , typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
virtual void rti::topic::WriterContentFilter< T, CompileData, WriterFilterData >::writer_finalize ( WriterFilterData &  writer_filter_data,
const rti::core::Cookie cookie 
)
pure virtual

A writer-side filtering API to clean up a previously compiled instance of the content filter.

This method is called to notify the filter implementation that the dds::pub::DataWriter is no longer matching with a dds::sub::DataReader for which it was previously performing writer-side filtering. This will allow the filter to purge any state it was maintaining for the dds::sub::DataReader.

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

Parameters
writer_filter_dataThe state created using writer_attach
cookierti::core::Cookie to uniquely identify the DataReader for which this method was invoked
template<typename T , typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
virtual WriterFilterData& rti::topic::WriterContentFilter< T, CompileData, WriterFilterData >::writer_attach ( )
pure virtual

A writer-side filtering API to create some state that can facilitate filtering on the writer side.

This method is called to create some state required to perform filtering on the writer side using writer-side filtering APIs. This method will be called for every dds::pub::DataWriter; it will be called only the first time the dds::pub::DataWriter matches a dds::sub::DataReader using the specified filter. This function will not be called for any subsequent DataReaders that match the DataWriter and are using the same filter.

Returns
An object of user-specified type to some state created on the DataWriter that will help perform writer-side filtering efficiently. Can be no_compile_data
template<typename T , typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
virtual void rti::topic::WriterContentFilter< T, CompileData, WriterFilterData >::writer_detach ( WriterFilterData &  writer_filter_data)
pure virtual

A writer-side filtering API to clean up a previously created state using writer_attach.

This method is called to delete any state created using the WriterContentFilter::writer_attach function. This method will be called when the dds::pub::DataWriter is deleted.

Parameters
writer_filter_dataThe state created using writer_attach
template<typename T , typename CompileData = no_compile_data_t, typename WriterFilterData = no_compile_data_t>
virtual void rti::topic::WriterContentFilter< T, CompileData, WriterFilterData >::writer_return_loan ( WriterFilterData &  writer_filter_data,
rti::core::CookieSeq &  cookies 
)
pure virtual

A writer-side filtering API to return the loan on the list of DataReaders returned by writer_evaluate.

This method is called to return the loan on CookieSeq returned by WriterContentFilter::writer_return_loan. It is possible for multiple threads to be calling into this function at the same time.

Parameters
writer_filter_dataThe state created using writer_attach
cookiesrti::core::CookieSeq for which writer_return_loan was invoked

RTI Connext Modern C++ API Version 5.3.0 Copyright © Sun Jun 25 2017 Real-Time Innovations, Inc