.. _dds_layers_publication_datawriter: DataWriter ========== A ``DataWriter`` is attached to exactly one :ref:`dds_layers_publication_publisher` that acts as a factory. Additionally, each DataWriter is bound to a single :ref:`dds_layers_topic` since its creation. This Topic must exist prior to the creation of the DataWriter, and must be bound to the data type that the DataWriter wants to publish. The effect of creating a new DataWriter in a Publisher for a specific Topic is to initiate a new publication with the name and data type described by the Topic. Once the DataWriter is created, the application can inform of changes in the data value using the ``TypedDataWriter::write`` member function on the DataWriter. These changes will be transmitted to all subscriptions matched with this publication. .. note:: In Safe DDS, the DataWriter write operation shall be done through a ``TypedDatawriter::write`` method. Refer to :ref:`dds_layer_publisher_typedDataWriter` for more information. .. _dds_layers_datawriter_qos: DataWriterQos ------------- ``DataWriterQos`` controls the behavior of the DataWriter. Internally it contains the following :ref:`dds_layers_infrastructure_policies` objects: * ``durability`` as :ref:`durabilityqospolicy` Defines the durability of the DataWriter. * ``deadline`` as :ref:`deadlineqospolicy` Defines the deadline for the DataWriter. * ``liveliness`` as :ref:`livelinessqospolicy` Defines the liveliness of the DataWriter. * ``reliability`` as :ref:`reliabilityqospolicy` Defines the reliability of the DataWriter. * ``history`` as :ref:`historyqospolicy` Defines the history of the DataWriter. * ``resource_limits`` as :ref:`resourcelimitsqospolicy` Defines the resource limits of the DataWriter. * ``wire_protocol_qos`` as :ref:`dds_layers_infrastructure_safedds_policies_datareaderwireprotocolconfigqospolicy` The configuration of the wire protocol. * ``allocations`` as :ref:`dds_layers_infrastructure_safedds_policies_datawriterallocationsqospolicy` Defines the memory configuration of the DataWriter. .. include:: ../../../safety_manual/rules/RULE_MAX_BLOCKING_TIME.inc .. include:: ../../../safety_manual/rules/RULE_DATAWRITER_WIREPROTOCOLCONFIGQOS.inc .. include:: ../../../safety_manual/rules/RULE_PREALLOCMEMORYCONFIG.inc .. note:: Check :ref:`architecture_platform_memory_management` to understand how memory is managed in Safe DDS. Example ^^^^^^^ .. literalinclude:: ../../../code/policies_examples/main.cpp :language: c++ :dedent: 8 :start-after: // DDS_DATAWRITER_QOS :end-before: //! DDS_DATAWRITER_QOS