CoreDX DDS C++ Reference Manual
Public Member Functions | List of all members
DDS::Publisher Class Reference

The Publisher configures, creates, manages and destroys DataWriters. More...

Inheritance diagram for DDS::Publisher:
DDS::Entity

Public Member Functions

ReturnCode_t enable ()
 Enables the Publisher. More...
 
InstanceHandle_t get_instance_handle ()
 This operation returns the InstanceHandle_t that identifies the Publisher.
 
StatusMask get_status_changes ()
 This returns the list of triggered communication statuses in the Publisher. More...
 
class DomainParticipantget_participant ()
 This operation returns the DomainParticipant this Publisher belongs to.
 
class DataWritercreate_datawriter (Topic *a_topic, const DataWriterQos &qos, DataWriterListener *a_listener, StatusMask mask)
 This operation creates a DataWriter. More...
 
ReturnCode_t delete_datawriter (DataWriter *a_datawriter)
 This operation deletes a DataWriter. More...
 
class DataWriterlookup_datawriter (const char *topic_name)
 This operation retrieves a previously-created DataWriter contained in the Publisher, attached to a Topic named topic_name. More...
 
ReturnCode_t delete_contained_entities ()
 This operation deletes all the DataWriters created by means of the Publisher::create_datawriter() operation on the Publisher p. More...
 
ReturnCode_t set_qos (const PublisherQos &qos)
 Sets the PublisherQos values. More...
 
ReturnCode_t get_qos (PublisherQos &qos)
 Returns the current PublisherQos settings held in the Publisher p. More...
 
ReturnCode_t set_listener (PublisherListener *a_listener, StatusMask mask)
 Installs a PublisherListener on Publisher p. More...
 
class PublisherListenerget_listener ()
 This operation returns the currently installed PublisherListener. More...
 
ReturnCode_t suspend_publications ()
 
ReturnCode_t resume_publications ()
 
ReturnCode_t begin_coherent_changes ()
 
ReturnCode_t end_coherent_changes ()
 
ReturnCode_t wait_for_acknowledgments (const Duration_t &max_wait)
 Block until all writers contained by this publisher have received acknowledgements. More...
 
ReturnCode_t set_default_datawriter_qos (const DataWriterQos &qos)
 Sets the default DataWriterQos held in the Publisher. More...
 
ReturnCode_t get_default_datawriter_qos (DataWriterQos &qos)
 Provides access to the default DataWriterQos settings held in the Publisher p. More...
 
ReturnCode_t copy_from_topic_qos (DataWriterQos &a_datawriter_qos, const TopicQos &a_topic_qos)
 This operation copies the QoS settings in a_topic_qos to the corresponding settings in a_datawriter_qos. More...
 
- Public Member Functions inherited from DDS::Entity
virtual StatusConditionget_statuscondition ()
 Gets the StatusCondition associated with this Entity. NOTE: The entity maintains ownership of the statuscondition, and it remains valid only as long as the Entity is valid. Destroying the Entity also destroys the status condition.
 

Detailed Description

The Publisher configures, creates, manages and destroys DataWriters.

Member Function Documentation

ReturnCode_t DDS::Publisher::begin_coherent_changes ( )
Not Yet Supported:
This operation is not yet implemented.
ReturnCode_t DDS::Publisher::copy_from_topic_qos ( DataWriterQos a_datawriter_qos,
const TopicQos a_topic_qos 
)

This operation copies the QoS settings in a_topic_qos to the corresponding settings in a_datawriter_qos.

The a_datawriter_qos parameter is populated with a copy of the QoS policies from the a_topic_qos structure. QoS entries in the datawriter qos structure will be overwritten with the values from the topic.

class DataWriter* DDS::Publisher::create_datawriter ( Topic a_topic,
const DataWriterQos qos,
DataWriterListener a_listener,
StatusMask  mask 
)

This operation creates a DataWriter.

The created DataWriter is contained within the Publisher p. It is associated with the Topic, ContentFilteredTopic, or MultiTopic indicated by a_topic, and has the DataWriterQos indicated by qos. The qos argument may be passed DATAWRITER_QOS_DEFAULT, which indicates that the Publisher should use its currently configured default data writer QoS values. The DataWriterListener a_listener, is installed at creation time.

The created DataWriter (if not NULL) must be destroyed by a call to Publisher::delete_datawriter().

This routine will fail if the provided QoS settings are internally inconsistent. In this case, the routine will return NULL.

ReturnCode_t DDS::Publisher::delete_contained_entities ( )

This operation deletes all the DataWriters created by means of the Publisher::create_datawriter() operation on the Publisher p.

