DDS-PSM-C++  1.0
ISO C++ API for OpenSplice DDS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Public Types | Public Member Functions | List of all members
dds::sub::DataReader< T, DELEGATE > Class Template Reference

#include <TDataReader.hpp>

Inheritance diagram for dds::sub::DataReader< T, DELEGATE >:
Inheritance graph
[legend]

Classes

class  ManipulatorSelector
 
class  Selector
 

Public Types

typedef T DataType
 
typedef
::dds::sub::DataReaderListener
< T > 
Listener
 

Public Member Functions

 DataReader (const dds::sub::Subscriber &sub, const ::dds::topic::Topic< T > &topic)
 
 DataReader (const dds::sub::Subscriber &sub, const ::dds::topic::Topic< T > &topic, const dds::sub::qos::DataReaderQos &qos, dds::sub::DataReaderListener< T > *listener=NULL, const dds::core::status::StatusMask &mask=::dds::core::status::StatusMask::all())
 
 ~DataReader ()
 
const dds::sub::status::DataState & default_filter_state ()
 
DataReaderdefault_filter_state (const dds::sub::status::DataState &state)
 
dds::topic::TopicInstance< T > key_value (const dds::core::InstanceHandle &h)
 
T & key_value (T &sample, const dds::core::InstanceHandle &h)
 
void listener (Listener *the_listener, const dds::core::status::StatusMask &event_mask)
 
Listenerlistener () const
 
const
dds::core::status::LivelinessChangedStatus
liveliness_changed_status () const
 
const dds::core::InstanceHandle lookup_instance (const T &key) const
 
DataReaderoperator<< (const dds::sub::qos::DataReaderQos &the_qos)
 
DataReaderoperator>> (dds::sub::LoanedSamples< T > &ls)
 
ManipulatorSelector operator>> (ManipulatorSelector &(manipulator)(ManipulatorSelector &))
 
template<typename Functor >
ManipulatorSelector operator>> (Functor f)
 
DataReaderoperator>> (dds::sub::qos::DataReaderQos &the_qos)
 
const
dds::sub::qos::DataReaderQos
qos () const
 
void qos (const dds::sub::qos::DataReaderQos &the_qos)
 
LoanedSamples< T > read ()
 
template<typename SamplesFWIterator >
uint32_t read (SamplesFWIterator sfit, uint32_t max_samples)
 
template<typename SamplesBIIterator >
uint32_t read (SamplesBIIterator sbit)
 
const
dds::core::status::RequestedDeadlineMissedStatus
requested_deadline_missed_status ()
 
const
dds::core::status::RequestedIncompatibleQosStatus
requested_incompatible_qos_status () const
 
const
dds::core::status::SampleLostStatus
sample_lost_status () const
 
const
dds::core::status::SampleRejectedStatus
sample_rejected_status () const
 
Selector select ()
 
const dds::sub::Subscribersubscriber () const
 
const
dds::core::status::SubscriptionMatchedStatus
subscription_matched_status () const
 
LoanedSamples< T > take ()
 
template<typename SamplesFWIterator >
uint32_t take (SamplesFWIterator sfit, uint32_t max_samples)
 
template<typename SamplesBIIterator >
uint32_t take (SamplesBIIterator sbit)
 
dds::topic::TopicDescription
< DataType
topic_description () const
 
void wait_for_historical_data (const dds::core::Duration &timeout)
 
- Public Member Functions inherited from dds::core::TEntity< DELEGATE< T > >
 ~TEntity ()
 
void close ()
 
void enable ()
 
const dds::core::InstanceHandle instance_handle () const
 
void retain ()
 
const dds::core::status::StatusMask status_changes ()
 
- Public Member Functions inherited from dds::core::Reference< DELEGATE< T > >
 Reference (dds::core::null_type &)
 
 Reference (const Reference &ref)
 
 Reference (const Reference< D > &ref)
 
 Reference (DELEGATE_T *p)
 
 ~Reference ()
 
