The following #includes are needed for the examples on this page
#include <dds/pub/ddspub.hpp>
#include <dds/domain/ddsdomain.hpp>
#include <dds/core/ddscore.hpp>
Setting up a publisher
- Set up participant
- Create a Publisher with each of the available constructors
auto listener = std::make_shared<ExamplePublisherListener>();
participant,
qos,
listener,
Looking up Publishers
- Lookup Publishers
void howto_lookup_publishers()
{
create_and_retain_publisher(participant);
create_and_retain_publisher(participant);
create_and_retain_publisher(participant);
std::vector<dds::pub::Publisher> publishers1;
int publisher_count =
publisher_count =
std::cout << "Publisher count: " << publisher_count << std::endl;
for (std::vector<dds::pub::Publisher>::iterator it = publishers1.begin();
it != publishers1.end();
it++) {
(*it).close();
}
}
{
}
Tearing down a publisher