Class Publisher, used to send data to associated subscribers. More...
#include <Publisher.hpp>
Public Member Functions | |
virtual | ~Publisher () |
Destructor. | |
FASTDDS_EXPORTED_API ReturnCode_t | enable () override |
This operation enables the Publisher. | |
FASTDDS_EXPORTED_API const PublisherQos & | get_qos () const |
Allows accessing the Publisher Qos. | |
FASTDDS_EXPORTED_API ReturnCode_t | get_qos (PublisherQos &qos) const |
Retrieves the Publisher Qos. | |
FASTDDS_EXPORTED_API ReturnCode_t | set_qos (const PublisherQos &qos) |
Allows modifying the Publisher Qos. | |
FASTDDS_EXPORTED_API const PublisherListener * | get_listener () const |
Retrieves the attached PublisherListener. | |
FASTDDS_EXPORTED_API ReturnCode_t | set_listener (PublisherListener *listener) |
Modifies the PublisherListener, sets the mask to StatusMask::all() | |
FASTDDS_EXPORTED_API ReturnCode_t | set_listener (PublisherListener *listener, const StatusMask &mask) |
Modifies the PublisherListener. | |
FASTDDS_EXPORTED_API DataWriter * | create_datawriter (Topic *topic, const DataWriterQos &qos, DataWriterListener *listener=nullptr, const StatusMask &mask=StatusMask::all(), std::shared_ptr< fastdds::rtps::IPayloadPool > payload_pool=nullptr) |
This operation creates a DataWriter. | |
FASTDDS_EXPORTED_API DataWriter * | create_datawriter_with_profile (Topic *topic, const std::string &profile_name, DataWriterListener *listener=nullptr, const StatusMask &mask=StatusMask::all(), std::shared_ptr< fastdds::rtps::IPayloadPool > payload_pool=nullptr) |
This operation creates a DataWriter. | |
FASTDDS_EXPORTED_API ReturnCode_t | delete_datawriter (const DataWriter *writer) |
This operation deletes a DataWriter that belongs to the Publisher. | |
FASTDDS_EXPORTED_API DataWriter * | lookup_datawriter (const std::string &topic_name) const |
This operation retrieves a previously created DataWriter belonging to the Publisher that is attached to a Topic with a matching topic_name. | |
FASTDDS_EXPORTED_API ReturnCode_t | suspend_publications () |
Indicates to FastDDS that the contained DataWriters are about to be modified. | |
FASTDDS_EXPORTED_API ReturnCode_t | resume_publications () |
Indicates to FastDDS that the modifications to the DataWriters are complete. | |
FASTDDS_EXPORTED_API ReturnCode_t | begin_coherent_changes () |
Signals the beginning of a set of coherent cache changes using the Datawriters attached to the publisher. | |
FASTDDS_EXPORTED_API ReturnCode_t | end_coherent_changes () |
Signals the end of a set of coherent cache changes. | |
FASTDDS_EXPORTED_API ReturnCode_t | wait_for_acknowledgments (const fastdds::dds::Duration_t &max_wait) |
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. | |
FASTDDS_EXPORTED_API const DomainParticipant * | get_participant () const |
This operation returns the DomainParticipant to which the Publisher belongs. | |
FASTDDS_EXPORTED_API ReturnCode_t | delete_contained_entities () |
Deletes all contained DataWriters. | |
FASTDDS_EXPORTED_API ReturnCode_t | set_default_datawriter_qos (const DataWriterQos &qos) |
This operation sets a default value of the DataWriter QoS policies which will be used for newly created DataWriter entities in the case where the QoS policies are defaulted in the create_datawriter operation. | |
FASTDDS_EXPORTED_API const DataWriterQos & | get_default_datawriter_qos () const |
This operation returns the default value of the DataWriter QoS, that is, the QoS policies which will be used for newly created DataWriter entities in the case where the QoS policies are defaulted in the create_datawriter operation. | |
FASTDDS_EXPORTED_API ReturnCode_t | get_default_datawriter_qos (DataWriterQos &qos) const |
This operation retrieves the default value of the DataWriter QoS, that is, the QoS policies which will be used for newly created DataWriter entities in the case where the QoS policies are defaulted in the create_datawriter operation. | |
FASTDDS_EXPORTED_API ReturnCode_t | get_datawriter_qos_from_profile (const std::string &profile_name, DataWriterQos &qos) const |
Fills the DataWriterQos with the values of the XML profile. | |
FASTDDS_EXPORTED_API ReturnCode_t | get_datawriter_qos_from_profile (const std::string &profile_name, DataWriterQos &qos, std::string &topic_name) const |
Fills the DataWriterQos with the values of the XML profile, and also its corresponding topic name (if specified). | |
FASTDDS_EXPORTED_API ReturnCode_t | get_datawriter_qos_from_xml (const std::string &xml, DataWriterQos &qos) const |
Fills the DataWriterQos with the first DataWriter profile found in the provided XML. | |
FASTDDS_EXPORTED_API ReturnCode_t | get_datawriter_qos_from_xml (const std::string &xml, DataWriterQos &qos, std::string &topic_name) const |
Fills the DataWriterQos with the first DataWriter profile found in the provided XML, and also its corresponding topic name (if specified). | |
FASTDDS_EXPORTED_API ReturnCode_t | get_datawriter_qos_from_xml (const std::string &xml, DataWriterQos &qos, const std::string &profile_name) const |
Fills the DataWriterQos with the DataWriter profile with profile_name to be found in the provided XML. | |
FASTDDS_EXPORTED_API ReturnCode_t | get_datawriter_qos_from_xml (const std::string &xml, DataWriterQos &qos, std::string &topic_name, const std::string &profile_name) const |
Fills the DataWriterQos with the DataWriter profile with profile_name to be found in the provided XML, and also its corresponding topic name (if specified). | |
FASTDDS_EXPORTED_API ReturnCode_t | get_default_datawriter_qos_from_xml (const std::string &xml, DataWriterQos &qos) const |
Fills the DataWriterQos with the default DataWriter profile found in the provided XML (if there is). | |
FASTDDS_EXPORTED_API ReturnCode_t | get_default_datawriter_qos_from_xml (const std::string &xml, DataWriterQos &qos, std::string &topic_name) const |
Fills the DataWriterQos with the default DataWriter profile found in the provided XML (if there is), and also its corresponding topic name (if specified). | |
FASTDDS_EXPORTED_API const InstanceHandle_t & | get_instance_handle () const |
Returns the Publisher's handle. | |
FASTDDS_EXPORTED_API bool | get_datawriters (std::vector< DataWriter * > &writers) const |
Fills the given vector with all the datawriters of this publisher. | |
FASTDDS_EXPORTED_API bool | has_datawriters () const |
This operation checks if the publisher has DataWriters. | |
![]() | |
DomainEntity (const StatusMask &mask=StatusMask::all()) | |
Constructor. | |
![]() | |
FASTDDS_EXPORTED_API | Entity (const StatusMask &mask=StatusMask::all()) |
Constructor. | |
void | close () |
This operation disables the Entity before closing it. | |
FASTDDS_EXPORTED_API const StatusMask & | get_status_mask () const |
Retrieves the set of relevant statuses for the Entity. | |
FASTDDS_EXPORTED_API const StatusMask & | get_status_changes () const |
Retrieves the set of triggered statuses in the Entity. | |
const InstanceHandle_t & | get_instance_handle () const |
Retrieves the instance handler that represents the Entity. | |
FASTDDS_EXPORTED_API bool | is_enabled () const |
Checks if the Entity is enabled. | |
FASTDDS_EXPORTED_API bool | operator== (const Entity &other) const |
FASTDDS_EXPORTED_API StatusCondition & | get_statuscondition () |
Allows access to the StatusCondition associated with the Entity. | |
Static Public Member Functions | |
static FASTDDS_EXPORTED_API ReturnCode_t | copy_from_topic_qos (fastdds::dds::DataWriterQos &writer_qos, const fastdds::dds::TopicQos &topic_qos) |
Copies TopicQos into the corresponding DataWriterQos. | |
Protected Member Functions | |
Publisher (PublisherImpl *p, const StatusMask &mask=StatusMask::all()) | |
Create a publisher, assigning its pointer to the associated implementation. | |
Publisher (DomainParticipant *dp, const PublisherQos &qos=PUBLISHER_QOS_DEFAULT, PublisherListener *listener=nullptr, const StatusMask &mask=StatusMask::all()) | |
![]() | |
FASTDDS_EXPORTED_API void | set_instance_handle (const InstanceHandle_t &handle) |
Setter for the Instance Handle. | |
Protected Attributes | |
PublisherImpl * | impl_ |
![]() | |
StatusMask | status_mask_ |
StatusMask with relevant statuses set to 1. | |
StatusCondition | status_condition_ |
Condition associated to the Entity. | |
InstanceHandle_t | instance_handle_ |
InstanceHandle associated to the Entity. | |
bool | enable_ |
Boolean that states if the Entity is enabled or disabled. | |
Friends | |
class | PublisherImpl |
class | DomainParticipantImpl |
class | ::dds::pub::Publisher |
Class Publisher, used to send data to associated subscribers.
|
protected |
Create a publisher, assigning its pointer to the associated implementation.
Don't use directly, create Publisher using create_publisher from DomainParticipant.
|
protected |
|
virtual |
Destructor.
FASTDDS_EXPORTED_API ReturnCode_t begin_coherent_changes | ( | ) |
Signals the beginning of a set of coherent cache changes using the Datawriters attached to the publisher.
|
static |
Copies TopicQos into the corresponding DataWriterQos.
[out] | writer_qos | |
[in] | topic_qos |
FASTDDS_EXPORTED_API DataWriter * create_datawriter | ( | Topic * | topic, |
const DataWriterQos & | qos, | ||
DataWriterListener * | listener = nullptr , |
||
const StatusMask & | mask = StatusMask::all() , |
||
std::shared_ptr< fastdds::rtps::IPayloadPool > | payload_pool = nullptr |
||
) |
This operation creates a DataWriter.
The returned DataWriter will be attached and belongs to the Publisher.
topic | Topic the DataWriter will be listening |
qos | QoS of the DataWriter. |
listener | Pointer to the listener (default: nullptr). |
mask | StatusMask that holds statuses the listener responds to (default: all). |
payload_pool | IPayloadPool shared pointer that defines writer payload (default: nullptr). |
FASTDDS_EXPORTED_API DataWriter * create_datawriter_with_profile | ( | Topic * | topic, |
const std::string & | profile_name, | ||
DataWriterListener * | listener = nullptr , |
||
const StatusMask & | mask = StatusMask::all() , |
||
std::shared_ptr< fastdds::rtps::IPayloadPool > | payload_pool = nullptr |
||
) |
This operation creates a DataWriter.
The returned DataWriter will be attached and belongs to the Publisher.
topic | Topic the DataWriter will be listening |
profile_name | DataWriter profile name. |
listener | Pointer to the listener (default: nullptr). |
mask | StatusMask that holds statuses the listener responds to (default: all). |
payload_pool | IPayloadPool shared pointer that defines writer payload (default: nullptr). |
FASTDDS_EXPORTED_API ReturnCode_t delete_contained_entities | ( | ) |
Deletes all contained DataWriters.
FASTDDS_EXPORTED_API ReturnCode_t delete_datawriter | ( | const DataWriter * | writer | ) |
This operation deletes a DataWriter that belongs to the Publisher.
The delete_datawriter operation must be called on the same Publisher object used to create the DataWriter. If delete_datawriter is called on a different Publisher, the operation will have no effect and it will return false.
The deletion of the DataWriter will automatically unregister all instances. Depending on the settings of the WRITER_DATA_LIFECYCLE QosPolicy, the deletion of the DataWriter may also dispose all instances.
writer | DataWriter to delete |
|
overridevirtual |
FASTDDS_EXPORTED_API ReturnCode_t end_coherent_changes | ( | ) |
Signals the end of a set of coherent cache changes.
FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_profile | ( | const std::string & | profile_name, |
DataWriterQos & | qos | ||
) | const |
Fills the DataWriterQos with the values of the XML profile.
profile_name | DataWriter profile name. |
qos | DataWriterQos object where the qos is returned. |
FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_profile | ( | const std::string & | profile_name, |
DataWriterQos & | qos, | ||
std::string & | topic_name | ||
) | const |
Fills the DataWriterQos with the values of the XML profile, and also its corresponding topic name (if specified).
profile_name | DataWriter profile name. |
qos | DataWriterQos object where the qos is returned. |
topic_name | String where the name of the topic associated to this profile is returned (if specified). |
FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_xml | ( | const std::string & | xml, |
DataWriterQos & | qos | ||
) | const |
Fills the DataWriterQos with the first DataWriter profile found in the provided XML.
xml | Raw XML string containing the profile to be used to fill the qos structure. |
qos | DataWriterQos object where the qos is returned. |
FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_xml | ( | const std::string & | xml, |
DataWriterQos & | qos, | ||
const std::string & | profile_name | ||
) | const |
Fills the DataWriterQos with the DataWriter profile with profile_name
to be found in the provided XML.
xml | Raw XML string containing the profile to be used to fill the qos structure. |
qos | DataWriterQos object where the qos is returned. |
profile_name | DataWriter profile name. |
FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_xml | ( | const std::string & | xml, |
DataWriterQos & | qos, | ||
std::string & | topic_name | ||
) | const |
Fills the DataWriterQos with the first DataWriter profile found in the provided XML, and also its corresponding topic name (if specified).
xml | Raw XML string containing the profile to be used to fill the qos structure. |
qos | DataWriterQos object where the qos is returned. |
topic_name | String where the name of the topic associated to this profile is returned (if specified). |
FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_xml | ( | const std::string & | xml, |
DataWriterQos & | qos, | ||
std::string & | topic_name, | ||
const std::string & | profile_name | ||
) | const |
Fills the DataWriterQos with the DataWriter profile with profile_name
to be found in the provided XML, and also its corresponding topic name (if specified).
xml | Raw XML string containing the profile to be used to fill the qos structure. |
qos | DataWriterQos object where the qos is returned. |
topic_name | String where the name of the topic associated to this profile is returned (if specified). |
profile_name | DataWriter profile name. |
FASTDDS_EXPORTED_API bool get_datawriters | ( | std::vector< DataWriter * > & | writers | ) | const |
Fills the given vector with all the datawriters of this publisher.
writers | Vector where the DataWriters are returned |
FASTDDS_EXPORTED_API const DataWriterQos & get_default_datawriter_qos | ( | ) | const |
This operation returns the default value of the DataWriter QoS, that is, the QoS policies which will be used for newly created DataWriter entities in the case where the QoS policies are defaulted in the create_datawriter operation.
The values retrieved by get_default_datawriter_qos will match the set of values specified on the last successful call to set_default_datawriter_qos, or else, if the call was never made, the default values.
FASTDDS_EXPORTED_API ReturnCode_t get_default_datawriter_qos | ( | DataWriterQos & | qos | ) | const |
This operation retrieves the default value of the DataWriter QoS, that is, the QoS policies which will be used for newly created DataWriter entities in the case where the QoS policies are defaulted in the create_datawriter operation.
The values retrieved by get_default_datawriter_qos will match the set of values specified on the last successful call to set_default_datawriter_qos, or else, if the call was never made, the default values.
qos | Reference to the current default WriterQos. |
FASTDDS_EXPORTED_API ReturnCode_t get_default_datawriter_qos_from_xml | ( | const std::string & | xml, |
DataWriterQos & | qos | ||
) | const |
Fills the DataWriterQos with the default DataWriter profile found in the provided XML (if there is).
get_default_datawriter_qos
).xml | Raw XML string containing the profile to be used to fill the qos structure. |
qos | DataWriterQos object where the qos is returned. |
FASTDDS_EXPORTED_API ReturnCode_t get_default_datawriter_qos_from_xml | ( | const std::string & | xml, |
DataWriterQos & | qos, | ||
std::string & | topic_name | ||
) | const |
Fills the DataWriterQos with the default DataWriter profile found in the provided XML (if there is), and also its corresponding topic name (if specified).
get_default_datawriter_qos
).xml | Raw XML string containing the profile to be used to fill the qos structure. |
qos | DataWriterQos object where the qos is returned. |
topic_name | String where the name of the topic associated to this profile is returned (if specified). |
FASTDDS_EXPORTED_API const InstanceHandle_t & get_instance_handle | ( | ) | const |
FASTDDS_EXPORTED_API const PublisherListener * get_listener | ( | ) | const |
Retrieves the attached PublisherListener.
FASTDDS_EXPORTED_API const DomainParticipant * get_participant | ( | ) | const |
This operation returns the DomainParticipant to which the Publisher belongs.
FASTDDS_EXPORTED_API const PublisherQos & get_qos | ( | ) | const |
Allows accessing the Publisher Qos.
FASTDDS_EXPORTED_API ReturnCode_t get_qos | ( | PublisherQos & | qos | ) | const |
Retrieves the Publisher Qos.
FASTDDS_EXPORTED_API bool has_datawriters | ( | ) | const |
This operation checks if the publisher has DataWriters.
FASTDDS_EXPORTED_API DataWriter * lookup_datawriter | ( | const std::string & | topic_name | ) | const |
This operation retrieves a previously created DataWriter belonging to the Publisher that is attached to a Topic with a matching topic_name.
If no such DataWriter exists, the operation will return nullptr.
If multiple DataWriter attached to the Publisher satisfy this condition, then the operation will return one of them. It is not specified which one.
topic_name | Name of the Topic |
FASTDDS_EXPORTED_API ReturnCode_t resume_publications | ( | ) |
Indicates to FastDDS that the modifications to the DataWriters are complete.
FASTDDS_EXPORTED_API ReturnCode_t set_default_datawriter_qos | ( | const DataWriterQos & | qos | ) |
This operation sets a default value of the DataWriter QoS policies which will be used for newly created DataWriter entities in the case where the QoS policies are defaulted in the create_datawriter operation.
This operation will check that the resulting policies are self consistent; if they are not, the operation will have no effect and return false.
The special value DATAWRITER_QOS_DEFAULT may be passed to this operation to indicate that the default QoS should be reset back to the initial values the factory would use, that is the values that would be used if the set_default_datawriter_qos operation had never been called.
qos | DataWriterQos to be set |
FASTDDS_EXPORTED_API ReturnCode_t set_listener | ( | PublisherListener * | listener | ) |
Modifies the PublisherListener, sets the mask to StatusMask::all()
listener | new value for the PublisherListener |
FASTDDS_EXPORTED_API ReturnCode_t set_listener | ( | PublisherListener * | listener, |
const StatusMask & | mask | ||
) |
Modifies the PublisherListener.
listener | new value for the PublisherListener |
mask | StatusMask that holds statuses the listener responds to |
FASTDDS_EXPORTED_API ReturnCode_t set_qos | ( | const PublisherQos & | qos | ) |
Allows modifying the Publisher Qos.
The given Qos must be supported by the PublisherQos.
qos | PublisherQos to be set |
FASTDDS_EXPORTED_API ReturnCode_t suspend_publications | ( | ) |
Indicates to FastDDS that the contained DataWriters are about to be modified.
FASTDDS_EXPORTED_API ReturnCode_t wait_for_acknowledgments | ( | const fastdds::dds::Duration_t & | max_wait | ) |
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 return value of true indicates that all the samples written have been acknowledged by all reliable matched data readers; a return value of false indicates that max_wait elapsed before all the data was acknowledged.
max_wait | Maximum blocking time for this operation |
|
friend |
|
friend |
|
friend |
|
protected |