RTI Connext Modern C++ API  Version 7.0.0
dds::pub::qos::DataWriterQos Class Reference

<<value-type>> Container of the QoS policies that a dds::pub::DataWriter supports More...

#include <dds/pub/qos/DataWriterQos.hpp>

Public Member Functions

 DataWriterQos ()
 Creates a DataWriterQos with the default value for each policy. More...
 
 DataWriterQos (const dds::topic::qos::TopicQos &topic_qos)
 Creates a DataWriterQos with the policies of a given TopicQos. More...
 
DataWriterQosoperator= (const dds::topic::qos::TopicQos &topic_qos)
 Copies into this DataWriterQos those policies that are also in TopicQos. More...
 
template<typename Policy >
const Policy & policy () const
 Gets a QoS policy by const reference. More...
 
template<typename Policy >
Policy & policy ()
 Gets a QoS policy by reference. More...
 
template<typename Policy >
DataWriterQospolicy (const Policy &p)
 Sets a policy. More...
 
template<typename Policy >
DataWriterQosoperator<< (const Policy &p)
 Sets a policy. More...
 
template<typename Policy >
const DataWriterQosoperator>> (Policy &p) const
 Copies the values of a policy. More...
 

Related Functions

(Note that these are not member functions.)

std::string to_string (const DataWriterQos &qos, const rti::core::QosPrintFormat &format=rti::core::QosPrintFormat())
 <<extension>> Obtains a string representation of the dds::pub::qos::DataWriterQos More...
 
std::string to_string (const DataWriterQos &qos, const DataWriterQos &base, const rti::core::QosPrintFormat &format=rti::core::QosPrintFormat())
 <<extension>> Obtains a string representation of the dds::pub::qos::DataWriterQos More...
 
std::string to_string (const DataWriterQos &qos, const rti::core::qos_print_all_t &qos_print_all, const rti::core::QosPrintFormat &format=rti::core::QosPrintFormat())
 <<extension>> Obtains a string representation of the dds::sub::qos::DataWriterQos More...
 
std::ostream & operator<< (std::ostream &out, const rti::pub::qos::DataWriterQos &qos)
 <<extension>> Prints a dds::pub::qos::DataWriterQos to an output stream. More...
 

Detailed Description

<<value-type>> Container of the QoS policies that a dds::pub::DataWriter supports

DataWriterQos policies

A DataWriterQos contains the following policies:

To get or set policies use the policy() getters and setters or operator << (see examples).

You must set certain members in a consistent manner:

- dds::core::policy::History .depth <= dds::core::policy::ResourceLimits .max_samples_per_instance

- dds::core::policy::ResourceLimits .max_samples_per_instance <= dds::core::policy::ResourceLimits .max_samples

- dds::core::policy::ResourceLimits .initial_samples <= dds::core::policy::ResourceLimits .max_samples

- dds::core::policy::ResourceLimits .initial_instances <= dds::core::policy::ResourceLimits .max_instances

- length of dds::core::policy::UserData .value <= dds::domain::qos::DomainParticipantQos::resource_limits .writer_user_data_max_length

If any of the above are not true, dds::pub::DataWriter::qos(const dds::pub::qos::DataWriterQos&) and dds::pub::Publisher::default_datawriter_qos(const dds::pub::qos::DataWriterQos&) will fail with dds::core::InconsistentPolicyError and the dds::pub::DataWriter constructors will fail with dds::core::Error

Entity:
dds::pub::DataWriter
See also
QoS Policies allowed ranges within each Qos.
Qos Use Cases

Constructor & Destructor Documentation

◆ DataWriterQos() [1/2]

dds::pub::qos::DataWriterQos::DataWriterQos ( )

Creates a DataWriterQos with the default value for each policy.

Note
If you configure Qos in XML, obtain the default value from the default QosProvider, since it can be overriden by configuration:

◆ DataWriterQos() [2/2]

dds::pub::qos::DataWriterQos::DataWriterQos ( const dds::topic::qos::TopicQos topic_qos)

Creates a DataWriterQos with the policies of a given TopicQos.

The QoS policies that are exclusive to a DataWriter retain their default values. A dds::topic::qos::TopicQos contains a subset of the policies of a DataWriterQos. This constructor copies those common policies while initializing the policies that are only defined in DataWriterQos to their default values.

Parameters
topic_qosThe TopicQos being copied.

Example:

DataWriterQos writer_qos(topic.qos());

Member Function Documentation

◆ operator=()

DataWriterQos& dds::pub::qos::DataWriterQos::operator= ( const dds::topic::qos::TopicQos topic_qos)
inline

