OpenSplice C# API  v6.x
OpenSplice C# Data Distribution Service Data-Centric Publish-Subscribe API
DDS.IQueryCondition Interface Reference

IQueryCondition objects are specialized IReadCondition objects that allow the application to specify a filter on the locally available data. More...

Inheritance diagram for DDS.IQueryCondition:
Inheritance graph
Collaboration diagram for DDS.IQueryCondition:
Collaboration graph

Public Member Functions

string GetQueryExpression ()
 This operation returns the query expression associated with the IQueryCondition. More...
 
ReturnCode GetQueryParameters (ref string[] queryParameters)
 This operation obtains the query parameters associated with the IQueryCondition More...
 
ReturnCode SetQueryParameters (params string[] queryParameters)
 This operation changes the query parameters associated with the IQueryCondition. More...
 
- Public Member Functions inherited from DDS.IReadCondition
IDataReader GetDataReader ()
 This operation returns the IDataReader associated with the IReadCondition. More...
 
InstanceStateKind GetInstanceStateMask ()
 This operation returns the set of InstanceStates that are taken into account to determine the TriggerValue of the IReadCondition. More...
 
SampleStateKind GetSampleStateMask ()
 This operation returns the set of SampleStates that are taken into account to determine the TriggerValue of the IReadCondition. More...
 
ViewStateKind GetViewStateMask ()
 This operation returns the set of ViewStates that are taken into account to determine the TriggerValue of the IReadCondition. More...
 
- Public Member Functions inherited from DDS.ICondition
bool GetTriggerValue ()
 Each ICondition has a TriggerValue that can be true or false and is set by the DDS depending on the evaluation of the ICondition. More...
 

Detailed Description

IQueryCondition objects are specialized IReadCondition objects that allow the application to specify a filter on the locally available data.

The IDataReader objects accept a set of IQueryCondition objects for the IDataReader and provide support (in conjunction with IWaitSet objects) for an alternative communication style between the Data Distribution Service and the application (i.e., state-based rather than event-based).

Query Function

IQueryCondition objects allow an application to specify the data samples it is interested in (by specifying the desired sample-states, view-states, instance-states and query expression); see the parameter definitions for IDataReader's Read/Take operations. This allows the Data Distribution Service to trigger the condition only when suitable information is available. IQueryCondition objects are to be used in conjunction with an IWaitSet. More than one IQueryCondition may be attached to the same IDataReader.

The query (queryExpression) is similar to an SQL WHERE clause and can be parameterized by arguments that are dynamically changeable with the IQueryCondition.SetQueryParameters operation.

See also
Waitset
/* Simplified example of the creation of an QueryCondition
* Defaults are used and possible errors are ignored. */
/* Prepare Domain. */
DDS.IDomainParticipant participant = factory.CreateParticipant(DDS.DomainId.Default);
/* Create waitset */
IWaitSet waitset = new WaitSet();
/* Add topic data type to the system. */
DDS.ITypeSupport typesupport = new Space.FooTypeSupport();
DDS.ReturnCode retcode = typesupport.RegisterType(participant, "Space.Foo");
DDS.ITopic topic = participant.CreateTopic("SpaceFooTopic", "Space.Foo");
/* Create typed datareader. */
DDS.ISubscriber subscriber = participant.CreateSubscriber();
Space.FooDataReader reader = (Space.FooDataReader)publisher.CreateDataReader(topic);
/* Create querycondition */
string[] params = new string[1];
params[0] = "1";
IQueryCondition condition = reader.CreateQueryCondition("field = %0", params);
/* Attach condition to waitset */
retcode = waitset.AttachCondition(condition);

Definition at line 562 of file DdsDcpsInterfaces.cs.

Member Function Documentation

◆ GetQueryExpression()

string DDS.IQueryCondition.GetQueryExpression ( )

This operation returns the query expression associated with the IQueryCondition.

That is, the expression specified when the IQueryCondition was created. The operation will return null when there was an internal error or when the IQueryCondition was already deleted.

Returns
The query expression associated with the IQueryCondition.

◆ GetQueryParameters()

ReturnCode DDS.IQueryCondition.GetQueryParameters ( ref string []  queryParameters)

This operation obtains the query parameters associated with the IQueryCondition

That is, the parameters specified on the last successful call to IQueryCondition.SetQueryArguments or, if SetQueryArguments was never called, the arguments specified when the IQueryCondition were created.

The queryParameters parameter will contain a sequence of strings with the parameters used in the SQL expression (i.e., the n tokens in the expression). The number of parameters in the result sequence will exactly match the number of n tokens in the query expression associated with the IQueryCondition.

Parameters
queryParametersA reference to a sequence of strings that will be used to store the parameters used in the SQL expression
Returns
Return codes are:

◆ SetQueryParameters()

ReturnCode DDS.IQueryCondition.SetQueryParameters ( params string []  queryParameters)

This operation changes the query parameters associated with the IQueryCondition.

This operation changes the query parameters associated with the IQueryCondition. The parameter queryParameters is a sequence of strings which are the parameter values used in the SQL query string (i.e., the n tokens in the expression). The number of values in queryParameters must be equal or greater than the highest referenced n token in the queryExpression (e.g. if %1 and %8 are used as parameter in the queryExpression, the queryParameters should at least contain n+1 = 9 values).

Parameters
queryParametersA sequence of strings which are the parameters used in the SQL query string (i.e., the n tokens in the expression).
Returns
Return codes are:

The documentation for this interface was generated from the following file: