RTI Connext Modern C++ API  Version 6.1.0
rti::core::policy::AsynchronousPublisher Class Reference

<<extension>> Configures the mechanism to publish data using a separate thread More...

#include <rti/core/policy/CorePolicy.hpp>

Public Member Functions

 AsynchronousPublisher ()
 Creates the default policy. More...
 
AsynchronousPublisherdisable_asynchronous_write (bool the_disable_asynchronous_write)
 Disable asynchronous publishing. More...
 
bool disable_asynchronous_write () const
 Getter (see setter with the same name) More...
 
AsynchronousPublisherthread (const rti::core::ThreadSettings &the_thread)
 Settings of the publishing thread. More...
 
const rti::core::ThreadSettingsthread () const
 Getter (see setter with the same name) More...
 
rti::core::ThreadSettingsthread ()
 Getter (see setter with the same name) More...
 
AsynchronousPublisherdisable_asynchronous_batch (bool the_disable_asynchronous_batch)
 Disable asynchronous batch flushing. More...
 
bool disable_asynchronous_batch () const
 Getter (see setter with the same name) More...
 
AsynchronousPublisherasynchronous_batch_thread (const rti::core::ThreadSettings &the_asynchronous_batch_thread)
 Settings of the batch flushing thread. More...
 
const rti::core::ThreadSettingsasynchronous_batch_thread () const
 Getter (see setter with the same name) More...
 
rti::core::ThreadSettingsasynchronous_batch_thread ()
 Getter (see setter with the same name) More...
 
AsynchronousPublisherdisable_topic_query_publication (bool the_disable_topic_query_publication)
 Disable topic query publication. More...
 
bool disable_topic_query_publication () const
 Getter (see setter with the same name) More...
 
AsynchronousPublishertopic_query_publication_thread (const rti::core::ThreadSettings &the_topic_query_publication_thread)
 Settings of the rti::sub::TopicQuery publication thread. More...
 
const rti::core::ThreadSettingstopic_query_publication_thread () const
 Getter (see setter with the same name) More...
 
rti::core::ThreadSettingstopic_query_publication_thread ()
 Getter (see setter with the same name) More...
 

Static Public Member Functions

static AsynchronousPublisher Enabled (bool enable_async_batch=false)
 Returns a policy that enables asynchronous write and optionally asynchronous batch flushing. More...
 
static AsynchronousPublisher Disabled ()
 Creates a policy that disables asynchronous writing. More...
 

Detailed Description

<<extension>> Configures the mechanism to publish data using a separate thread

Specifies the asynchronous publishing and asynchronous batch flushing settings of the dds::pub::Publisher instances.

The QoS policy specifies whether asynchronous publishing and asynchronous batch flushing are enabled for the dds::pub::DataWriter entities belonging to this dds::pub::Publisher. If so, the publisher will spawn up to two threads, one for asynchronous publishing and one for asynchronous batch flushing.

This policy also configures the settings of the rti::sub::TopicQuery publication thread. The publisher will spawn this thread only if one or more DataWriters enable TopicQueries.

See also
rti::core::policy::Batch.
rti::core::policy::PublishMode.
Entity:
dds::pub::Publisher
Properties:
RxO = N/A

Changeable = NO

Usage

You can use this QoS policy to reduce the amount of time your application thread spends sending data.

You can also use it, along with rti::core::policy::PublishMode and a rti::pub::FlowController, to send large data reliably. "Large" in this context means that the data that cannot be sent as a single packet by a network transport. For example, to send data larger than 63K reliably using UDP/IP, you must configure RTI Connext to fragment the data and send it asynchronously.

The asynchronous publisher thread is shared by all rti::core::policy::PublishModeKind_def::ASYNCHRONOUS dds::pub::DataWriter instances that belong to this publisher and handles their data transmission chores.

The asynchronous batch flushing thread is shared by all dds::pub::DataWriter instances with batching enabled that belong to this publisher.

This QoS policy also allows you to adjust the settings of the asynchronous publishing and the asynchronous batch flushing threads. To use different threads for two different dds::pub::DataWriter entities, the instances must belong to different dds::pub::Publisher instances.

A dds::pub::Publisher must have asynchronous publishing enabled for its dds::pub::DataWriter instances to write asynchronously.

A dds::pub::Publisher must have asynchronous batch flushing enabled in order to flush the batches of its dds::pub::DataWriter instances asynchronously. However, no asynchronous batch flushing thread will be started until the first dds::pub::DataWriter instance with batching enabled is created from this dds::pub::Publisher.

Constructor & Destructor Documentation

◆ AsynchronousPublisher()

rti::core::policy::AsynchronousPublisher::AsynchronousPublisher ( )
inline

Creates the default policy.

Member Function Documentation

◆ disable_asynchronous_write() [1/2]

AsynchronousPublisher& rti::core::policy::AsynchronousPublisher::disable_asynchronous_write ( bool  the_disable_asynchronous_write)

Disable asynchronous publishing.

If set to true, any dds::pub::DataWriter created with rti::core::policy::PublishModeKind_def::ASYNCHRONOUS will fail with dds::core::InconsistentPolicyError.

[default] false

◆ disable_asynchronous_write() [2/2]

bool rti::core::policy::AsynchronousPublisher::disable_asynchronous_write ( ) const

