CoreDX DDS Modern C++ API
Public Member Functions | List of all members
dds::pub::DataWriter< T > Class Template Reference

Type specific DataWriter. More...

Inheritance diagram for dds::pub::DataWriter< T >:
Inheritance graph
[legend]
Collaboration diagram for dds::pub::DataWriter< T >:
Collaboration graph
[legend]

Public Member Functions

 DataWriter (const dds::pub::Publisher &pub, const dds::topic::Topic< T > &topic)
 Create a DataWriter. More...
 
 DataWriter (const dds::pub::Publisher &pub, const dds::topic::Topic< T > &topic, const dds::pub::qos::DataWriterQos &qos, dds::pub::DataWriterListener< T > *listener=NULL, const dds::core::status::StatusMask &mask=dds::core::status::StatusMask::none())
 Create a DataWriter. More...
 
void write (const T &sample)
 Write a sample. More...
 
void write (const T &sample, const dds::core::Time &timestamp)
 Write a sample with a given timestamp. More...
 
void write (const T &data, const dds::core::InstanceHandle &instance)
 Write a sample by providing the instance handle. More...
 
void write (const T &data, const dds::core::InstanceHandle &instance, const dds::core::Time &timestamp)
 Write a sample, with a time-stamp, by providing the instance handle. More...
 
void write (const dds::topic::TopicInstance< T > &i)
 Write a topic instance – a class that encapsulate the sample and its associated instance handle. More...
 
void write (const dds::topic::TopicInstance< T > &i, const dds::core::Time &timestamp)
 Write a topic instance with time stamp. More...
 
template<typename FWIterator >
void write (const FWIterator &begin, const FWIterator &end)
 Write a series of samples or TopicInstances (determined by the template specialization).
 
template<typename FWIterator >
void write (const FWIterator &begin, const FWIterator &end, const dds::core::Time &timestamp)
 Write a series of samples or TopicInstances (determined by the template specialization) with timestamp.
 
template<typename SamplesFWIterator , typename HandlesFWIterator >
void write (const SamplesFWIterator &data_begin, const SamplesFWIterator &data_end, const HandlesFWIterator &handle_begin, const HandlesFWIterator &handle_end)
 Write a series of samples and their parallel instance handles.
 
template<typename SamplesFWIterator , typename HandlesFWIterator >
void write (const SamplesFWIterator &data_begin, const SamplesFWIterator &data_end, const HandlesFWIterator &handle_begin, const HandlesFWIterator &handle_end, const dds::core::Time &timestamp)
 Write a series of samples and their parallel instance handles with a timestamp.
 
const dds::core::InstanceHandle register_instance (const T &key)
 Register an instance. More...
 
const dds::core::InstanceHandle register_instance (const T &key, const dds::core::Time &ts)
 Register an instance with timestamp. More...
 
DataWriterunregister_instance (const dds::core::InstanceHandle &i)
 Unregister an instance. More...
 
DataWriterunregister_instance (const dds::core::InstanceHandle &i, const dds::core::Time &ts)
 Unregister an instance with timestamp. More...
 
DataWriterdispose_instance (const dds::core::InstanceHandle &i)
 Dispose an instance. More...
 
DataWriterdispose_instance (const dds::core::InstanceHandle &i, const dds::core::Time &ts)
 Dispose an instance with a timestamp. More...
 
dds::topic::TopicInstance< T > & key_value (dds::topic::TopicInstance< T > &i, const dds::core::InstanceHandle &h)
 This operation can be used to retrieve the instance key that corresponds to an instance_handle. More...
 
T & 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. More...
 
dds::core::InstanceHandle lookup_instance (const T &key)
 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. More...
 
DataWriteroperator<< (const dds::pub::qos::DataWriterQos &qos)
 This operation replaces the existing set of QosPolicy settings for a DataWriter. More...
 
const dds::topic::Topic< T > & topic () const
 Get the Topic associated with this DataWriter
 
void listener (DataWriterListener< T > *the_listener, const dds::core::status::StatusMask &mask)
 By virtue of extending Entity, a DataWriter can be attached to a Listener at creation time or later by using the listener operation. More...
 
DataWriterListener< T > * listener () const
 Return the listener currently associated with this DataWriter. More...
 
- Public Member Functions inherited from dds::pub::AnyDataWriter
const dds::pub::Publisherpublisher () const
 Get the Publisher that owns this DataWriter. More...
 
const dds::topic::TopicDescriptiontopic_description () const
 Get the TopicDescription associated with this DataWriter. More...
 
dds::pub::qos::DataWriterQos qos () const
 Gets the DataWriterQos setting for this instance. More...
 