const DELEGATE_REF_T & delegate () const
 
DELEGATE_REF_T & delegate ()
 
bool is_nil () const
 
 operator const DELEGATE_REF_T & () const
 
 operator DELEGATE_REF_T () const
 
 operator DELEGATE_REF_T & ()
 
bool operator!= (const R &ref) const
 
bool operator!= (const null_type nil) const
 
DELEGATE< T > * operator-> ()
 
const DELEGATE< T > * operator-> () const
 
Referenceoperator= (const Reference< D > &that)
 
Referenceoperator= (const R &rhs)
 
Referenceoperator= (const null_type)
 
bool operator== (const R &ref) const
 
bool operator== (const null_type) const
 

Additional Inherited Members

- Protected Attributes inherited from dds::core::Reference< DELEGATE< T > >
DELEGATE_REF_T impl_
 

Detailed Description

template<typename T, template< typename Q > class DELEGATE>
class dds::sub::DataReader< T, DELEGATE >

Definition at line 40 of file TDataReader.hpp.

Member Typedef Documentation

template<typename T, template< typename Q > class DELEGATE>
typedef T dds::sub::DataReader< T, DELEGATE >::DataType

Definition at line 43 of file TDataReader.hpp.

template<typename T, template< typename Q > class DELEGATE>
typedef ::dds::sub::DataReaderListener<T> dds::sub::DataReader< T, DELEGATE >::Listener

Definition at line 44 of file TDataReader.hpp.

Constructor & Destructor Documentation

template<typename T, template< typename Q > class DELEGATE>
dds::sub::DataReader< T, DELEGATE >::DataReader ( const dds::sub::Subscriber sub,
const ::dds::topic::Topic< T > &  topic 
)

Create a DataReader. The QoS will be the same as "sub.default_datareader_qos()".

Parameters
subthe subscriber owning this DataReader.
topicthe topic associated with this DataReader.
template<typename T, template< typename Q > class DELEGATE>
dds::sub::DataReader< T, DELEGATE >::DataReader ( const dds::sub::Subscriber sub,
const ::dds::topic::Topic< T > &  topic,
const dds::sub::qos::DataReaderQos qos,
dds::sub::DataReaderListener< T > *  listener = NULL,
const dds::core::status::StatusMask mask = ::dds::core::status::StatusMask::all() 
)

Create a DataReader.

Parameters
subthe subscriber owning this DataReader.
topicthe topic associated with this DataReader.
qosthe QoS settings for this DataReader.
listenerthe listener.
maskthe event mask associated to the DataReader listener.
template<typename T, template< typename Q > class DELEGATE>
dds::sub::DataReader< T, DELEGATE >::~DataReader ( )

Member Function Documentation

template<typename T, template< typename Q > class DELEGATE>
const dds::sub::status::DataState& dds::sub::DataReader< T, DELEGATE >::default_filter_state ( )

Returns the default read-state (if not changed, it is set to ReaderState::any()).

template<typename T, template< typename Q > class DELEGATE>
DataReader& dds::sub::DataReader< T, DELEGATE >::default_filter_state ( const dds::sub::status::DataState &  state)

Set the default state filter for read/take operations.

Parameters
statethe state mask that will be used to read/take samples.
template<typename T, template< typename Q > class DELEGATE>
dds::topic::TopicInstance<T> dds::sub::DataReader< T, DELEGATE >::key_value ( const dds::core::InstanceHandle h)

This operation can be used to retrieve the instance key that corresponds to an instance_handle. The operation will only fill the fields that form the key inside the key_holder instance. This operation may raise a BadParameter exception if the InstanceHandle does not correspond to an existing data-object known to the DataWriter. If the implementation is not able to check invalid handles, then the result in this situation is unspecified.

template<typename T, template< typename Q > class DELEGATE>
T& dds::sub::DataReader< T, DELEGATE >::key_value ( T &  sample,
const dds::core::InstanceHandle h 
)

