DDSContentFilter Class Reference
[Topics]

<<interface>> Interface to be used by a custom filter of a DDSContentFilteredTopic More...

List of all members.

Public Member Functions

virtual DDS_ReturnCode_t compile (void **new_compile_data, const char *expression, const DDS_StringSeq &parameters, const DDS_TypeCode *type_code, const char *type_class_name, void *old_compile_data)=0
 Compile an instance of the content filter according to the filter expression and parameters of the given data type.
virtual DDS_Boolean evaluate (void *compile_data, const void *sample)=0
 Evaluate whether the sample is passing the filter or not according to the sample content.
virtual void finalize (void *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

<<interface>> Interface to be used by a custom filter of a DDSContentFilteredTopic

Entity:
DDSContentFilteredTopic
This is the interface that can be implemented by an application-provided class and then registered with the DDSDomainParticipant such that samples can be filtered for a DDSContentFilteredTopic with the given filter name.

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

See also:
DDSContentFilteredTopic

DDSDomainParticipant::register_contentfilter


Member Function Documentation

virtual DDS_ReturnCode_t DDSContentFilter::compile ( void **  new_compile_data,
const char *  expression,
const DDS_StringSeq parameters,
const DDS_TypeCode type_code,
const char *  type_class_name,
void *  old_compile_data 
) [pure virtual]

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 DDSContentFilteredTopic with the matching filter name is created, or when a DDSDataReader 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 DDSContentFilter::evaluate and DDSContentFilter::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 Data Distribution Service 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 DDSContentFilteredTopic was created with. The string sequence is equal (but not identical) to the string sequence passed to DDSDomainParticipant::create_contentfilteredtopic. Note that the sequence passed to the compile function is owned by RTI Data Distribution Service and must not be referenced outside the compile function.
type_code <<in>> A pointer to the type code for the related DDSTopic of the DDSContentFilteredTopic. 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_name <<in>> Fully qualified class name of the related DDSTopic.
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 DDSContentFilteredTopic, 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 resources previously allocated for this
Returns:
One of the Standard Return Codes

virtual DDS_Boolean DDSContentFilter::evaluate ( void *  compile_data,
const void *  sample 
) [pure virtual]

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 DDSDataReader associated with the filter is received, or when a sample for a discovered DDSDataReader 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 DDSContentFilter::compile function for this instance of the content filter. Can be NULL.
sample <<in>> Pointer to a deserialized sample to be filtered
Returns:
The function must return 0 if the sample should be filtered out, non zero otherwise

virtual void DDSContentFilter::finalize ( void *  compile_data  )  [pure virtual]

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 DDSContentFilteredTopic with the matching filter name is deleted, or when a DDSDataReader with a matching filter name is removed due to discovery.

This method is also called on all instances of the discovered DDSDataReader with a matching filter name if the filter is unregistered with DDSDomainParticipant::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 DDSContentFilter::compile function for this instance of the content filter. Can be NULL.


RTI Data Distribution Service C++ API Version 4.5e Copyright © 23 Oct 2011 Real-Time Innovations, Inc