CoreDX DDS Modern C++ API
Public Types | Public Member Functions | List of all members
dds::sub::Query Class Reference

Query objects contain expressions that allow the application to specify a filter on the locally available data. More...

Inheritance diagram for dds::sub::Query:
Inheritance graph
[legend]
Collaboration diagram for dds::sub::Query:
Collaboration graph
[legend]

Public Types

typedef DELEGATE::iterator iterator
 Iterator for the query expression parameters.
 
typedef DELEGATE::const_iterator const_iterator
 Iterator for the query expression parameters.
 

Public Member Functions

 Query (const dds::sub::AnyDataReader &dr, const std::string &expression)
 Create a dds::sub::Query associated with an dds::sub::AnyDataReader. More...
 
template<typename FWIterator >
 Query (const dds::sub::AnyDataReader &dr, const std::string &expression, const FWIterator &params_begin, const FWIterator &params_end)
 Create a dds::sub::Query associated with an dds::sub::AnyDataReader. More...
 
 Query (const dds::sub::AnyDataReader &dr, const std::string &expression, const std::vector< std::string > &params)
 Create a dds::sub::Query associated with an dds::sub::AnyDataReader. More...
 
const std::string & expression () const
 Get expression. More...
 
void expression (const std::string &expr)
 Set new expression. More...
 
const_iterator begin () const
 Provides the begin iterator to the SQL expression parameter list. More...
 
const_iterator end () const
 The end iterator to the SQL expression parameter list. More...
 
iterator begin ()
 Provides the begin iterator to the SQL expression parameter list. More...
 
iterator end ()
 The end iterator to the SQL expression parameter list. More...
 
template<typename FWIterator >
void parameters (const FWIterator &begin, const FWIterator end)
 Sets the query parameters. More...
 
void add_parameter (const std::string &param)
 Adds a parameter to the query. More...
 
uint32_t parameters_length () const
 Gets the number of parameters in the query. More...
 
const AnyDataReaderdata_reader () const
 This operation returns the DataReader associated with the Query. More...
 
- Public Member Functions inherited from dds::core::Reference< DELEGATE >
 Reference (dds::core::null_type &)
 Creates a "null" reference.
 
 Reference (const Reference &ref)
 Creates a reference from another. More...
 
template<typename D >
 Reference (const Reference< D > &ref)
 Enables safe assignment from other reference types. More...
 
 Reference (DELEGATE_T *p)
 The following two constructors create a dds Reference from a vendor specific delegate. More...
 
 ~Reference ()
 Destroys a reference.
 
template<typename R >
bool operator== (const R &ref) const
 Compares two reference objects and returns true if they are equal. More...
 
template<typename R >
bool operator!= (const R &ref) const
 Compares two reference objects and returns true if they are not-equal. More...
 
Referenceoperator= (const null_type)
 Special assignment operators that takes care of assigning null to this reference. More...
 
bool is_nil () const
 Returns true if this reference object is nil, meaning pointing to null.
 
bool operator== (const null_type) const
 Special operator== used to check if this reference object equals the null reference. More...
 
bool operator!= (const null_type nil) const
 Special operator!= used to check if this reference object does not equals the null reference. More...
 
const DELEGATE_REF_T & delegate () const
 Returns a reference to the underlying delegate. More...
 
DELEGATE_REF_T & delegate ()
 Returns a reference to the underlying delegate. More...
 
DELEGATE * operator-> ()
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 
const DELEGATE * operator-> () const
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 

Detailed Description

Query objects contain expressions that allow the application to specify a filter on the locally available data.

A Query is used in a QueryCondition or DataReader::Selector and is associated with one DataReader.

See also
dds::sub::cond::QueryCondition
dds::sub::DataReader::Selector
dds::sub::DataReader::ManipulatorSelector

Constructor & Destructor Documentation

◆ Query() [1/3]

dds::sub::Query::Query ( const dds::sub::AnyDataReader dr,
const std::string &  expression 
)

Create a dds::sub::Query associated with an dds::sub::AnyDataReader.

Parameters
drThe AnyDataReader to associate with the Query.
expressionSQL expression
Exceptions
dds::core::Exception

◆ Query() [2/3]

template<typename FWIterator >
dds::sub::Query::Query ( const dds::sub::AnyDataReader dr,
const std::string &  expression,
const FWIterator &  params_begin,
const FWIterator &  params_end 
)

Create a dds::sub::Query associated with an dds::sub::AnyDataReader.

Parameters
drThe AnyDataReader to associate with the Query.
expressionSQL expression
params_beginIterator pointing to the beginning of the parameters to set
params_endIterator pointing to the end of the parameters to set
Exceptions
dds::core::Exception

◆ Query() [3/3]

dds::sub::Query::Query ( const dds::sub::AnyDataReader dr,
const std::string &  expression,
const std::vector< std::string > &  params 
)

Create a dds::sub::Query associated with an dds::sub::AnyDataReader.

Parameters
drThe AnyDataReader to associate with the Query.
expressionSQL expression
paramsVector containing SQL expression parameters
Exceptions
dds::core::Exception

Member Function Documentation

◆ add_parameter()

void dds::sub::Query::add_parameter ( const std::string &  param)

Adds a parameter to the query.

Parameters
paramThe parameter to add
Exceptions
dds::core::Exception

◆ begin() [1/2]

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

Provides the begin iterator to the SQL expression parameter list.

Returns
dds::sub::Query::const_iterator The begin iterator
Exceptions
dds::core::Exception

◆ begin() [2/2]

iterator dds::sub::Query::begin ( )

Provides the begin iterator to the SQL expression parameter list.

Returns
dds::sub::Query::iterator The begin iterator
Exceptions
dds::core::Exception

◆ data_reader()

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

This operation returns the DataReader associated with the Query.

Note that there is exactly one DataReader associated with each Query.

Returns
dds::sub::AnyDataReader The associated DataReader
Exceptions
dds::core::Exception

◆ end() [1/2]

const_iterator dds::sub::Query::end ( ) const

The end iterator to the SQL expression parameter list.

Returns
dds::sub::Query::const_iterator The end iterator
Exceptions
dds::core::Exception

◆ end() [2/2]

iterator dds::sub::Query::end ( )

The end iterator to the SQL expression parameter list.

Returns
dds::sub::TQuery::iterator The end iterator
Exceptions
dds::core::Exception

◆ expression() [1/2]

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

Get expression.

Returns
std::string The SQL expression.
Exceptions
dds::core::Exception

◆ expression() [2/2]

void dds::sub::Query::expression ( const std::string &  expr)

Set new expression.

Parameters
exprthe SQL expression
Exceptions
dds::core::Exception

◆ parameters()

template<typename FWIterator >
void dds::sub::Query::parameters ( const FWIterator &  begin,
const FWIterator  end 
)

Sets the query parameters.

Parameters
beginIterator pointing to the beginning of the parameters to set
endIterator pointing to the end of the parameters to set
Exceptions
dds::core::Exception

◆ parameters_length()

uint32_t dds::sub::Query::parameters_length ( ) const

Gets the number of parameters in the query.

Returns
uint32_t The number of parameters in the query
Exceptions
dds::core::Exception

© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.