Copies into this DataWriterQos those policies that are also in TopicQos.

A dds::topic::qos::TopicQos contains a subset of the policies of a DataWriterQos. This assignment operator copies those common policies into this instance while leaving the policies that are only defined in DataWriterQos unaltered.

Parameters
topic_qosThe TopicQos to copy the common policies from.

For example:

// Load a TopicQos from a Qos profile
TopicQos topic_qos = dds::core::QosProvider::Default().topic_qos("MyLibrary::MyProfile");
// Create a DataWriterQos with the default policies
// Overwrite the policies that are also defined in topic_qos
writer_qos = topic_qos;

◆ policy() [1/3]

template<typename Policy >
const Policy& dds::pub::qos::DataWriterQos::policy ( ) const

Gets a QoS policy by const reference.

Template Parameters
PolicyOne of the DataWriterQos policies
See also
Setting Qos Values

◆ policy() [2/3]

template<typename Policy >
Policy& dds::pub::qos::DataWriterQos::policy ( )

Gets a QoS policy by reference.

Template Parameters
PolicyOne of the DataWriterQos policies
See also
Setting Qos Values

◆ policy() [3/3]

template<typename Policy >
DataWriterQos& dds::pub::qos::DataWriterQos::policy ( const Policy &  p)
inline

Sets a policy.

See also
policy()
Setting Qos Values

◆ operator<<()

template<typename Policy >
DataWriterQos& dds::pub::qos::DataWriterQos::operator<< ( const Policy &  p)
inline

Sets a policy.

See also
policy()
Setting Qos Values

◆ operator>>()

template<typename Policy >
const DataWriterQos& dds::pub::qos::DataWriterQos::operator>> ( Policy &  p) const
inline

Copies the values of a policy.

Parameters
pThe destination where to copy the current value of the Policy
See also
policy()
Setting Qos Values

Friends And Related Function Documentation

◆ to_string() [1/3]

std::string to_string ( const DataWriterQos qos,
const rti::core::QosPrintFormat format = rti::core::QosPrintFormat() 
)
related

<<extension>> Obtains a string representation of the dds::pub::qos::DataWriterQos

Parameters
qosThe qos object to convert to a string
formatThe optional print format used to format the output string.

The several to_string overloads allow formatting the output and printing only the differences with respect to another Qos object.

// When no QosPrintFormat is supplied, the default is used. Similarly, since
// no base profile has been specified we will only print the differences
// with respect to the documented default for DataWriterQos
// In this overload we are specifying the print format used to format the output
// string.
QosPrintFormat format; // ...;
str = to_string(qos, format);
// Here, the differences between qos and base will be included in the output
// string. If the two qos objects are the same, the resulting string will
// be empty.
DataWriterQos base; // ...;
str = to_string(qos, base);
// We could also specify the format at this point
str = to_string(qos, base, format);
// Instead of supplying a base profile, the sentinel value qos_print_all can
// be supplied. This will result in the entire Qos object being printed (as
// opposed to only the differences with respect to a base qos).

This overload uses the default print format and only prints the differences between qos and the documented default.

Returns
The string representation of the qos

◆ to_string() [2/3]

std::string to_string ( const DataWriterQos qos,
const DataWriterQos base,
const rti::core::QosPrintFormat format = rti::core::QosPrintFormat() 
)
related

<<extension>> Obtains a string representation of the dds::pub::qos::DataWriterQos

Parameters
qosThe qos object to convert to a string
baseThe base qos. Only the differences between base and qos are included in the output string. If you want to print everything within the QoS, use the overload that accepts a rti::core::qos_print_all_t.
formatThe optional print format used to format the output string.

This overload prints the differences between qos and base. If no print format is specified, the default will be used.

Returns
The string representation of the qos

◆ to_string() [3/3]

std::string to_string ( const DataWriterQos qos,
const rti::core::qos_print_all_t qos_print_all,
const rti::core::QosPrintFormat format = rti::core::QosPrintFormat() 
)
related

<<extension>> Obtains a string representation of the dds::sub::qos::DataWriterQos

Parameters
qosThe qos object to convert to a string
qos_print_allThe sentinel value indicating that the entire QoS should be converted to a string. The other overloads of this API only print the differences with respect to a base profile, or to the documented default.
formatThe optional print format used to format the output string.

This overload prints all of the policies within qos. If no print format is specified, the default will be used.

The only valid value for the qos_print_all argument is rti::core::qos_print_all

For example:

Returns
The string representation of the qos

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const rti::pub::qos::DataWriterQos &  qos 
)
related

<<extension>> Prints a dds::pub::qos::DataWriterQos to an output stream.