Chapter 8 ContentFilteredTopics

Writer-side filtering using the built-in filters (SQL and STRINGMATCH) is supported as long as the filter expression contains members that are present in both the DataReader’s type and the DataWriter’s type. For example, consider the following types:

DataWriter:

struct MyBaseType {
    int32 x;
};

DataReader:

struct MyDerivedType : MyBaseType {
    public int32 y;
};

If the DataReader creates a ContentFilteredTopic with the expression “x>5”, the DataWriter will perform writer-side filtering since it knows how to find x in the outgoing samples.

If the DataReader creates a ContentFilteredTopic with the expression “x>5 and y>5” the DataWriter will not do writer side filtering since it does not know anything about “y”. Also, when the DataWriter tries to compile the filter expression from the DataReader, it will report an error such as the following:

DDS_TypeCode_dereference_member_name:member starting with [y > ] not found
PRESParticipant_createContentFilteredTopicPolicy:content filter compile error 1

To learn how to use optional members in filter expressions, see 3.2.2.6 Using Optional Members in SQL Filter Expressions.