void qos (const dds::pub::qos::DataWriterQos &qos)
 This operation replaces the existing set of QosPolicy settings for a DataWriter. More...
 
AnyDataWriteroperator<< (const dds::pub::qos::DataWriterQos &qos)
 This operation replaces the existing set of QosPolicy settings for a DataWriter. More...
 
const AnyDataWriteroperator>> (dds::pub::qos::DataWriterQos &qos) const
 Gets the DataWriterQos setting for this instance. More...
 
void wait_for_acknowledgments (const dds::core::Duration &timeout)
 This operation blocks the calling thread until either all data written by the DataWriter is acknowledged by the local infrastructure, or until the duration specified by the timeout parameter elapses, whichever happens first. More...
 
const dds::core::status::LivelinessLostStatus liveliness_lost_status ()
 This operation obtains the LivelinessLostStatus object of the DataWriter. More...
 
const dds::core::status::OfferedDeadlineMissedStatus offered_deadline_missed_status ()
 This operation obtains the OfferedDeadlineMissedStatus object of the DataWriter. More...
 
const dds::core::status::OfferedIncompatibleQosStatus offered_incompatible_qos_status ()
 This operation obtains the OfferedIncompatibleQosStatus object of the DataWriter. More...
 
const dds::core::status::PublicationMatchedStatus publication_matched_status ()
 This operation obtains the PublicationMatchedStatus object of the DataWriter. More...
 
void assert_liveliness ()
 This operation asserts the liveliness for the DataWriter. More...
 

Detailed Description

template<typename T>
class dds::pub::DataWriter< T >

Type specific DataWriter.

Constructor & Destructor Documentation

◆ DataWriter() [1/2]

template<typename T , template< typename Q > class DELEGATE>
dds::pub::DataWriter< T, DELEGATE >::DataWriter ( const dds::pub::Publisher pub,
const dds::topic::Topic< T > &  topic 
)

Create a DataWriter.

The QoS will be set to pub.default_datawriter_qos().

Parameters
pubthe publisher
topicthe Topic associated with this DataWriter

◆ DataWriter() [2/2]

template<typename T , template< typename Q > class DELEGATE>
dds::pub::DataWriter< T, DELEGATE >::DataWriter ( const dds::pub::Publisher pub,
const dds::topic::Topic< T > &  topic,
const dds::pub::qos::DataWriterQos qos,
dds::pub::DataWriterListener< T > *  listener = NULL,
const dds::core::status::StatusMask mask = dds::core::status::StatusMask::none() 
)

Create a DataWriter.

Parameters
pubthe publisher
topicthe Topic associated with this DataWriter
qosthe DataWriter qos.
listenerthe DataWriter listener.
maskthe listener event mask.

Member Function Documentation

◆ dispose_instance() [1/2]

template<typename T , template< typename Q > class DELEGATE>
DataWriter< T, DELEGATE > & dds::pub::DataWriter< T, DELEGATE >::dispose_instance ( const dds::core::InstanceHandle i)

Dispose an instance.

Parameters
ithe instance to dispose.

◆ dispose_instance() [2/2]

template<typename T , template< typename Q > class DELEGATE>
DataWriter< T, DELEGATE > & dds::pub::DataWriter< T, DELEGATE >::dispose_instance ( const dds::core::InstanceHandle i,
const dds::core::Time ts 
)

Dispose an instance with a timestamp.

Parameters
ithe instance to dispose.
tsthe timestamp.

◆ key_value() [1/2]

