User Tools

Site Tools


Sidebar

Welcome to DDS Foundation WIKI

ddsf:public:guidebook:06_append:glossary:d:data_writer

This is an old revision of the document!


Data Writer

DataWriter objects are responsible for sending type-specific data to one or more DataReaders.

A DataWriter is created with a Topic, which gives a name to the data stream and associates the DataWriter with a data type. A DataWriter sends data to one or more DataReaders if the DataWriter and DataReader(s):

  • have Topics with the same name
  • have data types that are assignable to each other (not necessarily identical)
  • are within the same domain
  • have compatible QoS
  • can be discovered and communicate with each other over one or more transports

The behavior of a DataWriter is controlled by QoS. For example, a DataWriter can be made reliable by configuring its RELIABILITY QoS. A DataWriter provides asynchronous notifications in the form of Status Changes.

There are two types of objects that can be referred to as DataWriters: DDS DataWriter objects and type-specific DataWriter objects (usually called FooDataWriter to indicate a user data type “Foo”).

The DDS::DataWriter object is used for actions that are not specific to a single data type, such as configuring QoS or installing listeners. The type-specific FooDataWriter object is used for actions that involve the specific data type, such as writing data or unregistering/disposing of an instance.

For example, when writing data, you must use a type-specific DataWriter, rather than the generic DataWriter class:

Example of using a DDS DataWriter

// Create the DDS::DataWriter.  This object can be used for configuring QoS,
// asserting liveliness, or other non-type specific actions.
DDS::DataWriter *ddsWriter 
  = publisher->create_datawriter
      ( medicalDataTopic, 
        qos, 
        listener,
        DDS_STATUS_MASK_ALL
      ); 
// Create the type-specific DataWriter.  This object can be used for writing data,
// disposing a data-instance, or other actions that are specific to a data type 
MedicalDeviceDataWriter *medicalDataWriter 
  = MedicalDeviceDataWriter::narrow(ddsWriter); 
medicalDataWriter->write(deviceData, ...);
ddsf/public/guidebook/06_append/glossary/d/data_writer.1557710157.txt.gz · Last modified: 2019/05/12 21:15 by admin