This operation can be used to retrieve the instance key that corresponds to an instance_handle. The operation will only fill the fields that form the key inside the key_holder instance. This operation may raise a BadParameter exception if the InstanceHandle does not correspond to an existing data-object known to the DataWriter. If the implementation is not able to check invalid handles, then the result in this situation is unspecified.

template<typename T, template< typename Q > class DELEGATE>
void dds::sub::DataReader< T, DELEGATE >::listener ( Listener the_listener,
const dds::core::status::StatusMask event_mask 
)

Set/Re-set the listener associated with this reader.

Parameters
the_listenerthe listener.
event_maskthe event mask associated with the listener.
template<typename T, template< typename Q > class DELEGATE>
Listener* dds::sub::DataReader< T, DELEGATE >::listener ( ) const

Get the listener associated with this reader.

template<typename T, template< typename Q > class DELEGATE>
const dds::core::status::LivelinessChangedStatus& dds::sub::DataReader< T, DELEGATE >::liveliness_changed_status ( ) const
template<typename T, template< typename Q > class DELEGATE>
const dds::core::InstanceHandle dds::sub::DataReader< T, DELEGATE >::lookup_instance ( const T &  key) const

This operation takes as a parameter an instance and returns a handle that can be used in subsequent operations that accept an instance handle as an argument. The instance parameter is only used for the purpose of examining the fields that define the key. This operation does not register the instance in question. If the instance has not been previously registered, or if for any other reason the Service is unable to provide an instance handle, the Service will return a TopicInstance whose handle will be set to the HANDLE_NIL value.

template<typename T, template< typename Q > class DELEGATE>
DataReader& dds::sub::DataReader< T, DELEGATE >::operator<< ( const dds::sub::qos::DataReaderQos the_qos)

Get the QoS associated with this reader.

template<typename T, template< typename Q > class DELEGATE>
DataReader& dds::sub::DataReader< T, DELEGATE >::operator>> ( dds::sub::LoanedSamples< T > &  ls)

Manipulators are defined externally to make it possible to control whether the streaming operators reads or takes. dr >> read >> loanedSamples; dr >> take >> loanedSamples;

template<typename T, template< typename Q > class DELEGATE>
ManipulatorSelector dds::sub::DataReader< T, DELEGATE >::operator>> ( ManipulatorSelector manipulator)(ManipulatorSelector &)
template<typename T, template< typename Q > class DELEGATE>
template<typename Functor >
ManipulatorSelector dds::sub::DataReader< T, DELEGATE >::operator>> ( Functor  f)
template<typename T, template< typename Q > class DELEGATE>
DataReader& dds::sub::DataReader< T, DELEGATE >::operator>> ( dds::sub::qos::DataReaderQos the_qos)

Set the QoS associated with this reader.

Parameters
the_qosthe new QoS.
template<typename T, template< typename Q > class DELEGATE>
const dds::sub::qos::DataReaderQos& dds::sub::DataReader< T, DELEGATE >::qos ( ) const

Get the QoS associated with this reader.

template<typename T, template< typename Q > class DELEGATE>
void dds::sub::DataReader< T, DELEGATE >::qos ( const dds::sub::qos::DataReaderQos the_qos)

Set the QoS associated with this reader.

Parameters
the_qosthe new QoS.
template<typename T, template< typename Q > class DELEGATE>
LoanedSamples<T> dds::sub::DataReader< T, DELEGATE >::read ( )

Read all samples using the default filter state. The memory used for storing the sample may be loaned by the middleware thus allowing zero copy operations. Implementation should strike to makethis read implementation exception safe.

template<typename T, template< typename Q > class DELEGATE>
template<typename SamplesFWIterator >
uint32_t dds::sub::DataReader< T, DELEGATE >::read ( SamplesFWIterator  sfit,
uint32_t  max_samples 
)

Read up to max_samples samples using the default filter state. The samples are copied into the application provided container using the forward iterator parameter.

