DDSDataReader Class Reference
[DataReaders]

<<interface>> Allows the application to: (1) declare the data it wishes to receive (i.e. make a subscription) and (2) access the data received by the attached DDSSubscriber. More...

Inheritance diagram for DDSDataReader:

DDSDomainEntity DDSEntity DDSDynamicDataReader DDSDynamicDataReader DDSKeyedOctetsDataReader DDSKeyedStringDataReader DDSOctetsDataReader DDSParticipantBuiltinTopicDataDataReader DDSPublicationBuiltinTopicDataDataReader DDSStringDataReader DDSSubscriptionBuiltinTopicDataDataReader DDSTopicBuiltinTopicDataDataReader FooDataReader

List of all members.

Public Member Functions

virtual DDSReadConditioncreate_readcondition (DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states)
 Creates a DDSReadCondition.
virtual DDSQueryConditioncreate_querycondition (DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states, const char *query_expression, const struct DDS_StringSeq &query_parameters)
 Creates a DDSQueryCondition.
virtual DDS_ReturnCode_t delete_readcondition (DDSReadCondition *condition)
 Deletes a DDSReadCondition or DDSQueryCondition attached to the DDSDataReader.
virtual DDS_ReturnCode_t delete_contained_entities ()
 Deletes all the entities that were created by means of the "create" operations on the DDSDataReader.
virtual DDS_ReturnCode_t wait_for_historical_data (const DDS_Duration_t &max_wait)
 Waits until all "historical" data is received for DDSDataReader entities that have a non-VOLATILE Durability Qos kind.
virtual DDS_ReturnCode_t get_matched_publications (DDS_InstanceHandleSeq &publication_handles)
 Retrieve the list of publications currently "associated" with this DDSDataReader.
virtual DDS_ReturnCode_t get_matched_publication_data (DDS_PublicationBuiltinTopicData &publication_data, const DDS_InstanceHandle_t &publication_handle)
 This operation retrieves the information on a publication that is currently "associated" with the DDSDataReader.
virtual DDSTopicDescriptionget_topicdescription ()
 Returns the DDSTopicDescription associated with the DDSDataReader.
virtual DDSSubscriberget_subscriber ()
 Returns the DDSSubscriber to which the DDSDataReader belongs.
virtual DDS_ReturnCode_t get_sample_rejected_status (DDS_SampleRejectedStatus &status)
 Accesses the DDS_SAMPLE_REJECTED_STATUS communication status.
virtual DDS_ReturnCode_t get_liveliness_changed_status (DDS_LivelinessChangedStatus &status)
 Accesses the DDS_LIVELINESS_CHANGED_STATUS communication status.
virtual DDS_ReturnCode_t get_requested_deadline_missed_status (DDS_RequestedDeadlineMissedStatus &status)
 Accesses the DDS_REQUESTED_DEADLINE_MISSED_STATUS communication status.
virtual DDS_ReturnCode_t get_requested_incompatible_qos_status (DDS_RequestedIncompatibleQosStatus &status)
 Accesses the DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS communication status.
virtual DDS_ReturnCode_t get_sample_lost_status (DDS_SampleLostStatus &status)
 Accesses the DDS_SAMPLE_LOST_STATUS communication status.
virtual DDS_ReturnCode_t get_subscription_matched_status (DDS_SubscriptionMatchedStatus &status)
 Accesses the DDS_SUBSCRIPTION_MATCHED_STATUS communication status.
virtual DDS_ReturnCode_t get_datareader_cache_status (DDS_DataReaderCacheStatus &status)
 <<eXtension>> Get the datareader cache status for this reader.
virtual DDS_ReturnCode_t get_datareader_protocol_status (DDS_DataReaderProtocolStatus &status)
 <<eXtension>> Get the datareader protocol status for this reader.
virtual DDS_ReturnCode_t get_matched_publication_datareader_protocol_status (DDS_DataReaderProtocolStatus &status, const DDS_InstanceHandle_t &publication_handle)
 <<eXtension>> Get the datareader protocol status for this reader, per matched publication identified by the publication_handle.
virtual DDS_ReturnCode_t set_qos (const DDS_DataReaderQos &qos)
 Sets the reader QoS.
