template<typename T>
class dds::topic::ContentFilteredTopic< T >
<<reference-type>> Specialization of TopicDescription that allows for content-based subscriptions.
It describes a more sophisticated subscription that indicates a dds::sub::DataReader does not want to necessarily see all values of each instance published under the dds::topic::Topic. Rather, it wants to see only the values whose contents satisfy certain criteria. This class therefore can be used to request content-based subscriptions.
The selection of the content is done using the filter_expression
with parameters expression_parameters
.
- The
filter_expression
attribute is a string that specifies the criteria to select the data samples of interest. It is similar to the WHERE part of an SQL clause.
- The
expression_parameters
attribute is a sequence of strings that give values to the 'parameters' (i.e. "%n" tokens) in the filter_expression
. The number of supplied parameters must fit with the requested values in the filter_expression
(i.e. the number of n tokens).
Queries and Filters Syntax describes the syntax of filter_expression
and expression_parameters
.
- Template Parameters
-
- See Also
- Filtering with ContentFilteredTopic
Creates a ContentFilteredTopic to perform content-based subscriptions.
The ContentFilteredTopic only relates to samples published under that Topic, filtered according to their content. The filtering is done by means of evaluating a logical expression that involves the values of some of the data-fields in the sample. The logical expression derived from the Filter arguments.
Queries and Filters Syntax describes the syntax of filter_expression and expression_parameters.
- Precondition
- The application is not allowed to create two ContentFilteredTopic objects with the same topic name attached to the same DomainParticipant. If the application attempts this, this function will fail and throw dds::core::Error.
By default this function will create a content filter using the built-in SQL filter which implements a superset of the DDS specification. This filter requires that all IDL types have been compiled with DynamicType (also known as TypeCode). If this precondition is not met, this operation return throws dds::core::Error. Do not use rtiddsgen's -notypecode option if you want to use the built-in SQL filter.
To use a different filter, set Filter::name().
- Parameters
-
topic | The Topic to be filtered |
name | Name for the new content filtered topic, must not exceed 255 characters. |
filter | The filter to apply, which includes the filter name (by default SQL), the filter expression and the expression parameters. |