The following #includes are needed for the examples on this page
#include <dds/sub/ddssub.hpp>
#include <dds/domain/ddsdomain.hpp>
#include <dds/core/ddscore.hpp>
Setting up a subscriber
- Set up participant
- Create a Subscriber with each of the available constructors
auto listener = std::make_shared<ExampleSubscriberListener>();
participant,
qos,
listener,
Looking up Subscribers
- Lookup Subscribers
void howto_lookup_subscribers()
{
create_and_retain_subscriber(participant);
create_and_retain_subscriber(participant);
create_and_retain_subscriber(participant);
std::vector<dds::sub::Subscriber> subscribers1;
int subscriber_count =
std::cout << "Subscriber count: " << subscriber_count << std::endl;
subscriber_count =
for (std::vector<dds::sub::Subscriber>::iterator it = subscribers1.begin();
it != subscribers1.end();
it++) {
(*it).close();
}
}
{
}
Tearing down a subscriber