virtual DDS_ReturnCode_t get_qos (DDS_DataReaderQos &qos)
 Gets the reader QoS.
virtual DDS_ReturnCode_t set_qos_with_profile (const char *library_name, const char *profile_name)
 <<eXtension>> Change the QoS of this reader using the input XML QoS profile.
virtual DDS_ReturnCode_t set_listener (DDSDataReaderListener *l, DDS_StatusMask mask=DDS_STATUS_MASK_ALL)
 Sets the reader listener.
virtual DDSDataReaderListenerget_listener ()
 Get the reader listener.
virtual DDS_ReturnCode_t enable ()
 Enables the DDSEntity.
virtual DDSStatusConditionget_statuscondition ()
 Allows access to the DDSStatusCondition associated with the DDSEntity.
virtual DDS_StatusMask get_status_changes ()
 Retrieves the list of communication statuses in the DDSEntity that are triggered.
virtual DDS_InstanceHandle_t get_instance_handle ()
 Allows access to the DDS_InstanceHandle_t associated with the DDSEntity.


Detailed Description

<<interface>> Allows the application to: (1) declare the data it wishes to receive (i.e. make a subscription) and (2) access the data received by the attached DDSSubscriber.

QoS:
DDS_DataReaderQos
Status:
DDS_DATA_AVAILABLE_STATUS;
DDS_LIVELINESS_CHANGED_STATUS, DDS_LivelinessChangedStatus;
DDS_REQUESTED_DEADLINE_MISSED_STATUS, DDS_RequestedDeadlineMissedStatus;
DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS, DDS_RequestedIncompatibleQosStatus;
DDS_SAMPLE_LOST_STATUS, DDS_SampleLostStatus;
DDS_SAMPLE_REJECTED_STATUS, DDS_SampleRejectedStatus;
DDS_SUBSCRIPTION_MATCHED_STATUS, DDS_SubscriptionMatchedStatus<BR>
Listener:
DDSDataReaderListener
A DDSDataReader refers to exactly one DDSTopicDescription (either a DDSTopic, a DDSContentFilteredTopic or a DDSMultiTopic) that identifies the data to be read.

The subscription has a unique resulting type. The data-reader may give access to several instances of the resulting type, which can be distinguished from each other by their key.

DDSDataReader is an abstract class. It must be specialised for each particular application data-type (see USER_DATA). The additional methods or functions that must be defined in the auto-generated class for a hypothetical application type Foo are specified in the generic type FooDataReader.

The following operations may be called even if the DDSDataReader is not enabled. Other operations will fail with the value DDS_RETCODE_NOT_ENABLED if called on a disabled DDSDataReader:

All sample-accessing operations, namely: FooDataReader::read, FooDataReader::take, FooDataReader::read_w_condition, and FooDataReader::take_w_condition may fail with the error DDS_RETCODE_PRECONDITION_NOT_MET as described in DDSSubscriber::begin_access.

See also:
Operations Allowed in Listener Callbacks
Examples:

HelloWorld_subscriber.cxx, and HelloWorldSupport.cxx.


Member Function Documentation

virtual DDSReadCondition* DDSDataReader::create_readcondition ( DDS_SampleStateMask  sample_states,
DDS_ViewStateMask  view_states,
DDS_InstanceStateMask  instance_states 
) [inline, virtual]

Creates a DDSReadCondition.

The returned DDSReadCondition will be attached and belong to the DDSDataReader.

Parameters:
sample_states <<in>> sample state of the data samples that are of interest
view_states <<in>> view state of the data samples that are of interest
instance_states <<in>> instance state of the data samples that are of interest
Returns:
return DDSReadCondition created. Returns NULL in case of failure.

virtual DDSQueryCondition* DDSDataReader::create_querycondition ( DDS_SampleStateMask  sample_states,
DDS_ViewStateMask  view_states,
DDS_InstanceStateMask  instance_states,
const char *  query_expression,
const struct DDS_StringSeq query_parameters 
) [inline, virtual]

Creates a DDSQueryCondition.

The returned DDSQueryCondition will be attached and belong to the DDSDataReader.

