DomainParticipant¶
A DomainParticipant is the entry point of the application to a domain.
Every DomainParticipant is linked to a single domain from its creation, and contains all the Entities related to that domain.
It also acts as a factory for Publisher, Subscriber and Topic entities.
The behavior of the DomainParticipant can be modified with the QoS values specified on DomainParticipantQos. The QoS values can be set at the creation of the DomainParticipant.
As an Entity, DomainParticipant accepts a DomainParticipant Listener that will be notified of status changes on the DomainParticipant instance.
DomainParticipantQos¶
DomainParticipantQos controls the behavior of the DomainParticipant.
Internally it contains the following Policy objects:
participant_nameasmemory::container::StaticString256The name of the DomainParticipant.
entity_factory_qosas EntityFactoryQosPolicyDefines if the DomainParticipant will automatically enable created subentities or not.
wire_protocol_qosas DomainParticipantWireProtocolQosPolicyThe configuration of the wire protocol.
allocationsas DomainParticipantAllocationsQosPolicyDefines the memory configuration of the DomainParticipant.
Note
Check Memory management to understand how memory is managed in Safe DDS.
Example¶
// Construct DomainParticipantQos with default values
DomainParticipantQos participant_qos{};
// By default autoenable_created_entities is true, set to false
participant_qos.entity_factory_qos().autoenable_created_entities = false;
// Set participant name
memory::container::StaticString256 name("participant_name");
participant_qos.participant_name() = name;
// Configure wire protocol configuration
protocol::GUIDPrefix prefix = {0x01, 0x02, 0x03};
participant_qos.wire_protocol_qos().guid_prefix = prefix;
// Configure storage and discovery memory
participant_qos.allocations().local_participants.preallocated = 10;
participant_qos.allocations().local_participants.max_elements = 1000;
participant_qos.allocations().local_datareaders.preallocated = 10;
participant_qos.allocations().local_datareaders.max_elements = 1000;