RTI Connext Modern C++ API
Version 6.1.2
|
<<reference-type>> Specialization of TopicDescription that allows for content-based subscriptions. More...
#include <dds/topic/ContentFilteredTopic.hpp>
Public Member Functions | |
ContentFilteredTopic (const Topic< T > &the_topic, const std::string &the_name, const dds::topic::Filter &filter) | |
Creates a ContentFilteredTopic to perform content-based subscriptions. More... | |
std::string | filter_expression () const |
Gets the filter expression. More... | |
const dds::core::StringSeq | filter_parameters () const |
Gets the filter expression parameters. More... | |
template<typename FwdIterator > | |
void | filter_parameters (const FwdIterator &begin, const FwdIterator &end) |
Modifies the filter parameters. More... | |
const dds::topic::Topic< T > & | topic () const |
Gets the related topic. More... | |
void | filter (const dds::topic::Filter &the_filter) |
<<extension>> Modifies the filter More... | |
void | append_to_expression_parameter (int32_t index, const std::string &val) |
<<extension>> Appends a term to a parameter More... | |
void | remove_from_expression_parameter (int32_t index, const std::string &val) |
<<extension>> Removes a term from a parameter More... | |
![]() | |
const std::string & | name () const |
Gets the topic name. More... | |
const std::string & | type_name () const |
Gets the type name. More... | |
const dds::domain::DomainParticipant & | participant () const |
Gets the related dds::domain::DomainParticipant. More... | |
![]() | |
void | enable () |
Enables this entity (if it was created disabled) More... | |
const dds::core::status::StatusMask | status_changes () |
Retrieves the list of communication statuses that are triggered. More... | |
const dds::core::InstanceHandle | instance_handle () const |
Get the instance handle that represents this entity. More... | |
void | close () |
Forces the destruction of this entity. More... | |
void | retain () |
Disables the automatic destruction of this entity. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename BinIterator > | |
uint32_t | find_registered_content_filters (const dds::domain::DomainParticipant &participant, BinIterator begin) |
Lookup the names of all of the custom content filters registered to a dds::domain::DomainParticipant. More... | |
![]() | |
template<typename TO , typename FROM > | |
TO | polymorphic_cast (const FROM &from) |
Downcasts an Entity to a subclass. More... | |
<<reference-type>> Specialization of TopicDescription that allows for content-based subscriptions.
It describes a more sophisticated subscription that indicates a dds::sub::DataReader does not want to necessarily see all values of each instance published under the dds::topic::Topic. Rather, it wants to see only the values whose contents satisfy certain criteria. This class therefore can be used to request content-based subscriptions.
The selection of the content is done using the filter_expression
with parameters expression_parameters
.
filter_expression
attribute is a string that specifies the criteria to select the data samples of interest. It is similar to the WHERE part of an SQL clause. expression_parameters
attribute is a sequence of strings that give values to the 'parameters' (i.e. "%n" tokens) in the filter_expression
. The number of supplied parameters must fit with the requested values in the filter_expression
(i.e. the number of n tokens). Queries and Filters Syntax describes the syntax of filter_expression
and expression_parameters
.
T | The topic-type |
|
inline |
Creates a ContentFilteredTopic to perform content-based subscriptions.
The ContentFilteredTopic only relates to samples published under that Topic, filtered according to their content. The filtering is done by means of evaluating a logical expression that involves the values of some of the data-fields in the sample. The logical expression derived from the Filter arguments.
Queries and Filters Syntax describes the syntax of filter_expression and expression_parameters.
By default this function will create a content filter using the built-in SQL filter which implements a superset of the DDS specification. This filter requires that all IDL types have been compiled with DynamicType (also known as TypeCode). If this precondition is not met, this operation return throws dds::core::Error. Do not use rtiddsgen's -notypecode option if you want to use the built-in SQL filter.
To use a different filter, set Filter::name().
the_topic | The Topic to be filtered |
the_name | Name for the new content filtered topic, must not exceed 255 characters. |
filter | The filter to apply, which includes the filter name (by default SQL), the filter expression and the expression parameters. |
|
inline |
Gets the filter expression.
|
inline |
Gets the filter expression parameters.
|
inline |
Modifies the filter parameters.
FwdIterator | A forward iterator whose value type is std::string (or convertible to std::string) |
begin | The beginning of the range |
end | The end of the range (can't contain more than 100 elements) |
|
inline |
Gets the related topic.
void filter | ( | const dds::topic::Filter & | the_filter | ) |
<<extension>> Modifies the filter
the_filter | Contains the new filter expression and parameters. The filter name is immutable: if filter->name() is different it will be ignored. |
Changes the filter_expression
and expression_parameters
associated with the dds::topic::ContentFilteredTopic.
void append_to_expression_parameter | ( | int32_t | index, |
const std::string & | val | ||
) |
<<extension>> Appends a term to a parameter
Appends the input string to the end of the specified parameter string, separated by a comma. If the original parameter string is enclosed in quotation marks (''), the resultant string will also be enclosed in quotation marks.
This method can be used in expression parameters associated with MATCH operators in order to add a pattern to the match pattern list. For example, if the filter expression parameter value is:
'IBM'
Then append_to_expression_parameter(0, "MSFT") would generate the new value:
'IBM,MSFT'
index | <<in>> The index of the parameter string to be modified. The first index is index 0. When using the rti::topic::stringmatch_filter_name filter, index must be 0. |
val | <<in>> The string term to be appended to the parameter string. |
One | of the Standard Exceptions |
void remove_from_expression_parameter | ( | int32_t | index, |
const std::string & | val | ||
) |
<<extension>> Removes a term from a parameter
Removes the input string from the specified parameter string. To be found and removed, the input string must exist as a complete term, bounded by comma separators or the strong boundary. If the original parameter string is enclosed in quotation marks (''), the resultant string will also be enclosed in quotation marks. If the removed term was the last entry in the string, the result will be a string of empty quotation marks.
This method can be used in expression parameters associated with MATCH operators in order to remove a pattern from the match pattern list. For example, if the filter expression paremeter value is:
'IBM,MSFT'
Then remove_from_expression_parameter(0, "IBM") would generate the expression:
'MSFT'
index | <<in>> The index of the parameter string to be modified. The first index is index 0. When using the rti::topic::stringmatch_filter_name filter, index must be 0. |
val | <<in>> The string term to be removed from the parameter string. |
One | of the Standard Exceptions |
|
related |
Lookup the names of all of the custom content filters registered to a dds::domain::DomainParticipant.
The names of the RTI Connext built-in content filters will not be returned as part of the list.
BinIterator | A back-inserting iterator whose value type is std::string (or convertible to) |
participant | The dds::domain::DomainParticipant that the content filters are registered with |
begin | A back-inserting iterator to the position in the destination container to insert the the names of the found content filters into |