unregistering types

4 posts / 0 new
Last post
Offline
Last seen: 3 months 2 weeks ago
Joined: 10/23/2013
Posts: 42
unregistering types

Is there an API that will return the list of registered topics for a given domain participant to determine topics to delete at shutdown? 

Thanks.

Mark.

Organization:
Keywords:
Gerardo Pardo's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 06/02/2010
Posts: 594

Hi,

Did you mean Topics or Types?  I ask because n DDS speak you 'create' Topics but 'register' types.

Unfortunately I do not think there is an operation to get all the created Topics. It is a good observation. We probably should add one...

The registered types you do need to delete because the TypePlugins are created as a singletons and any state the DomainParticipant saves related to registerd types is deleted when the DomainParticipant is deleted.

If all you want to get the Topics to delete them when you are sutting down, then you may be able to get a similar effect calling the delete_contained_entities operation on the DomainParticipant. This will delete everything the participant contains, including the Topics that it created.

Gerardo

Offline
Last seen: 3 months 2 weeks ago
Joined: 10/23/2013
Posts: 42

I meant types.  Is there an API to get a list of types that have been registered so that I can unregister them at shutdown?

 

Thanks

Mark

rose's picture
Offline
Last seen: 3 days 5 hours ago
Joined: 08/22/2011
Posts: 147

Hello Mark, 

Right now that functionality does not exist.  On platforms other than Windows, you can call participant->delete_contained_entities() and this will clean up all memory associated with the registered type.  If you are running on Windows, you will see a memory leak at shutdown if you do not unregister the type.  To prevent warnings about memory leaks, I have been storing a map of type names and their associated unregister functions so that I can unregister all types:

        std::map<std::string,UnregisterInfo>_typeCleanupFunctions;

You can see the full source file here:

https://github.com/rticommunity/rticonnext-usecases/blob/master/VehicleTracking/ExampleCode/src/CommonInfrastructure/DDSCommunicator.h

Thank you,

Rose