CoreDX Data Distribution Service
The High Performance, Small Footprint DDS from Twin Oaks Computing, Inc
DataReaderI< T > Class Template Reference
Inheritance diagram for DataReaderI< T >:
DataReader IDataReader< T > DomainEntity Entity

Public Member Functions

ReturnCode_t get_key_value (T key_holder, InstanceHandle_t handle)
 
InstanceHandle_t lookup_instance (T instance_data)
 
ReturnCode_t return_loan (List< T > received_data, List< SampleInfo > sample_infos)
 
ReturnCode_t read (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states)
 
ReturnCode_t take (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states)
 
ReturnCode_t read_w_condition (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, ReadCondition condition)
 
ReturnCode_t take_w_condition (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, ReadCondition condition)
 
ReturnCode_t read_next_sample (T received_data, SampleInfo sample_info)
 
ReturnCode_t take_next_sample (T received_data, SampleInfo sample_info)
 
ReturnCode_t read_instance (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, InstanceHandle_t handle, uint sample_states, uint view_states, uint instance_states)
 
ReturnCode_t take_instance (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, InstanceHandle_t handle, uint sample_states, uint view_states, uint instance_states)
 
ReturnCode_t read_next_instance (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, InstanceHandle_t prev_handle, uint sample_states, uint view_states, uint instance_states)
 
ReturnCode_t take_next_instance (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, InstanceHandle_t prev_handle, uint sample_states, uint view_states, uint instance_states)
 
ReturnCode_t read_next_instance_w_condition (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, InstanceHandle_t handle, ReadCondition condition)
 
ReturnCode_t take_next_instance_w_condition (List< T > received_data, List< SampleInfo > sample_infos, int max_samples, InstanceHandle_t handle, ReadCondition condition)
 
- Public Member Functions inherited from DataReader
new ReturnCode_t enable ()
 
override InstanceHandle_t get_instance_handle ()
 
ReadCondition create_readcondition (uint sample_states, uint view_states, uint instance_states)
 
QueryCondition create_querycondition (uint sample_states, uint view_states, uint instance_states, String query_expression, List< String > query_parameters)
 
ReturnCode_t delete_readcondition (ReadCondition rc)
 
ReturnCode_t delete_contained_entities ()
 
ReturnCode_t set_qos (DataReaderQos qos)
 
ReturnCode_t get_qos (DataReaderQos qos)
 
ReturnCode_t set_listener (DataReaderListener new_listener, uint mask)
 
DataReaderListener get_listener ()
 
TopicDescription get_topicdescription ()
 
Subscriber get_subscriber ()
 
ReturnCode_t get_sample_rejected_status (out SampleRejectedStatus status)
 
ReturnCode_t get_liveliness_changed_status (out LivelinessChangedStatus status)
 
ReturnCode_t get_requested_deadline_missed_status (out RequestedDeadlineMissedStatus status)
 
ReturnCode_t get_requested_incompatible_qos_status (out RequestedIncompatibleQosStatus status)
 
ReturnCode_t get_subscription_matched_status (out SubscriptionMatchedStatus status)
 
ReturnCode_t get_sample_lost_status (out SampleLostStatus status)
 
ReturnCode_t wait_for_historical_data (Duration_t max_wait)
 
ReturnCode_t get_matched_publications (List< InstanceHandle_t > publication_handles)
 
ReturnCode_t get_matched_publication_data (PublicationBuiltinTopicData publication_data, InstanceHandle_t publication_handle)
 
ReturnCode_t get_guid (GUID_t g)
 
- Public Member Functions inherited from Entity
virtual StatusCondition get_statuscondition ()
 
virtual uint get_status_changes ()
 

Detailed Description

The DataReaderI class defines the type specific operations of a DataReader

This class is templatized on the Type of the data that the reader handles.

Type Constraints
T :DdsType 

Member Function Documentation

◆ get_key_value()

ReturnCode_t get_key_value ( key_holder,
InstanceHandle_t  handle 
)
inline

This routine will populate the data structure indicated by key_holder with the key infomation identified by handle.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

Implements IDataReader< T >.

◆ lookup_instance()

InstanceHandle_t lookup_instance ( instance_data)
inline

Returns the handle that identifies the data instance provided in instance_data. The 'key' field values of the data are associated with a unique handle.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

Implements IDataReader< T >.

◆ read()

ReturnCode_t read ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
uint  sample_states,
uint  view_states,
uint  instance_states 
)
inline

