RTI Connext Modern C++ API  Version 6.0.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dds::sub::Query Class Reference

<<value-type>> Encapsulates a query for a dds::sub::cond::QueryCondition. More...

#include <dds/sub/Query.hpp>

Public Member Functions

template<typename T >
 Query (const dds::sub::DataReader< T > &reader, const std::string &query_expression)
 Creates a query.
 
template<typename T , typename FWIterator >
 Query (const dds::sub::DataReader< T > &reader, const std::string &query_expression, const FWIterator &params_begin, const FWIterator &params_end)
 Creates a query with the expression parameters in an iterator range.
 
template<typename T >
 Query (const dds::sub::DataReader< T > &reader, const std::string &query_expression, const std::vector< std::string > &params)
 Creates a query with the expression parameters in a vector.
 
const std::string & expression () const
 Gets the expression.
 
const_iterator begin () const
 Provides the begin iterator to the parameter list.
 
const_iterator end () const
 Provides the end iterator to the parameter list.
 
iterator begin ()
 Provides the begin iterator to the parameter list.
 
iterator end ()
 Provides the end iterator to the parameter list.
 
template<typename FWIterator >
void parameters (const FWIterator &the_begin, const FWIterator the_end)
 Sets the parameters for the expression.
 
void add_parameter (const std::string &param)
 Appends a parameter.
 
size_t parameters_length () const
 Gets the number of parameters.
 
const std::vector< std::string > & parameters () const
 <<extension>> Gets the parameters
 
std::string name () const
 <<extension>> Gets the filter name
 
dds::sub::Queryname (const std::string &the_name)
 <<extension>> Sets a filter name
 
const AnyDataReaderdata_reader () const
 Gets the related DataReader.
 

Detailed Description

<<value-type>> Encapsulates a query for a dds::sub::cond::QueryCondition.

A query contains the DataReader to query data from, an expression and optionally a list of parameters.

Queries and Filters Syntax defines the syntax of the expression and the parameters.

See Also
Filtering with Query Conditions

Constructor & Destructor Documentation

template<typename T >
dds::sub::Query::Query ( const dds::sub::DataReader< T > &  reader,
const std::string &  query_expression 
)
inline

Creates a query.

Template Parameters
TThe topic-type of the DataReader
Parameters
readerDataReader to query data from
query_expressionExpression describing the query
template<typename T , typename FWIterator >
dds::sub::Query::Query ( const dds::sub::DataReader< T > &  reader,
const std::string &  query_expression,
const FWIterator &  params_begin,
const FWIterator &  params_end 
)
inline

Creates a query with the expression parameters in an iterator range.

Template Parameters
TThe topic-type of the DataReader
FWIteratorA forward iterator whose value type is std::string (or convertible to std::string)
Parameters
readerDataReader to query data from
query_expressionExpression describing the query
params_beginThe beginning of a range of parameters for the query expression
params_endThe end of the range
template<typename T >
dds::sub::Query::Query ( const dds::sub::DataReader< T > &  reader,
const std::string &  query_expression,
const std::vector< std::string > &  params 
)
inline

Creates a query with the expression parameters in a vector.

Template Parameters
TThe topic-type of the DataReader
Parameters
readerDataReader to query data from
query_expressionExpression describing the query
paramsThe parameters for the query expression

Member Function Documentation

const std::string& dds::sub::Query::expression ( ) const
inline

Gets the expression.

const_iterator dds::sub::Query::begin ( ) const
inline

Provides the begin iterator to the parameter list.

Returns
A random-access iterator whose value type is std::string
const_iterator dds::sub::Query::end ( ) const
inline

Provides the end iterator to the parameter list.

Returns
A random-access iterator whose value type is std::string
iterator dds::sub::Query::begin ( )
inline

Provides the begin iterator to the parameter list.

Returns
A random-access iterator whose value type is std::string
iterator dds::sub::Query::end ( )
inline

Provides the end iterator to the parameter list.

Returns
A random-access iterator whose value type is std::string
template<typename FWIterator >
void dds::sub::Query::parameters ( const FWIterator &  the_begin,
const FWIterator  the_end 
)
inline

Sets the parameters for the expression.

Template Parameters
FWIteratorA forward iterator whose value type is std::string (or convertible to std::string)
Parameters
the_beginThe beginning of a range of parameters for the query expression
the_endThe end of the range
void dds::sub::Query::add_parameter ( const std::string &  param)
inline

Appends a parameter.

size_t dds::sub::Query::parameters_length ( ) const
inline

Gets the number of parameters.

const std::vector<std::string>& dds::sub::Query::parameters ( ) const

<<extension>> Gets the parameters

std::string dds::sub::Query::name ( ) const

<<extension>> Gets the filter name

Returns
The name of the filter, or an empty string when using the default SQL filter.
dds::sub::Query& dds::sub::Query::name ( const std::string &  the_name)

<<extension>> Sets a filter name

You can use one of the built-in filters (rti::topic::sql_filter_name and rti::topic::stringmatch_filter_name), or a custom filter, which you need to register using dds::domain::DomainParticipant::register_contentfilter().

[default] Empty string (equivalent to rti::topic::sql_filter_name)

const AnyDataReader& dds::sub::Query::data_reader ( ) const
inline

Gets the related DataReader.


RTI Connext Modern C++ API Version 6.0.0 Copyright © Sun Mar 3 2019 Real-Time Innovations, Inc