Dynamic Change of ContentFilter Expression

4 posts / 0 new
Last post
Offline
Last seen: 7 years 10 months ago
Joined: 03/22/2016
Posts: 6
Dynamic Change of ContentFilter Expression

hi all!

is there a possibility to change the filter expression(i.e. the logical statement, not only the expression parameters) of a Content Filtered Topic at run time or simply disable the filtering?

Let's say I have topic which is bound to a type containing three int members. How would switching between receiving filtered samples and receiving all samples be achieved?

Thanks for your help,

Pete

Fernando Garcia's picture
Offline
Last seen: 4 months 6 days ago
Joined: 05/18/2011
Posts: 199

Hi Pete,

You can indeed change the filter expression (and expression parameters) associated with a ContentFilteredTopic using the set_expression() method as explained here. This table enumerates all the supported operations you can perform once you have created a ContentFilteredTopic.

Thanks,
Fernando.

Offline
Last seen: 7 years 10 months ago
Joined: 03/22/2016
Posts: 6

This is exactly what I was looking for. Thank you very much Sir, I appreciate your accurate and fast help!

Offline
Last seen: 4 years 2 months ago
Joined: 09/25/2019
Posts: 1

I have a related problem on the DataWriter side.
I have some topic called "LargeData" which contains data that I only want to send over the network if I have to. The default content filter will never allow any "LargeData" to be sent. However, on the reader side, I can easily compute any update the content filter which will allow specific "LargeData" through. It's more difficult to compute the content filter on the writer side.
My question is if I only update the content filter on the reader side, will this change eventually register with the writer side automatically? Or, do I have to explicitly write code on both the reader and writer side in order to update the content filter?