7.2.6 Finding a Publisher’s Related DDS Entities
These Publisher operations are useful for obtaining a handle to related Entities:
- get_participant(): Gets the DomainParticipant with which a Publisher was created.
- lookup_datawriter(): Finds a DataWriter created by the Publisher with a Topic of a particular name. Note that in the event that multiple DataWriters were created by the same Publisher with the same Topic, any one of them may be returned by this method. (In the Modern C++ API this method is a freestanding function, dds::pub::find())
- DDS_Publisher_as_Entity(): This method is provided for C applications and is necessary when invoking the parent class Entity methods on Publishers. For example, to call the Entity method get_status_changes() on a Publisher, my_pub, do the following:
DDS_Entity_get_status_changes(DDS_Publisher_as_Entity(my_pub))
DDS_Publisher_as_Entity() is not provided in the C++, C++/CLI, C# and Java APIs because the object-oriented features of those languages make it unnecessary.
© 2020 RTI