RTI Connext Micro C API Version 4.3.0
Loading...
Searching...
No Matches
DDS_ContentFilterQosPolicy Struct Reference

Filter that allows a DDS_DataReader to specify that it is interested only in (potentially) a subset of the samples on its topic. More...

#include <dds_c_content_filter.h>

Data Fields

DDS_String filter_name
 Name of the content filter.
 
DDS_String filter_class_name
 Name of the filter class.
 
DDS_String filter_expression
 Filter expression.
 
struct DDS_StringSeq expression_parameters
 Filter expression parameters.
 

Detailed Description

Filter that allows a DDS_DataReader to specify that it is interested only in (potentially) a subset of the samples on its topic.

Entity:
DDS_DataReader
Properties:
RxO = NO
Changeable = YES

Usage

The CONTENT_FILTER QoS policy allows a DDS_DataReader to specify that it is interested only in (potentially) a subset of the samples on its topic. Once a content filter is configured, the DDS_DataReader will only receive samples that pass the filter. If content filtering is supported by the DDS_DataWriter, samples that do not pass the filter may not be sent at all, thus reducing the network bandwidth usage.

A DDS_DataReader will fail to be created if it specifies a DDS_ContentFilterQosPolicy and the content filtering feature is not enabled for its parent DDS_DomainParticipant. It will also fail to be created if the DDS_ContentFilterQosPolicy specifies a filter that is not compatible with the resource limits specified in the DDS_FilterQosPolicy for its parent DDS_DomainParticipant.

Generally, RTI Connext DDS Micro does not support changing the QoS of DDS entities after they are enabled. DDS_ContentFilterQosPolicy is an exception to this rule, since it can be updated at runtime using DDS_DataReader_set_qos.

For all strings contained in this QoS, be sure to follow the Conventions for allocating and freeing memory. In particular, if you use DDS_DataReaderQos_finalize to finalize the DDS_DataReaderQos, the function will expect that all strings in the DDS_ContentFilterQosPolicy are owned by the policy and will attempt to free them when finalizing the QoS. Therefore, it is recommended to use DDS_String_dup to duplicate all strings that you want to use in the DDS_ContentFilterQosPolicy.

As an example, a content filter could be configured as follows:

dr_qos.content_filter.filter_name = DDS_String_dup("MyFilter");
dr_qos.content_filter.filter_class_name = DDS_String_dup(DDS_SQL_CONTENT_FILTER_CLASS);
dr_qos.content_filter.filter_expression = DDS_String_dup("a < %0");
if (!DDS_StringSeq_set_maximum(&dr_qos.content_filter.expression_parameters, 1))
{
/* error handling */
}
if (!DDS_StringSeq_set_length(&dr_qos.content_filter.expression_parameters, 1))
{
/* error handling */
}
*DDS_StringSeq_get_reference(&dr_qos.content_filter.expression_parameters, 0) = DDS_String_dup("10");
#define DDS_SQL_CONTENT_FILTER_CLASS
The name of the SQL content filter class.
Definition dds_filter.h:57
char * DDS_String_dup(const char *str)
Clone a string. Creates a new string that duplicates the value of string.
See also
DDS_FilterPluginFactory_register for how to enable the content filtering feature
DDS_FilterQosPolicy for how to configure the content filtering feature
DDS_DomainParticipant_register_contentfilter for how to register custom content filters

Field Documentation

◆ filter_name

DDS_String DDS_ContentFilterQosPolicy::filter_name

Name of the content filter.

A name to uniquely identify this content filter within a DomainParticipant. For interoperability with Connext Professional, this field corresponds to the filter_name attribute when configuring a content filter with XML-based application creation.

◆ filter_class_name

DDS_String DDS_ContentFilterQosPolicy::filter_class_name

Name of the filter class.

The name that identifies the type of filter expression. RTI Connext DDS Micro includes a built-in "DDSSQL" filter class. Custom content filter classes can be registered using DDS_DomainParticipant_register_contentfilter.

◆ filter_expression

DDS_String DDS_ContentFilterQosPolicy::filter_expression

Filter expression.

A logical expression on the contents of the DDS_DataReader's Topic. If the expression evaluates to TRUE, a DDS sample is received; otherwise, it is discarded. The notation for this expression depends on the filter that you are using (specified by the DDS_ContentFilterQosPolicy::filter_class_name).

◆ expression_parameters

struct DDS_StringSeq DDS_ContentFilterQosPolicy::expression_parameters

Filter expression parameters.

A string sequence of filter expression parameters. Each parameter corresponds to a positional argument in the filter expression: element 0 corresponds to positional argument 0, element 1 to positional argument 1, and so forth.