CoreDX DDS Modern C++ API
Public Member Functions | List of all members
dds::pub::Publisher Class Reference

The Publisher acts on the behalf of one or several DataWriter objects that belong to it. More...

Inheritance diagram for dds::pub::Publisher:
Inheritance graph
[legend]
Collaboration diagram for dds::pub::Publisher:
Collaboration graph
[legend]

Public Member Functions

 Publisher (const dds::domain::DomainParticipant &dp)
 Create a new Publisher. More...
 
 Publisher (const dds::domain::DomainParticipant &dp, const dds::pub::qos::PublisherQos &qos, dds::pub::PublisherListener *listener=NULL, const dds::core::status::StatusMask &mask=dds::core::status::StatusMask::none())
 Create a Publisher with the desired QoS policies and attaches to it the specified PublisherListener. More...
 
const dds::pub::qos::PublisherQosqos () const
 Get the publisher qos policies.
 
void qos (const dds::pub::qos::PublisherQos &pqos)
 Set the new qos policies for this publisher. More...
 
Publisheroperator<< (const dds::pub::qos::PublisherQos &the_qos)
 Set the new qos policies for this publisher. More...
 
Publisheroperator>> (dds::pub::qos::PublisherQos &the_qos)
 Get the publisher qos policies.
 
Publisherdefault_datawriter_qos (const dds::pub::qos::DataWriterQos &dwqos)
 This operation sets a default value of the DataWriterQos which will be used for newly created DataWriterentities for which no DataWriterQos is provided in the constructor. More...
 
dds::pub::qos::DataWriterQos default_datawriter_qos () const
 This operation retrieves the default value of the DataWriterQos, that is, the QoS policies which will be used for newly created DataWriter that don't provide a QoS parameter in the constructor.
 
void listener (Listener *plistener, const dds::core::status::StatusMask &event_mask)
 Set/Reset the listener associated with this publisher. More...
 
Listenerlistener () const
 Get the currently registered listener.
 
void wait_for_acknowledgments (const dds::core::Duration &timeout)
 This operation blocks the calling thread until either all data written by the reliable DataWriter entities is acknowledged by all matched reliable DataReader entities, or else the duration specified by the max_wait parameter elapses, whichever happens first. More...
 
const dds::domain::DomainParticipantparticipant () const
 Return the DomainParticipant that owns this Publisher.
 
- Public Member Functions inherited from dds::core::Entity
void enable ()
 This operation enables the Entity. More...
 
const dds::core::status::StatusMask status_changes ()
 This operation retrieves the list of communication statuses in the Entity that are triggered.That is, the list of statuses whose value has changed since the last time the application read the status. More...
 
const dds::core::InstanceHandle instance_handle () const
 This operation returns the InstanceHandle_t that represents the Entity.
 
void close ()
 This method closes the entity and releases all resources associated with DDS, such as threads, sockets, buffers, etc. More...
 
void retain ()
 Indicates that references to this object may go out of scope but that the application expects to look it up again later. More...
 
- Public Member Functions inherited from dds::core::Reference< DELEGATE >
 Reference (dds::core::null_type &)
 Creates a "null" reference.
 
 Reference (const Reference &ref)
 Creates a reference from another. More...
 
template<typename D >
 Reference (const Reference< D > &ref)
 Enables safe assignment from other reference types. More...
 
 Reference (DELEGATE_T *p)
 The following two constructors create a dds Reference from a vendor specific delegate. More...
 
 ~Reference ()
 Destroys a reference.
 
template<typename R >
bool operator== (const R &ref) const
 Compares two reference objects and returns true if they are equal. More...
 
template<typename R >
bool operator!= (const R &ref) const
 Compares two reference objects and returns true if they are not-equal. More...
 
Referenceoperator= (const null_type)
 Special assignment operators that takes care of assigning null to this reference. More...
 
bool is_nil () const
 Returns true if this reference object is nil, meaning pointing to null.
 
bool operator== (const null_type) const
 Special operator== used to check if this reference object equals the null reference. More...
 
bool operator!= (const null_type nil) const
 Special operator!= used to check if this reference object does not equals the null reference. More...
 
const DELEGATE_REF_T & delegate () const
 Returns a reference to the underlying delegate. More...
 
DELEGATE_REF_T & delegate ()
 Returns a reference to the underlying delegate. More...
 
DELEGATE * operator-> ()
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 
const DELEGATE * operator-> () const
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 

Detailed Description

The Publisher acts on the behalf of one or several DataWriter objects that belong to it.

When it is informed of a change to the data associated with one of its DataWriter objects, it decides when it is appropriate to actually send the data-update message. In making this decision, it considers any extra information that goes with the data (timestamp, writer, etc.) as well as the QoS of the Publisher and the DataWriter.

Constructor & Destructor Documentation

◆ Publisher() [1/2]

dds::pub::Publisher::Publisher ( const dds::domain::DomainParticipant dp)

Create a new Publisher.

Parameters
dpthe domain participant

◆ Publisher() [2/2]

dds::pub::Publisher::Publisher ( const dds::domain::DomainParticipant dp,
const dds::pub::qos::PublisherQos qos,
dds::pub::PublisherListener listener = NULL,
const dds::core::status::StatusMask mask = dds::core::status::StatusMask::none() 
)

Create a Publisher with the desired QoS policies and attaches to it the specified PublisherListener.

If the specified QoS policies are not consistent, the operation will fail and an exception will be thrown.

Parameters
dpthe domain participant.
qosthe publisher qos policies.
listenerthe publisher listener
maskthe mask of events notified to the listener.

Member Function Documentation

◆ default_datawriter_qos()

Publisher& dds::pub::Publisher::default_datawriter_qos ( const dds::pub::qos::DataWriterQos dwqos)

This operation sets a default value of the DataWriterQos which will be used for newly created DataWriterentities for which no DataWriterQos is provided in the constructor.

This operation will check that the resulting policies are self consistent; if they are not, the operation will have no effect and raise an InconsistentPolicyError.

◆ listener()

void dds::pub::Publisher::listener ( Listener plistener,
const dds::core::status::StatusMask event_mask 
)

Set/Reset the listener associated with this publisher.

Listener un-registration is performed by setting the listener to NULL.

Parameters
plistenerthe publisher listener.
event_maskA StatusMask that indicates which events should trigger a listener callback

◆ operator<<()

Publisher& dds::pub::Publisher::operator<< ( const dds::pub::qos::PublisherQos the_qos)

Set the new qos policies for this publisher.

Parameters
the_qosthe new publisher QoS

◆ qos()

void dds::pub::Publisher::qos ( const dds::pub::qos::PublisherQos pqos)

Set the new qos policies for this publisher.

Parameters
pqosthe new publisher QoS

◆ wait_for_acknowledgments()

void dds::pub::Publisher::wait_for_acknowledgments ( const dds::core::Duration timeout)

This operation blocks the calling thread until either all data written by the reliable DataWriter entities is acknowledged by all matched reliable DataReader entities, or else the duration specified by the max_wait parameter elapses, whichever happens first.

A normal return indicates that all the samples written have been acknowledged by all reliable matched data readers; A TimeoutError indicates that max_wait elapsed before all the data was acknowledged.


© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.