template<typename T , template< typename Q > class DELEGATE>
dds::topic::TopicInstance< T > & dds::pub::DataWriter< T, DELEGATE >::key_value ( dds::topic::TopicInstance< T > &  i,
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.

◆ key_value() [2/2]

template<typename T , template< typename Q > class DELEGATE>
T & dds::pub::DataWriter< 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.

◆ listener() [1/2]

template<typename T , template< typename Q > class DELEGATE>
void dds::pub::DataWriter< T, DELEGATE >::listener ( DataWriterListener< T > *  the_listener,
const dds::core::status::StatusMask mask 
)

By virtue of extending Entity, a DataWriter can be attached to a Listener at creation time or later by using the listener operation.

The attached Listener must be a DataWriterListener.

Parameters
the_listenerthe data writer listener
maskthe event mask associated with this listener.

◆ listener() [2/2]

template<typename T , template< typename Q > class DELEGATE>
DataWriterListener< T > * dds::pub::DataWriter< T, DELEGATE >::listener ( ) const

Return the listener currently associated with this DataWriter.

Returns
the DataWriterListener.

◆ lookup_instance()

template<typename T , template< typename Q > class DELEGATE>
dds::core::InstanceHandle dds::pub::DataWriter< T, DELEGATE >::lookup_instance ( const T &  key)

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.

◆ operator<<()

template<typename T , template< typename Q > class DELEGATE>
DataWriter< T, DELEGATE > & dds::pub::DataWriter< T, DELEGATE >::operator<< ( const dds::pub::qos::DataWriterQos qos)

This operation replaces the existing set of QosPolicy settings for a DataWriter.

The parameter qos contains the object with the QosPolicy settings which is checked for self-consistency and mutability.

When the application tries to change a QosPolicy setting for an enabled DataWriter, which can only be set before the DataWriter is enabled, the operation will fail and a ImmutablePolicyError is thrown. In other words, the application must provide the presently set QosPolicy settings in case of the immutable QosPolicy settings. Only the mutable QosPolicy settings can be changed.

When the qos contains conflicting QosPolicy settings (not self-consistent), the operation will fail and an InconsistentPolicyError is thrown.

Parameters
qosthe qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.
dds::core::ImmutablePolicyErrorThe parameter qos contains an immutable QosPolicy setting with a different value than set during enabling of the DataWriter.
dds::core::InconsistentPolicyErrorThe parameter qos contains conflicting QosPolicy settings,

◆ register_instance() [1/2]

template<typename T , template< typename Q > class DELEGATE>
const dds::core::InstanceHandle dds::pub::DataWriter< T, DELEGATE >::register_instance ( const T &  key)

Register an instance.

Parameters
keythe key of the instance to register.

◆ register_instance() [2/2]

template<typename T , template< typename Q > class DELEGATE>
const dds::core::InstanceHandle dds::pub::DataWriter< T, DELEGATE >::register_instance ( const T &  key,
const dds::core::Time ts 
)

Register an instance with timestamp.

Parameters
keythe key of the instance to register.
tsthe timestamp used for registration.

◆ unregister_instance() [1/2]

template<typename T , template< typename Q > class DELEGATE>
DataWriter< T, DELEGATE > & dds::pub::DataWriter< T, DELEGATE >::unregister_instance ( const dds::core::InstanceHandle i)

Unregister an instance.

Parameters
ithe instance to unregister.

◆ unregister_instance() [2/2]

template<typename T , template< typename Q > class DELEGATE>
DataWriter< T, DELEGATE > & dds::pub::DataWriter< T, DELEGATE >::unregister_instance ( const dds::core::InstanceHandle i,
const dds::core::Time ts 
)

Unregister an instance with timestamp.

Parameters
ithe instance to unregister.
tsthe timestamp used for registration.

◆ write() [1/6]

template<typename T , template< typename Q > class DELEGATE>
void dds::pub::DataWriter< T, DELEGATE >::write ( const T &  sample)

Write a sample.

Parameters
samplethe sample to be written.

◆ write() [2/6]

template<typename T , template< typename Q > class DELEGATE>
void dds::pub::DataWriter< T, DELEGATE >::write ( const T &  sample,
const dds::core::Time timestamp 
)

Write a sample with a given timestamp.

Parameters
samplethe sample to be written.
timestampthe timestamp used for this sample.

◆ write() [3/6]

template<typename T , template< typename Q > class DELEGATE>
void dds::pub::DataWriter< T, DELEGATE >::write ( const T &  data,
const dds::core::InstanceHandle instance 
)

Write a sample by providing the instance handle.

This is usually the most efficint way of writing a sample.

Parameters
datathe sample to be written.
instancethe handle representing the instance written.

◆ write() [4/6]

template<typename T , template< typename Q > class DELEGATE>
void dds::pub::DataWriter< T, DELEGATE >::write ( const T &  data,
const dds::core::InstanceHandle instance,
const dds::core::Time timestamp 
)

Write a sample, with a time-stamp, by providing the instance handle.

This is usually the most efficient way of writing a sample.

Parameters
datathe sample to be written.
instancethe handle representing the instance written.
timestampthe timestamp to use for this sample.

◆ write() [5/6]

template<typename T , template< typename Q > class DELEGATE>
void dds::pub::DataWriter< T, DELEGATE >::write ( const dds::topic::TopicInstance< T > &  i)

Write a topic instance – a class that encapsulate the sample and its associated instance handle.

Parameters
ithe instance to write.

◆ write() [6/6]

template<typename T , template< typename Q > class DELEGATE>
void dds::pub::DataWriter< T, DELEGATE >::write ( const dds::topic::TopicInstance< T > &  i,
const dds::core::Time timestamp 
)

Write a topic instance with time stamp.

Parameters
ithe instance to write.
timestampthe timestamp for this sample.

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