RTI Connext Java API  Version 5.3.1
 All Classes Namespaces Functions Variables Groups Pages
ContentFilter Interface Reference

<<interface>> Interface to be used by a custom filter of a com.rti.dds.topic.ContentFilteredTopic More...

Inheritance diagram for ContentFilter:
WriterContentFilter

Public Member Functions

void compile (ObjectHolder new_compile_data, String expression, StringSeq parameters, TypeCode type_code, String type_class_name, Object old_compile_data)
 Compile an instance of the content filter according to the filter expression and parameters of the given data type.
 
boolean evaluate (Object compile_data, Object sample, FilterSampleInfo meta_data)
 Evaluate whether the sample is passing the filter or not according to the sample content.
 
void finalize (Object compile_data)
 A previously compiled instance of the content filter is no longer in use and resources can now be cleaned up.
 

Detailed Description

<<interface>> Interface to be used by a custom filter of a com.rti.dds.topic.ContentFilteredTopic

Entity:
com.rti.dds.topic.ContentFilteredTopic

This interface can be implemented by an application-provided class and then registered with the com.rti.dds.domain.DomainParticipant such that samples can be filtered for a com.rti.dds.topic.ContentFilteredTopic with the given filter name.

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

See Also
com.rti.dds.topic.ContentFilteredTopic
com.rti.dds.domain.DomainParticipant.register_contentfilter

Member Function Documentation

void compile ( ObjectHolder  new_compile_data,
String  expression,
StringSeq  parameters,
TypeCode  type_code,
String  type_class_name,
Object  old_compile_data 
)

Compile an instance of the content filter according to the filter expression and parameters of the given data type.

This method is called when an instance of the locally registered content filter is created or when the expression parameter for the locally registered content filter instance is changed.

An instance of the locally registered content filter is created every time a local com.rti.dds.topic.ContentFilteredTopic with the matching filter name is created, or when a com.rti.dds.subscription.DataReader with a matching filter name is discovered.

It is possible for multiple threads to be calling into this function at the same time. However, this function will never be called on a content filter that has been unregistered.

Parameters
new_compile_data<<out>> User specified opaque pointer of this instance of the content filter. This value is then passed to the com.rti.dds.topic.ContentFilter.evaluate and com.rti.dds.topic.ContentFilter.finalize functions for this instance of the content filter. Can be set to null .
expression<<in>> An ASCIIZ string with the filter expression. The memory used by this string is owned by RTI Connext and must not be freed. If you want to manipulate this string, you must first make a copy of it.
parameters<<in>> A string sequence with the expression parameters the com.rti.dds.topic.ContentFilteredTopic was created with. The string sequence is equal (but not identical) to the string sequence passed to com.rti.dds.domain.DomainParticipant.create_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_code<<in>> A pointer to the type code for the related com.rti.dds.topic.Topic of the com.rti.dds.topic.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. This parameter is always null in Java.
type_class_name<<in>> Fully qualified class name of the related com.rti.dds.topic.Topic.
old_compile_data<<in>> The previous new_compile_data value from a previous call to this instance of a content filter. If the compile function is called more than once for an instance of a com.rti.dds.topic.ContentFilteredTopic, e.g., if the expression parameters are changed, then the new_compile_data value returned by the previous invocation is passed in the old_compile_data parameter (which can be null ). If this is a new instance of the filter, NULL is passed. This parameter is useful for freeing or reusing previously allocated resources.
Exceptions
Oneof the Standard Return Codes
boolean evaluate ( Object  compile_data,
Object  sample,
FilterSampleInfo  meta_data 
)

Evaluate whether the sample is passing the filter or not according to the sample content.

This method is called when a sample for a locally created com.rti.dds.subscription.DataReader associated with the filter is received, or when a sample for a discovered com.rti.dds.subscription.DataReader assocated with the filter needs to be sent.

It is possible for multiple threads to be calling into this function at the same time. However, this function will never be called on a content filter that has been unregistered.

Parameters
compile_data<<in>> The last return value of the com.rti.dds.topic.ContentFilter.compile function for this instance of the content filter. Can be null .
sample<<in>> Pointer to a deserialized sample to be filtered
meta_data<<in>> Pointer to meta data associated with the sample.
Returns
The function must return 0 if the sample should be filtered out, non zero otherwise
void finalize ( Object  compile_data)

A previously compiled instance of the content filter is no longer in use and resources can now be cleaned up.

This method is called when an instance of the locally registered content filter is deleted.

An instance of the locally registered content filter is deleted every time a local com.rti.dds.topic.ContentFilteredTopic with the matching filter name is deleted, or when a com.rti.dds.subscription.DataReader with a matching filter name is removed due to discovery.

This method is also called on all instances of the discovered com.rti.dds.subscription.DataReader with a matching filter name if the filter is unregistered with com.rti.dds.domain.DomainParticipant.unregister_contentfilter

It is possible for multiple threads to be calling into this function at the same time. However, this function will never be called on a content filter that has been unregistered.

Parameters
compile_data<<in>> The last return value of the com.rti.dds.topic.ContentFilter.compile function for this instance of the content filter. Can be null .

RTI Connext Java API Version 5.3.1 Copyright © Mon Feb 19 2018 Real-Time Innovations, Inc