Queries and Filters Syntax describes the syntax of query_expression and query_parameters.

Parameters:
sample_states <<in>> sample state of the data samples that are of interest
view_states <<in>> view state of the data samples that are of interest
instance_states <<in>> instance state of the data samples that are of interest
query_expression <<in>> Expression for the query. Cannot be NULL.
query_parameters <<in>> Parameters for the query expression.
Returns:
return DDSQueryCondition created. Returns NULL in case of failure.

virtual DDS_ReturnCode_t DDSDataReader::delete_readcondition ( DDSReadCondition condition  )  [inline, virtual]

Deletes a DDSReadCondition or DDSQueryCondition attached to the DDSDataReader.

Since DDSQueryCondition specializes DDSReadCondition, it can also be used to delete a DDSQueryCondition.

Precondition:
The DDSReadCondition must be attached to the DDSDataReader, or the operation will fail with the error DDS_RETCODE_PRECONDITION_NOT_MET.
Parameters:
condition <<in>> Condition to be deleted.
Returns:
One of the Standard Return Codes, or DDS_RETCODE_PRECONDITION_NOT_MET

virtual DDS_ReturnCode_t DDSDataReader::delete_contained_entities (  )  [inline, virtual]

Deletes all the entities that were created by means of the "create" operations on the DDSDataReader.

Deletes all contained DDSReadCondition and DDSQueryCondition objects.

The operation will fail with DDS_RETCODE_PRECONDITION_NOT_MET if the any of the contained entities is in a state where it cannot be deleted.

Once DDSDataReader::delete_contained_entities completes successfully, the application may delete the DDSDataReader, knowing that it has no contained DDSReadCondition and DDSQueryCondition objects.

Returns:
One of the Standard Return Codes, or DDS_RETCODE_PRECONDITION_NOT_MET

virtual DDS_ReturnCode_t DDSDataReader::wait_for_historical_data ( const DDS_Duration_t max_wait  )  [inline, virtual]

Waits until all "historical" data is received for DDSDataReader entities that have a non-VOLATILE Durability Qos kind.

This operation is intended only for DDSDataReader entities that have a non-VOLATILE Durability QoS kind.

As soon as an application enables a non-VOLATILE DDSDataReader, it will start receiving both "historical" data (i.e., the data that was written prior to the time the DDSDataReader joined the domain) as well as any new data written by the DDSDataWriter entities. There are situations where the application logic may require the application to wait until all "historical" data is received. This is the purpose of the DDSDataReader::wait_for_historical_data operations.

The operation DDSDataReader::wait_for_historical_data blocks the calling thread until either all "historical" data is received, or else duration specified by the max_wait parameter clapses, whichever happens first. A successful completion indicates that all the "historical" data was "received"; timing out indicates that max_wait elapsed before all the data was received.

Parameters:
max_wait <<in>> Timeout value.
Returns:
One of the Standard Return Codes, DDS_RETCODE_TIMEOUT or DDS_RETCODE_NOT_ENABLED.

virtual DDS_ReturnCode_t DDSDataReader::get_matched_publications ( DDS_InstanceHandleSeq publication_handles  )  [inline, virtual]

Retrieve the list of publications currently "associated" with this DDSDataReader.

Matching publications are those in the same domain that have a matching DDSTopic, compatible QoS common partition that the DDSDomainParticipant has not indicated should be "ignored" by means of the DDSDomainParticipant::ignore_publication operation.

The handles returned in the publication_handles' list are the ones that are used by the DDS implementation to locally identify the corresponding matched DDSDataWriter entities. These handles match the ones that appear in the instance_handle field of the DDS_SampleInfo when reading the DDS_PUBLICATION_TOPIC_NAME builtin topic

Parameters:
publication_handles <<inout>>. The sequence will be grown if the sequence has ownership and the system has the corresponding resources. Use a sequence without ownership to avoid dynamic memory allocation. If the sequence is too small to store all the matches and the system can not resize the sequence, this method will fail with DDS_RETCODE_OUT_OF_RESOURCES.
The maximum number of matches possible is configured with DDS_DomainParticipantResourceLimitsQosPolicy. You can use a zero-maximum sequence without ownership to quickly check whether there are any matches without allocating any memory. .

