Different instances of DomainParticipant for Modern C++

2 posts / 0 new
Last post
mpichini's picture
Offline
Last seen: 9 months 1 week ago
Joined: 09/16/2015
Posts: 27
Different instances of DomainParticipant for Modern C++

Hi there,

I understand that DomainParticipant (as well as several other DDS entities) are defined as <<ReferenceType>> in modern C++.

I was wondering if there's a way to create two (or even more) DomainParticipant instances for the same domain in a single application.

I know that this is quite a non sense for real applications (just increase the discovery traffic and the amount of DDS resources used by the application), but I'm developing a DDS wrapper library and, for my unit testing environment, it would be usefull to be able to create different participants in the same applications.

Is there any way of doing this ?

kind regards

Massimo

mpichini's picture
Offline
Last seen: 9 months 1 week ago
Joined: 09/16/2015
Posts: 27

It was a my misunderstanding caused by the find function.

In fact it is allowed to create two or more participants for the same domain, but the find function will only return the first participant created for the same domain. If you create a participant with the copy constructor or you assign a participant to another the reference semanthic takes place and you will not create another instance.

Sorry for my misunderstanding