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

Interface for implementing custom content filters. More...

#include <dds_filter_content_filter.h>

Data Fields

DDS_ContentFilter_create_instanceFunc create_instance
 Create a new instance of the content filter.
 
DDS_ContentFilter_delete_instanceFunc delete_instance
 Delete an instance of the content filter.
 
DDS_ContentFilter_compileFunc compile
 Compile a filter expression.
 
DDS_ContentFilter_evaluateFunc evaluate
 Evaluate a sample against a compiled filter.
 
DDS_ContentFilter_finalizeFunc finalize
 Finalize a compiled filter instance.
 

Detailed Description

Interface for implementing custom content filters.

This structure defines the interface that must be implemented by a custom content filter class. All function pointers in the struct must be non-NULL and point to valid implementations.

The content filter interface is used by RTI Connext DDS Micro to manage the lifecycle of filter instances and to compile and evaluate filter expressions.

See also
DDS_DomainParticipant_register_contentfilter
DDS_SQL_CONTENT_FILTER_CLASS

All callbacks in this interface are invoked while the middleware holds an internal lock on the DDS_DomainParticipant. This means:

  • Callbacks for a given filter instance are serialized by the middleware. A filter implementation does not need to provide its own synchronization for access to a single filter instance.
  • If the same filter class is registered on multiple DDS_DomainParticipant "DomainParticipants", each receives its own filter instance. Callbacks for different instances (from different participants) may execute concurrently.
  • Callbacks should complete quickly. Long-running operations in any callback will delay data reception and transmission for other entities on the same DDS_DomainParticipant.

Field Documentation

◆ create_instance

DDS_ContentFilter_create_instanceFunc DDS_ContentFilterI::create_instance

Create a new instance of the content filter.

This callback is invoked when a new instance of the content filter class needs to be created. The filter implementation should allocate and initialize any resources needed for the filter instance.

Parameters
resource_limits<<in>> Resource limits that the filter instance should respect. Cannot be NULL.
property<<in>> Filter-specific property provided during registration. May be NULL if no property was provided.
Returns
A pointer to the newly created filter instance on success, or NULL on failure.

◆ delete_instance

DDS_ContentFilter_delete_instanceFunc DDS_ContentFilterI::delete_instance

Delete an instance of the content filter.

This callback is invoked when a filter instance is no longer needed and should be deleted. The filter implementation should free all resources associated with the filter instance.

Parameters
filter_instance<<in>> The filter instance to delete, as previously returned by create_instance. Cannot be NULL.

◆ compile

DDS_ContentFilter_compileFunc DDS_ContentFilterI::compile

Compile a filter expression.

This callback is invoked when a filter expression needs to be compiled for a specific data type. The filter implementation should parse the expression and parameters, validate them against the type code, and create a compiled filter instance that can be used for efficient evaluation.

The filter expression string is passed as-is from the DDS_ContentFilterQosPolicy::filter_expression to this callback. The middleware does not interpret or validate the expression, so custom filter implementations can define any expression syntax.

Parameters
filter_instance<<in>> The filter instance. Cannot be NULL.
compiled_expression_out<<out>> Location to store the newly compiled filter expression. Cannot be NULL.
expression<<in>> The filter expression string to compile. Cannot be NULL.
parameters<<in>> The filter expression parameters. Cannot be NULL.
type_code<<in>> The type code of the data that the filter will be applied to. May be NULL if XTypes is not enabled.
type_class_name<<in>> The registered type name of the data type that the filter will be applied to. Cannot be NULL.
Returns
DDS_BOOLEAN_TRUE if the expression was successfully compiled, DDS_BOOLEAN_FALSE on failure.

◆ evaluate

DDS_ContentFilter_evaluateFunc DDS_ContentFilterI::evaluate

Evaluate a sample against a compiled filter.

This callback is invoked to determine whether a sample passes a compiled filter. The filter implementation should evaluate the sample against the compiled filter expression.

Parameters
filter_instance<<in>> The filter instance. Cannot be NULL.
compiled_expression<<in>> The compiled filter expression, as previously returned by compile. Cannot be NULL.
sample<<in>> The sample to evaluate. Cannot be NULL.
result_out<<out>> Location to store the evaluation result. DDS_BOOLEAN_TRUE if the sample passes the filter, DDS_BOOLEAN_FALSE if it does not. Cannot be NULL.
Returns
DDS_BOOLEAN_TRUE if the evaluation was successful, DDS_BOOLEAN_FALSE on failure.

On the reader side, if this callback returns DDS_BOOLEAN_FALSE, the sample is dropped (treated as not passing the filter). On the writer side, the sample is sent to the reader without a filter result indication; the reader will then apply its own reader-side filter to the sample.

Implementations should return DDS_BOOLEAN_FALSE only for unexpected errors. For samples that do not match the filter expression, set *result_out to DDS_BOOLEAN_FALSE and return DDS_BOOLEAN_TRUE.

◆ finalize

DDS_ContentFilter_finalizeFunc DDS_ContentFilterI::finalize

Finalize a compiled filter instance.

This callback is invoked when a compiled filter instance is no longer needed. The filter implementation should free all resources associated with the compiled filter instance.

Parameters
filter_instance<<in>> The filter instance. Cannot be NULL.
compiled_expression<<in>> The compiled filter expression to finalize, as previously returned by compile. Cannot be NULL.