Returns:
One of the Standard Return Codes, or DDS_RETCODE_OUT_OF_RESOURCES if the sequence is too small and the system can not resize it, or DDS_RETCODE_NOT_ENABLED

virtual DDS_ReturnCode_t DDSDataReader::get_matched_publication_data ( DDS_PublicationBuiltinTopicData publication_data,
const DDS_InstanceHandle_t publication_handle 
) [inline, virtual]

This operation retrieves the information on a publication that is currently "associated" with the DDSDataReader.

Publication with a matching DDSTopic, compatible QoS and common partition that the application has not indicated should be "ignored" by means of the DDSDomainParticipant::ignore_publication operation.

The publication_handle must correspond to a publication currently associated with the DDSDataReader. Otherwise, the operation will fail with DDS_RETCODE_BAD_PARAMETER. Use the operation DDSDataReader::get_matched_publications to find the publications that are currently matched with the DDSDataReader.

Note: This operation does not retrieve the following information in DDS_PublicationBuiltinTopicData:

The above information is available through DDSDataReaderListener::on_data_available() (if a reader listener is installed on the DDSPublicationBuiltinTopicDataDataReader).

Parameters:
publication_data <<inout>>. The information to be filled in on the associated publication. Cannot be NULL.
publication_handle <<in>>. Handle to a specific publication associated with the DDSDataWriter. . Must correspond to a publication currently associated with the DDSDataReader.
Returns:
One of the Standard Return Codes or DDS_RETCODE_NOT_ENABLED

virtual DDSTopicDescription* DDSDataReader::get_topicdescription (  )  [inline, virtual]

Returns the DDSTopicDescription associated with the DDSDataReader.

Returns that same DDSTopicDescription that was used to create the DDSDataReader.

Returns:
DDSTopicDescription associated with the DDSDataReader.

virtual DDSSubscriber* DDSDataReader::get_subscriber (  )  [inline, virtual]

Returns the DDSSubscriber to which the DDSDataReader belongs.

Returns:
DDSSubscriber to which the DDSDataReader belongs.

virtual DDS_ReturnCode_t DDSDataReader::get_sample_rejected_status ( DDS_SampleRejectedStatus status  )  [inline, virtual]

Accesses the DDS_SAMPLE_REJECTED_STATUS communication status.

Parameters:
status <<inout>> DDS_SampleRejectedStatus to be filled in.
Returns:
One of the Standard Return Codes

virtual DDS_ReturnCode_t DDSDataReader::get_liveliness_changed_status ( DDS_LivelinessChangedStatus status  )  [inline, virtual]

Accesses the DDS_LIVELINESS_CHANGED_STATUS communication status.

Parameters:
status <<inout>> DDS_LivelinessChangedStatus to be filled in.
Returns:
One of the Standard Return Codes

virtual DDS_ReturnCode_t DDSDataReader::get_requested_deadline_missed_status ( DDS_RequestedDeadlineMissedStatus status  )  [inline, virtual]

Accesses the DDS_REQUESTED_DEADLINE_MISSED_STATUS communication status.

Parameters:
status <<inout>> DDS_RequestedDeadlineMissedStatus to be filled in.
Returns:
One of the Standard Return Codes

virtual DDS_ReturnCode_t DDSDataReader::get_requested_incompatible_qos_status ( DDS_RequestedIncompatibleQosStatus status  )  [inline, virtual]

Accesses the DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS communication status.

Parameters:
status <<inout>> DDS_RequestedIncompatibleQosStatus to be filled in.
Returns:
One of the Standard Return Codes

virtual DDS_ReturnCode_t DDSDataReader::get_sample_lost_status ( DDS_SampleLostStatus status  )  [inline, virtual]

Accesses the DDS_SAMPLE_LOST_STATUS communication status.

Parameters:
status <<inout>> DDS_SampleLostStatus to be filled in.
Returns:
One of the Standard Return Codes

virtual DDS_ReturnCode_t DDSDataReader::get_subscription_matched_status ( DDS_SubscriptionMatchedStatus status  )  [inline, virtual]