This routine will recursively call the corresponding delete_contained_entities() operation on each of the contained DataWriter objects. After successful execution, the application may delete the Publisher by calling DomainParticipant::delete_publisher().

If any of the objects cannot be deleted, this routine will return RETCODE_PRECONDITION_NOT_MET.

ReturnCode_t DDS::Publisher::delete_datawriter ( DataWriter a_datawriter)

This operation deletes a DataWriter.

If the provided DataWriter a_datawriter was not created by Publisher p, the routine will fail and will return RETCODE_PRECONDITION_NOT_MET.

ReturnCode_t DDS::Publisher::enable ( )
virtual

Enables the Publisher.

A Publisher is created either enabled or not based on the DomainParticipantQos setting entity_factory. When a Publisher is not enabled, only the following sub-set of all Publisher operations are legal:

Any other operation may return the NOT_ENABLED error. Publisher::enable() may be called on an already enabled Subscriber [it will have no effect].

Reimplemented from DDS::Entity.

ReturnCode_t DDS::Publisher::end_coherent_changes ( )
Not Yet Supported:
This operation is not yet implemented.
ReturnCode_t DDS::Publisher::get_default_datawriter_qos ( DataWriterQos qos)

Provides access to the default DataWriterQos settings held in the Publisher p.

The provided qos argument is populated with the current default qos settings.

class PublisherListener* DDS::Publisher::get_listener ( )

This operation returns the currently installed PublisherListener.

Note
Because the infrastructure makes a copy of the listener provided in Publisher::set_listener(), the returned structure pointer will not match the pointer originally provided. However, the function pointers within the structure will match. Also, the application should not free the data referenced by the returned pointer.
ReturnCode_t DDS::Publisher::get_qos ( PublisherQos qos)

Returns the current PublisherQos settings held in the Publisher p.

The qos parameter is populated with a copy of the current Publisher QoS properties.

Note
The qos structure may contain sequences or strings that are populated with dynamic memory. The caller is responsible for freeing the dynamic memory of these items.
For example, the sequence 'qos->group_data' may have dynamically allocated memory assigned. This can be released by a call to seq_clear(&qos->group_data).
StatusMask DDS::Publisher::get_status_changes ( )
virtual

This returns the list of triggered communication statuses in the Publisher.

If the Publisher is not enabled, all statuses will be untriggered. The list returned by get_status_changes may be empty. The list of statuses returned by get_status_changes operation contains statuses that are triggered on the Publisher itself and does not include statuses from contained DataWriter objects.

Implements DDS::Entity.

class DataWriter* DDS::Publisher::lookup_datawriter ( const char *  topic_name)

This operation retrieves a previously-created DataWriter contained in the Publisher, attached to a Topic named topic_name.

If multiple DataWriters are found, one of them will be returned. If no matching DataWriter is found, this routine will return NULL.

ReturnCode_t DDS::Publisher::resume_publications ( )
Not Yet Supported:
This operation is not yet implemented.
ReturnCode_t DDS::Publisher::set_default_datawriter_qos ( const DataWriterQos qos)

Sets the default DataWriterQos held in the Publisher.

This default qos will be used during subsequent calls to Publisher::create_datawriter() if the special DATAWRITER_QOS_DEFAULT value is provided for qos.
This routine may fail if the provided qos argument is not internally consistent. In this case, INCONSISTENT_POLICY will be returned, and no changes will be made to the Publisher.

ReturnCode_t DDS::Publisher::set_listener ( PublisherListener a_listener,
StatusMask  mask 
)

Installs a PublisherListener on Publisher p.

Only one listener may be attached to a Publisher at a time. A call to set_listener() will replace any current listener with a_listener.

a_listener can be NULL, which indicates a listener that does nothing.

The infrastructure will make an internal copy of the listener structure so that it need not be persisted by the application.

ReturnCode_t DDS::Publisher::set_qos ( const PublisherQos qos)

Sets the PublisherQos values.

These QoS values affect the behavior of the Publisher.

ReturnCode_t DDS::Publisher::suspend_publications ( )
Not Yet Supported:
This operation is not yet implemented.
ReturnCode_t DDS::Publisher::wait_for_acknowledgments ( const Duration_t max_wait)

Block until all writers contained by this publisher have received acknowledgements.

This routine will block until all data written by contained writers has been acknowledged, or until the 'max_wait' duration has passed. 'max_wait' can be set to INFINITE, in which case this routine may block indefinitely.

Return values
RETCODE_TIME_OUTreturned if 'max_wait' passes before all acks are received
RETCODE_OKreturned if all acks have been received before 'max_wait'

© 2009-2017 Twin Oaks Computing, Inc
Castle Rock, CO 80108
All rights reserved.