To create a DataWriter, you need a DomainParticipant and a Topic.
You need a DataWriter for each Topic that you want to publish. Once you have a DataWriter, you can use it to perform the operations listed in Table 3 . The most important operation is write(), described in Writing Data. For more details on all operations, see the API Reference HTML documentation.
DataWriters are created by using operations on a DomainParticipant or a Publisher, as described in Creating DataWriters. If you use the DomainParticipant’s operations, the DataWriter will belong to an implicit Publisher that is automatically created by the middleware. If you use a Publisher’s operations, the DataWriter will belong to that Publisher. So either way, the DataWriter belongs to a Publisher.
Note: Some operations cannot be used within a listener callback, see Restricted Operations in Listener Callbacks.
Working with ... |
Operation |
Description |
Reference |
DataWriters |
assert_liveliness |
Manually asserts the liveliness of the DataWriter. |
|
enable |
Enables the DataWriter. |
||
equals |
Compares two DataWriter’s QoS structures for equality. |
||
get_qos |
Gets the QoS. |
||
lookup_instance |
Gets a handle, given an instance. (Useful for keyed data types only.) |
||
set_qos |
Modifies the QoS. |
||
set_qos_with_profile |
Modifies the QoS based on a QoS profile. |
||
get_listener |
Gets the currently installed Listener. |
||
set_listener |
Replaces the Listener. |
||
FooData-Writer |
dispose |
States that the instance no longer exists. (Useful for keyed data types only.) |
|
dispose_w_timestamp |
Same as dispose, but allows the application to override the automatic source_timestamp. (Useful for keyed data types only.) |
||
flush |
Makes the batch available to be sent on the network. |
||
get_key_value |
Maps an instance_handle to the corresponding key. |
||
narrow |
A type-safe way to cast a pointer. This takes a DDSDataWriter pointer and ‘narrows’ it to a ‘FooDataWriter’ where ‘Foo’ is the related data type. |
||
register_instance |
States the intent of the DataWriter to write values of the data-instance that matches a specified key. Improves the performance of subsequent writes to the instance. (Useful for keyed data types only.) |
||
register_instance_w_ |
Like register_instance, but allows the application to override the automatic source_timestamp. (Useful for keyed data types only.) |
||
unregister_instance |
Reverses register_instance. Relinquishes the ownership of the instance. (Useful for keyed data types only.) |
||
unregister_instance_w_ |
Like unregister_instance, but allows the application to override the automatic source_timestamp. (Useful for keyed data types only.) |
||
write |
Writes a new value for a data-instance. |
||
write_w_timestamp |
Same as write, but allows the application to override the automatic source_timestamp. |
||
FooData-Writer |
write_w_params |
Same as write, but allows the application to specify parameters such as source timestamp and instance handle. |
|
dispose_w_params |
Same as dispose, but allows the application to specify parameters such as source timestamp and instance handle.. |
||
register_w_params |
Same as register, but allows the application to specify parameters such as source timestamp, instance handle. |
||
unregister_w_params |
Same as unregister, but allows the application to specify parameters such as source timestamp, and instance handle. |
||
Matched Subscriptions |
get_matched_ |
Gets a list of subscriptions that have a matching Topic and compatible QoS. These are the subscriptions currently associated with the DataWriter. |
|
get_matched_ |
Gets information on a subscription with a matching Topic and compatible QoS. |
||
get_matched_ |
Gets a list of locators for subscriptions that have a matching Topic and compatible QoS. These are the subscriptions currently associated with the DataWriter. |
||
get_matched_ |
Gets information about the DomainParticipant of a matching subscription. |
Finding the Matching Subscription’s ParticipantBuiltinTopicData |
|
Status |
get_status_changes |
Gets a list of statuses that have changed since the last time the application read the status or the listeners were called. |
|
get_liveliness_lost_status |
Gets LIVELINESS_LOST status. |
||
get_offered_deadline_ |
Gets OFFERED_DEADLINE_MISSED status. |
||
get_offered_ |
Gets OFFERED_INCOMPATIBLE_QOS status. |
||
get_publication_match_ |
Gets PUBLICATION_MATCHED_QOS status. |
||
get_reliable_writer_ |
Gets RELIABLE_WRITER_CACHE_CHANGED |
||
get_reliable_reader_ |
Gets RELIABLE_READER_ACTIVITY_CHANGED status |
||
get_datawriter_cache_ |
Gets DATA_WRITER_CACHE_status |
||
get_datawriter_protocol_status |
Gets DATA_WRITER_PROTOCOL status |
||
get_matched_ |
Gets DATA_WRITER_PROTOCOL status for this DataWriter, per matched subscription identified by the subscription_handle. |
||
get_matched_ |
Gets DATA_WRITER_PROTOCOL status for this DataWriter, per matched subscription as identified by a locator. |
||
Other |
get_publisher |
Gets the Publisher to which the DataWriter belongs. |
|
get_topic |
Get the Topic associated with the DataWriter. |
||
wait_for_ |
Blocks the calling thread until either all data written by the DataWriter is acknowledged by all matched Reliable DataReaders, or until the a specified timeout duration, max_wait, elapses. |
© 2015 RTI