Accesses the DDS_SUBSCRIPTION_MATCHED_STATUS communication status.

Parameters:
status <<inout>> DDS_SubscriptionMatchedStatus to be filled in.
Returns:
One of the Standard Return Codes

virtual DDS_ReturnCode_t DDSDataReader::get_datareader_cache_status ( DDS_DataReaderCacheStatus status  )  [inline, virtual]

<<eXtension>> Get the datareader cache status for this reader.

Parameters:
status <<inout>> DDS_DataReaderCacheStatus to be filled in.
Returns:
One of the Standard Return Codes or DDS_RETCODE_NOT_ENABLED.

virtual DDS_ReturnCode_t DDSDataReader::get_datareader_protocol_status ( DDS_DataReaderProtocolStatus status  )  [inline, virtual]

<<eXtension>> Get the datareader protocol status for this reader.

Parameters:
status <<inout>> DDS_DataReaderProtocolStatus to be filled in.
Returns:
One of the Standard Return Codes or DDS_RETCODE_NOT_ENABLED.

virtual DDS_ReturnCode_t DDSDataReader::get_matched_publication_datareader_protocol_status ( DDS_DataReaderProtocolStatus status,
const DDS_InstanceHandle_t publication_handle 
) [inline, virtual]

<<eXtension>> Get the datareader protocol status for this reader, per matched publication identified by the publication_handle.

Note: Status for a remote entity is only kept while the entity is alive. Once a remote entity is no longer alive, its status is deleted.

Parameters:
status <<inout>>. The information to be filled in on the associated publication. Cannot be NULL.
publication_handle <<in>>. Handle to a specific publication associated with the DDSDataWriter. . Must correspond to a publication currently associated with the DDSDataReader.
Returns:
One of the Standard Return Codes or DDS_RETCODE_NOT_ENABLED

virtual DDS_ReturnCode_t DDSDataReader::set_qos ( const DDS_DataReaderQos qos  )  [inline, virtual]

Sets the reader QoS.

This operation modifies the QoS of the DDSDataReader.

The DDS_DataReaderQos::user_data, DDS_DataReaderQos::deadline, DDS_DataReaderQos::latency_budget, DDS_DataReaderQos::time_based_filter, DDS_DataReaderQos::reader_data_lifecycle can be changed. The other policies are immutable.

Parameters:
qos <<in>> The DDS_DataReaderQos to be set to. Policies must be consistent. Immutable policies cannot be changed after DDSDataReader is enabled. The special value DDS_DATAREADER_QOS_DEFAULT can be used to indicate that the QoS of the DDSDataReader should be changed to match the current default DDS_DataReaderQos set in the DDSSubscriber.
Returns:
One of the Standard Return Codes, DDS_RETCODE_IMMUTABLE_POLICY, or DDS_RETCODE_INCONSISTENT_POLICY.
See also:
DDS_DataReaderQos for rules on consistency among QoS

set_qos (abstract)

DDSDataReader::set_qos

Operations Allowed in Listener Callbacks

virtual DDS_ReturnCode_t DDSDataReader::get_qos ( DDS_DataReaderQos qos  )  [inline, virtual]

Gets the reader QoS.

This method may potentially allocate memory depending on the sequences contained in some QoS policies.

Parameters:
qos <<inout>> The DDS_DataReaderQos to be filled up.
Returns:
One of the Standard Return Codes
See also:
get_qos (abstract)

virtual DDS_ReturnCode_t DDSDataReader::set_qos_with_profile ( const char *  library_name,
const char *  profile_name 
) [inline, virtual]

<<eXtension>> Change the QoS of this reader using the input XML QoS profile.

This operation modifies the QoS of the DDSDataReader.

The DDS_DataReaderQos::user_data, DDS_DataReaderQos::deadline, DDS_DataReaderQos::latency_budget, DDS_DataReaderQos::time_based_filter, DDS_DataReaderQos::reader_data_lifecycle can be changed. The other policies are immutable.