This operation accesses a collection of data values (with associated SampleInfo) within the DataReader. This routine, and the related take(), provide the interface for an application to access published data. There are several varieties of read() and take(), to facilitate different access patterns or approaches.

The primary difference between read() and take() is that take() removes all returned data samples from the DataReader while read() does not. Sequential read() calls will return the same data samples each time (if nothing else changes); while sequential take() calls will return data samples for only the first call. Subsequent take() calls will return an empty collection (if no new data arrives).

The specific behavior of read() depends on several things: input paramters, the QoS settings of the DataReader, and the state of recieved data. First, the received_data and sample_infos arguments affect the following:

  • how many samples are returned, and
  • whether the returned data should be 'loaned' or copied.

The argument max_samples is used to further limit the number of samples returned.

The sample_states, view_states, and instance_states arguments are used to selectively add data samples to the returned collections. These arguments indicate the desired 'states' for data samples and instances. These state arguments are bit masks; they can be the bit-wise OR of several individual state flags or they may use the special 'ANY' constants (e.g.: DDS.ANY_SAMPLE_STATE). Only samples that have a matching state for all three categories are added to the returned collection.

The order of samples in the returned collections is determined by the PRESENTATION and DESTINATION_ORDER QoS policies.

The returned collection is held in recieved_data and samples_infos. These two sequences operate together to represent a sequence of pairs (data, SampleInfo). Each data item in received_data has a corresponding entry in sample_infos that provides associated 'meta-data'. See SampleInfo for a description of this meta-data.

In CoreDX DDS, the returned sequences contain 'loaned' data. This provides zero-copy access to the data, and provides a very efficient data access mechanism. Becuase the data is 'loaned' to the application, the application is required to indicate when it is finished accessing the data. This is accomplished by calling return_loan().

The read() operation will set the SampleInfo.sample_state to DDS.READ_SAMPLE_STATE.

The read() operation may set the SampleInfo.view_state to DDS.NOT_NEW_VIEW_STATE, if a sample of the most recent generation of the instance is read.

If there is no data found, then the read() will return RETCODE_NO_DATA.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

Implements IDataReader< T >.

◆ read_instance()

ReturnCode_t read_instance ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
InstanceHandle_t  handle,
uint  sample_states,
uint  view_states,
uint  instance_states 
)
inline

This operation accesses a collection of data values (with associated SampleInfo), belonging to a particular instance, within the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::read(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) read()

Implements IDataReader< T >.

◆ read_next_instance()

ReturnCode_t read_next_instance ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
InstanceHandle_t  prev_handle,
uint  sample_states,
uint  view_states,
uint  instance_states 
)
inline

This operation accesses a collection of data values (with associated SampleInfo), instance by instance, within the DataReader. To start,pass HANDLE_NIL for parameter prev_handle. After the last instance (in order) has been taken, this routine will return RETCODE_NO_DATA.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::read(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) read()

Implements IDataReader< T >.

◆ read_next_instance_w_condition()

ReturnCode_t read_next_instance_w_condition ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
InstanceHandle_t  handle,
ReadCondition  condition 
)
inline

This operation accesses a collection of data values (with associated SampleInfo), instance by instance subject to a filter, within the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::read(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) read()

Implements IDataReader< T >.

◆ read_next_sample()

ReturnCode_t read_next_sample ( received_data,
SampleInfo  sample_info 
)
inline

This operation accesses a data value (with associated SampleInfo) within the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::read(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) read()

Implements IDataReader< T >.

◆ read_w_condition()

ReturnCode_t read_w_condition ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
ReadCondition  condition 
)
inline

This operation accesses a collection of data values (with associated SampleInfo), subject to a filter, within the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::read(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) read()

Implements IDataReader< T >.

◆ return_loan()

ReturnCode_t return_loan ( List< T >  received_data,
List< SampleInfo sample_infos 
)
inline

Returns data and sample_info values to a DataReader. When an application calls DataReader read() or take() operations, these routines 'loan' data and SampleInfo values to the application. [This is an optimization that avoids extra copies of data.] The appliction must return this 'loaned' data to the DataReader. The return_loan() routine indicates to the DataReader that the application no longer requires access to the data and sample_infos.

A call to return_loan() operation must be made only if previous read() or take() calls 'loaned' data to the application. See read() for a discussion of when data is 'loaned'.

If the received_data or sample_infos parameters provided do not identify data obtained from DataReader dr, then the error RETCODE_PRECONDITION_NOT_MET will be returned.