Parameters
sfitsamples forward iterator
max_samplesthe maximum number of samples to read
Returns
the number of read samples.
template<typename T, template< typename Q > class DELEGATE>
template<typename SamplesBIIterator >
uint32_t dds::sub::DataReader< T, DELEGATE >::read ( SamplesBIIterator  sbit)

Read all samples available in the reader cache using the default filter state. The samples are copied into the application provided container using a back-inserting iterator. Notice that as a consequence of using a back-inserting iterator, this operation may allocate memory to resize the underlying container.

Parameters
sbitsamples back-inserting iterator.
Returns
the number of read samples.
template<typename T, template< typename Q > class DELEGATE>
const dds::core::status::RequestedDeadlineMissedStatus& dds::sub::DataReader< T, DELEGATE >::requested_deadline_missed_status ( )
template<typename T, template< typename Q > class DELEGATE>
const dds::core::status::RequestedIncompatibleQosStatus& dds::sub::DataReader< T, DELEGATE >::requested_incompatible_qos_status ( ) const
template<typename T, template< typename Q > class DELEGATE>
const dds::core::status::SampleLostStatus& dds::sub::DataReader< T, DELEGATE >::sample_lost_status ( ) const
template<typename T, template< typename Q > class DELEGATE>
const dds::core::status::SampleRejectedStatus& dds::sub::DataReader< T, DELEGATE >::sample_rejected_status ( ) const
template<typename T, template< typename Q > class DELEGATE>
Selector dds::sub::DataReader< T, DELEGATE >::select ( )

Get a Selector to perform complex data selections, such as per-instance selection, content and status filtering.

The selector can be used as follows:

          dr.select()               .instance(handle)               .content(query)               .state(state)            .take(sbit);  

This shows how samples can be taken by selecting a specific instance, then filtering by state and content.

template<typename T, template< typename Q > class DELEGATE>
const dds::sub::Subscriber& dds::sub::DataReader< T, DELEGATE >::subscriber ( ) const

Get the subscriber owning this reader.

template<typename T, template< typename Q > class DELEGATE>
const dds::core::status::SubscriptionMatchedStatus& dds::sub::DataReader< T, DELEGATE >::subscription_matched_status ( ) const
template<typename T, template< typename Q > class DELEGATE>
LoanedSamples<T> dds::sub::DataReader< T, DELEGATE >::take ( )

Take all samples using the default filter state. The memory used for storing the sample may be loaned by the middleware thus allowing zero copy operations. Implementation should strike to make this read implementation exception safe.

template<typename T, template< typename Q > class DELEGATE>
template<typename SamplesFWIterator >
uint32_t dds::sub::DataReader< T, DELEGATE >::take ( SamplesFWIterator  sfit,
uint32_t  max_samples 
)

Take up to max_samples samples using the default filter state. The samples are copied into the application provided container using the forward iterator parameter.

Parameters
sfitsamples forward iterator.
max_samplesthe maximum number of samples to take.
Returns
the number of taken samples.
template<typename T, template< typename Q > class DELEGATE>
template<typename SamplesBIIterator >
uint32_t dds::sub::DataReader< T, DELEGATE >::take ( SamplesBIIterator  sbit)

Take all samples available in the reader cache samples using the default filter state. The samples are copied into the application provided container using a back-inserting iterator. Notice that as a consequence of using a back-inserting iterator, this operation may allocate memory to resize the underlying container.

Parameters
sbitsamples back-inserting iterator.
Returns
the number of taken samples.
template<typename T, template< typename Q > class DELEGATE>
dds::topic::TopicDescription<DataType> dds::sub::DataReader< T, DELEGATE >::topic_description ( ) const

Get the TopicDescription associated with this reader.

template<typename T, template< typename Q > class DELEGATE>
void dds::sub::DataReader< T, DELEGATE >::wait_for_historical_data ( const dds::core::Duration timeout)

Wait for historical data for a given amount of time. This time may be set to infinite.

Parameters
timeoutthe time to wait for historical data.

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