Parameters:
library_name <<in>> Library name containing the XML QoS profile. If library_name is null RTI Connext will use the default library (see DDSSubscriber::set_default_library).
profile_name <<in>> XML QoS Profile name. If profile_name is null RTI Connext will use the default profile (see DDSSubscriber::set_default_profile).
Returns:
One of the Standard Return Codes, DDS_RETCODE_IMMUTABLE_POLICY, or DDS_RETCODE_INCONSISTENT_POLICY.
See also:
DDS_DataReaderQos for rules on consistency among QoS

DDSDataReader::set_qos

Operations Allowed in Listener Callbacks

virtual DDS_ReturnCode_t DDSDataReader::set_listener ( DDSDataReaderListener l,
DDS_StatusMask  mask = DDS_STATUS_MASK_ALL 
) [inline, virtual]

Sets the reader listener.

Parameters:
l <<in>> DDSDataReaderListener to set to
mask <<in>> DDS_StatusMask associated with the DDSDataReaderListener.
Returns:
One of the Standard Return Codes
See also:
set_listener (abstract)

virtual DDSDataReaderListener* DDSDataReader::get_listener (  )  [inline, virtual]

Get the reader listener.

Returns:
DDSDataReaderListener of the DDSDataReader.
See also:
get_listener (abstract)

virtual DDS_ReturnCode_t DDSDataReader::enable (  )  [inline, virtual]

Enables the DDSEntity.

This operation enables the Entity. Entity objects can be created either enabled or disabled. This is controlled by the value of the ENTITY_FACTORY QoS policy on the corresponding factory for the DDSEntity.

By default, ENTITY_FACTORY is set so that it is not necessary to explicitly call DDSEntity::enable on newly created entities.

The DDSEntity::enable operation is idempotent. Calling enable on an already enabled Entity returns OK and has no effect.

If a DDSEntity has not yet been enabled, the following kinds of operations may be invoked on it:

Other operations may explicitly state that they may be called on disabled entities; those that do not will return the error DDS_RETCODE_NOT_ENABLED.

It is legal to delete an DDSEntity that has not been enabled by calling the proper operation on its factory.

Entities created from a factory that is disabled are created disabled, regardless of the setting of the DDS_EntityFactoryQosPolicy.

Calling enable on an Entity whose factory is not enabled will fail and return DDS_RETCODE_PRECONDITION_NOT_MET.

If DDS_EntityFactoryQosPolicy::autoenable_created_entities is TRUE, the enable operation on a factory will automatically enable all entities created from that factory.

Listeners associated with an entity are not called until the entity is enabled.

Conditions associated with a disabled entity are "inactive," that is, they have a trigger_value == FALSE.

Returns:
One of the Standard Return Codes, Standard Return Codes or DDS_RETCODE_PRECONDITION_NOT_MET.

Implements DDSEntity.

virtual DDSStatusCondition* DDSDataReader::get_statuscondition (  )  [inline, virtual]

Allows access to the DDSStatusCondition associated with the DDSEntity.

The returned condition can then be added to a DDSWaitSet so that the application can wait for specific status changes that affect the DDSEntity.

Returns:
the status condition associated with this entity.

Implements DDSEntity.

virtual DDS_StatusMask DDSDataReader::get_status_changes (  )  [inline, virtual]

Retrieves the list of communication statuses in the DDSEntity that are triggered.

That is, the list of statuses whose value has changed since the last time the application read the status using the get_*_status() method.

When the entity is first created or if the entity is not enabled, all communication statuses are in the "untriggered" state so the list returned by the get_status_changes operation will be empty.

The list of statuses returned by the get_status_changes operation refers to the status that are triggered on the Entity itself and does not include statuses that apply to contained entities.

Returns:
list of communication statuses in the DDSEntity that are triggered.
See also:
Status Kinds

Implements DDSEntity.

virtual DDS_InstanceHandle_t DDSDataReader::get_instance_handle (  )  [inline, virtual]

Allows access to the DDS_InstanceHandle_t associated with the DDSEntity.

This operation returns the DDS_InstanceHandle_t that represents the DDSEntity.

Returns:
the instance handle associated with this entity.

Implements DDSEntity.


RTI Connext C++ API Version 4.5f Copyright © 17 Mar 2012 Real-Time Innovations, Inc