A DataReader cannot be deleted if any 'loans' are outstanding.

See also
com.toc.coredx.DDS.TDataReader::read(TSeq received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) read()

Implements IDataReader< T >.

◆ take()

ReturnCode_t take ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
uint  sample_states,
uint  view_states,
uint  instance_states 
)
inline

This operation takes a collection of data values (with associated SampleInfo) from the DataReader. This routine, and the related read(), provide the interface for an application to access published data. There are several varieties of read() and take(), to facilitate different access patterns or approaches.

The primary difference between read() and take() is that take() removes all returned data samples from the DataReader while read() does not. Sequential read() calls will return the same data samples each time (if nothing else changes); while sequential take() calls will return data samples for only the first call. Subsequent take() calls will return an empty collection (if no new data arrives).

The specific behavior of take() depends on several things: input paramters, the QoS settings of the DataReader, and the state of recieved data. First, the received_data and sample_infos arguments affect the following:

  • how many samples are returned, and
  • whether the returned data should be 'loaned' or copied.

The argument max_samples is used to further limit the number of samples returned.

The sample_states, view_states, and instance_states arguments are used to selectively add data samples to the returned collections. These arguments indicate the desired 'states' for data samples and instances. These state arguments are bit masks; they can be the bit-wise OR of several individual state flags or they may use the special 'ANY' constants (e.g.: DDS.ANY_SAMPLE_STATE). Only samples that have a matching state for all three categories are added to the returned collection.

The order of samples in the returned collections is determined by the PRESENTATION and DESTINATION_ORDER QoS policies.

The returned collection is held in recieved_data and samples_infos. These two sequences operate together to represent a sequence of pairs (data, SampleInfo). Each data item in received_data has a corresponding entry in sample_infos that provides associated 'meta-data'. See SampleInfo for a description of this meta-data.

In CoreDX DDS, the returned sequences contain 'loaned' data. This provides zero-copy access to the data, and provides a very efficient data access mechanism. Becuase the data is 'loaned' to the application, the application is required to indicate when it is finished accessing the data. This is accomplished by calling return_loan().

The take() operation will set the SampleInfo.sample_state to DDS.READ_SAMPLE_STATE.

The take() operation may set the SampleInfo.view_state to DDS.NOT_NEW_VIEW_STATE, if a sample of the most recent generation of the instance is taken.

If there is no data found, then the take() will return RETCODE_NO_DATA.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

Implements IDataReader< T >.

◆ take_instance()

ReturnCode_t take_instance ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
InstanceHandle_t  handle,
uint  sample_states,
uint  view_states,
uint  instance_states 
)
inline

This operation takes a collection of data values (with associated SampleInfo), belonging to a particular instance, from the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::take(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) take()

Implements IDataReader< T >.

◆ take_next_instance()

ReturnCode_t take_next_instance ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
InstanceHandle_t  prev_handle,
uint  sample_states,
uint  view_states,
uint  instance_states 
)
inline

This operation takes a collection of data values (with associated SampleInfo), instance by instance, from the DataReader. To start,pass HANDLE_NIL for parameter prev_handle. After the last instance (in order) has been taken, this routine will return RETCODE_NO_DATA.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::take(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) take()

Implements IDataReader< T >.

◆ take_next_instance_w_condition()

ReturnCode_t take_next_instance_w_condition ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
InstanceHandle_t  handle,
ReadCondition  condition 
)
inline

This operation takes a collection of data values (with associated SampleInfo), instance by instance subject to a filter, from the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::take(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) take()

Implements IDataReader< T >.

◆ take_next_sample()

ReturnCode_t take_next_sample ( received_data,
SampleInfo  sample_info 
)
inline

This operation takes a data value (with associated SampleInfo) from the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::take(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) take()

Implements IDataReader< T >.

◆ take_w_condition()

ReturnCode_t take_w_condition ( List< T >  received_data,
List< SampleInfo sample_infos,
int  max_samples,
ReadCondition  condition 
)
inline

This operation takes a collection of data values (with associated SampleInfo), subject to a filter, from the DataReader.

This routine is data type specific. The generated type specific DataReader includes an implementation of this routine which should be used to support type-safety.

See also
com.toc.coredx.DDS.TDataReader::take(List<T> received_data, List<SampleInfo> sample_infos, int max_samples, uint sample_states, uint view_states, uint instance_states) take()

Implements IDataReader< T >.


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