My question is how would I specify a ContentFilteredTopic within the USER_PROFILE_QOS.xml file that I am declaring all of my topics, writers, and readers etc. I found in RTI_CoreLibrariesAndUtilities_QoS_Reference_Guide.pdf about how you can add content filters to DataReaders and subscribers and everything, however this does not appear to produce a ContentFilteredTopic anywhere. As such, how would I update the expression parameter's dynamically?
In summary, can I declare/define a CFT in an xml file so that I can use its functions within my program, and also what is the difference if any between using ContentFilteredTopics and specifying a SQL filter in an xml file for a DataReader.
Thank you for your time, and hopefully its something easy that I missed.
As far I know, you cannot create ContentFilteredTopic in an XML file, you have to do it programmatically.
In the User's Manual section '5.4.3 Creating ContentFilteredTopics' is explained how to create and manage it. You have two options when creating the filter: 'STRINGMATCH Filter Expression Notation' and 'SQL Filter Expression Notation'. Both of them are explained in the User's Manual as well. Also, you have an example where the SQL filter use case is explained: http://community.rti.com/examples/content-filtered-topic.
We are working on improving that example to add the other use case. I will add a comment in the thread once it is ready.
Angel.
Hello Brendan,
To set the filter expression parameters dynamically, you would use the following wihtin your code:
parameters
The filter expression parameters. Each element in the parameter sequence corre- sponds to a positional parameter in the filter expression. When using the default DDS_SQLFILTER_NAME, parameter strings are automatically converted to the member type. For example, "4" is converted to the integer 4. This parameter can- not be NULL.
Hi Brendan,
In addition to Bert's comment, note that you can define the parameters in the XML file using the following syntax:
Hi Brendan,
Just to clarify, when using the syntax Fernando is mentioning, you have to use the XML Application Creation functionality to access your ContentFilteredTopic. As far as I know, I don't think it can be done in XML for an application not using XML App Creation.
Thanks,
Juanlu
Bert, Fernando & Brendan
I'm using XML App Creation and have included a filter on my subscriber (as per Fernando's example) in the XML, but how do I specify the parameter values in my C++ application?
If I use create_participant_from_config, how do I then get to the point where I use set_expression_params to specify the actual value?
Thanks,
Julie
Hello Julie,
To specify the parameter values in C++ you will need to lookup the Content Filtered Topic (CFT) created via XML and perform operations on it just like you would do with a CFT created using the regular C++ API. Here's what you need to do.
We have a complete example on how to set expression parameters in our examples section, please take a look at it to understand how to initialize the parameters sequence.
Let me know if this works for you,
Fernando.