Getter (see setter with the same name)

◆ thread() [1/3]

AsynchronousPublisher& rti::core::policy::AsynchronousPublisher::thread ( const rti::core::ThreadSettings the_thread)

Settings of the publishing thread.

There is only one asynchronous publishing thread per dds::pub::Publisher.

[default] priority below normal.
The actual value depends on your architecture:

For Windows: -2
For Linux: OS default priority
For a complete list of platform specific values, please refer to Platform Notes.

[default] The actual value depends on your architecture:

For Windows: OS default stack size
For Linux: OS default stack size
For a complete list of platform specific values, please refer to Platform Notes.

[default] mask = rti::core::ThreadSettingsKindMask::ThreadSettingsKindMask()

◆ thread() [2/3]

const rti::core::ThreadSettings& rti::core::policy::AsynchronousPublisher::thread ( ) const

Getter (see setter with the same name)

◆ thread() [3/3]

rti::core::ThreadSettings& rti::core::policy::AsynchronousPublisher::thread ( )

Getter (see setter with the same name)

◆ disable_asynchronous_batch() [1/2]

AsynchronousPublisher& rti::core::policy::AsynchronousPublisher::disable_asynchronous_batch ( bool  the_disable_asynchronous_batch)

Disable asynchronous batch flushing.

If set to true, any dds::pub::DataWriter created with batching enabled will fail with dds::core::InconsistentPolicyError.

If rti::core::policy::Batch::max_flush_delay is different than dds::core::Duration::infinite(), rti::core::policy::AsynchronousPublisher::disable_asynchronous_batch must be set false.

[default] false

◆ disable_asynchronous_batch() [2/2]

bool rti::core::policy::AsynchronousPublisher::disable_asynchronous_batch ( ) const

Getter (see setter with the same name)

◆ asynchronous_batch_thread() [1/3]

AsynchronousPublisher& rti::core::policy::AsynchronousPublisher::asynchronous_batch_thread ( const rti::core::ThreadSettings the_asynchronous_batch_thread)

Settings of the batch flushing thread.

There is only one asynchronous batch flushing thread per dds::pub::Publisher.

[default] priority below normal.
The actual value depends on your architecture:

For Windows: -2
For Linux: OS default priority
For a complete list of platform specific values, please refer to Platform Notes. [default] The actual value depends on your architecture:

For Windows: OS default stack size
For Linux: OS default stack size
For a complete list of platform specific values, please refer to Platform Notes.

[default] mask = rti::core::ThreadSettingsKindMask::ThreadSettingsKindMask()

◆ asynchronous_batch_thread() [2/3]

const rti::core::ThreadSettings& rti::core::policy::AsynchronousPublisher::asynchronous_batch_thread ( ) const

Getter (see setter with the same name)

◆ asynchronous_batch_thread() [3/3]

rti::core::ThreadSettings& rti::core::policy::AsynchronousPublisher::asynchronous_batch_thread ( )

Getter (see setter with the same name)

◆ disable_topic_query_publication() [1/2]

AsynchronousPublisher& rti::core::policy::AsynchronousPublisher::disable_topic_query_publication ( bool  the_disable_topic_query_publication)

Disable topic query publication.

If set to true, any dds::pub::DataWriter created with rti::core::policy::TopicQueryDispatch::enable set to true will fail with dds::core::InconsistentPolicyError.

[default] false

◆ disable_topic_query_publication() [2/2]

bool rti::core::policy::AsynchronousPublisher::disable_topic_query_publication ( ) const

Getter (see setter with the same name)

◆ topic_query_publication_thread() [1/3]

AsynchronousPublisher& rti::core::policy::AsynchronousPublisher::topic_query_publication_thread ( const rti::core::ThreadSettings the_topic_query_publication_thread)

Settings of the rti::sub::TopicQuery publication thread.

There is only one TopicQuery publication thread per dds::pub::Publisher. This thread will exist as long as one or more dds::pub::DataWriter enables TopicQueries (via rti::core::policy::TopicQueryDispatch).

[default] priority below normal.
The actual value depends on your architecture:

For Windows: -2
For Linux: OS default priority
For a complete list of platform specific values, please refer to Platform Notes. [default] The actual value depends on your architecture:

For Windows: OS default stack size
For Linux: OS default stack size
For a complete list of platform specific values, please refer to Platform Notes.

[default] mask = rti::core::ThreadSettingsKindMask::ThreadSettingsKindMask()

◆ topic_query_publication_thread() [2/3]

const rti::core::ThreadSettings& rti::core::policy::AsynchronousPublisher::topic_query_publication_thread ( ) const

Getter (see setter with the same name)

◆ topic_query_publication_thread() [3/3]

rti::core::ThreadSettings& rti::core::policy::AsynchronousPublisher::topic_query_publication_thread ( )

Getter (see setter with the same name)

◆ Enabled()

static AsynchronousPublisher rti::core::policy::AsynchronousPublisher::Enabled ( bool  enable_async_batch = false)
inlinestatic

Returns a policy that enables asynchronous write and optionally asynchronous batch flushing.

It uses the default thread settings.

For example:

using namespace rti::core::policy;

◆ Disabled()

static AsynchronousPublisher rti::core::policy::AsynchronousPublisher::Disabled ( )
inlinestatic

Creates a policy that disables asynchronous writing.