17.2.10. RTPSDomain

class eprosima::fastrtps::rtps::RTPSDomain

Class RTPSDomain,it manages the creation and destruction of RTPSParticipant RTPSWriter and RTPSReader. It stores a list of all created RTPSParticipant. Is has only static methods.

Public Static Functions

void stopAll()

Method to shut down all RTPSParticipants, readers, writers, etc. It must be called at the end of the process to avoid memory leaks. It also shut downs the DomainRTPSParticipant.

Post

After this call, all the pointers to RTPS entities are invalidated and their use may result in undefined behaviour.

RTPSParticipant *createParticipant(uint32_t domain_id, const RTPSParticipantAttributes &attrs, RTPSParticipantListener *plisten = nullptr)

Create a RTPSParticipant.

Return

Pointer to the RTPSParticipant.

Warning

The returned pointer is invalidated after a call to removeRTPSParticipant() or stopAll(), so its use may result in undefined behaviour.

Parameters
  • domain_id: DomainId to be used by the RTPSParticipant (80 by default).

  • attrs: RTPSParticipant Attributes.

  • plisten: Pointer to the ParticipantListener.

RTPSParticipant *createParticipant(uint32_t domain_id, bool enabled, const RTPSParticipantAttributes &attrs, RTPSParticipantListener *plisten = nullptr)

Create a RTPSParticipant.

Return

Pointer to the RTPSParticipant.

Warning

The returned pointer is invalidated after a call to removeRTPSParticipant() or stopAll(), so its use may result in undefined behaviour.

Parameters

RTPSWriter *createRTPSWriter(RTPSParticipant *p, WriterAttributes &watt, WriterHistory *hist, WriterListener *listen = nullptr)

Create a RTPSWriter in a participant.

Return

Pointer to the created RTPSWriter.

Warning

The returned pointer is invalidated after a call to removeRTPSWriter() or stopAll(), so its use may result in undefined behaviour.

Parameters

RTPSWriter *createRTPSWriter(RTPSParticipant *p, WriterAttributes &watt, const std::shared_ptr<IPayloadPool> &payload_pool, WriterHistory *hist, WriterListener *listen = nullptr)

Create a RTPSWriter in a participant using a custom payload pool.

Return

Pointer to the created RTPSWriter.

Warning

The returned pointer is invalidated after a call to removeRTPSWriter() or stopAll(), so its use may result in undefined behaviour.

Parameters

RTPSWriter *createRTPSWriter(RTPSParticipant *p, const EntityId_t &entity_id, WriterAttributes &watt, const std::shared_ptr<IPayloadPool> &payload_pool, WriterHistory *hist, WriterListener *listen = nullptr)

Create a RTPSWriter in a participant.

Return

Pointer to the created RTPSWriter.

Warning

The returned pointer is invalidated after a call to removeRTPSWriter() or stopAll(), so its use may result in undefined behaviour.

Parameters

bool removeRTPSWriter(RTPSWriter *writer)

Remove a RTPSWriter.

Return

True if correctly removed.

Parameters
  • writer: Pointer to the writer you want to remove.

RTPSReader *createRTPSReader(RTPSParticipant *p, ReaderAttributes &ratt, ReaderHistory *hist, ReaderListener *listen = nullptr)

Create a RTPSReader in a participant.

Return

Pointer to the created RTPSReader.

Warning

The returned pointer is invalidated after a call to removeRTPSReader() or stopAll(), so its use may result in undefined behaviour.

Parameters

RTPSReader *createRTPSReader(RTPSParticipant *p, ReaderAttributes &ratt, const std::shared_ptr<IPayloadPool> &payload_pool, ReaderHistory *hist, ReaderListener *listen = nullptr)

Create a RTPSWriter in a participant using a custom payload pool.

Return

Pointer to the created RTPSReader.

Warning

The returned pointer is invalidated after a call to removeRTPSReader() or stopAll(), so its use may result in undefined behaviour.

Parameters

bool removeRTPSReader(RTPSReader *reader)

Remove a RTPSReader.

Return

True if correctly removed.

Parameters
  • reader: Pointer to the reader you want to remove.

bool removeRTPSParticipant(RTPSParticipant *p)

Remove a RTPSParticipant and delete all its associated Writers, Readers, resources, etc.

Return

True if correct.

Parameters

void setMaxRTPSParticipantId(uint32_t maxRTPSParticipantId)

Set the maximum RTPSParticipantID.

Parameters
  • maxRTPSParticipantId: ID.

RTPSParticipant *clientServerEnvironmentCreationOverride(uint32_t domain_id, bool enabled, const RTPSParticipantAttributes &attrs, RTPSParticipantListener *listen)

Creates a RTPSParticipant as default server or client if ROS_MASTER_URI environment variable is set.

Return

Pointer to the RTPSParticipant.

Warning

The returned pointer is invalidated after a call to removeRTPSParticipant() or stopAll(), so its use may result in undefined behaviour.

Parameters