Where could i find an example of use of this method?:
virtual DDS_ReturnCode_t DDSDomainParticipant::get_discovered_topics | ( | DDS_InstanceHandleSeq & | topic_handles | ) |
I want to list the names of the existing topics of a participant and this is what I tried:
DDS.InstanceHandleSeq topics = new DDS.InstanceHandleSeq();
_participant.get_discovered_topics(topics);
for (int i = 0; i < topics.length; i++) {
DDS.InstanceHandle_t tp = topics.get_at(i);
System.Diagnostics.Debug.WriteLine("Server CommandPublisher - contains topic" + tp.ToString());
}
But this it the output:
Server CommandPublisher - contains topic40765393.442A0000.1000000.A060000
Server CommandPublisher - contains topic40765393.442A0000.1000000.A070000
Server CommandPublisher - contains topic40765393.442A0000.1000000.A050000
Server CommandPublisher - contains topic0.40010000.FFFFFFFF.1000000
Hey,
You are about half way there.
Looking at the Java documentation (but I suspect C and C++ also support this), there is a method called get_discovered_topic_data which receives an instance handle (basically: the ID of the entity, in this case a topic) and a TopicData object and return the filled out topic data (which you can then access to see the name of the topic, for example, or the type it uses).
a link: http://community.rti.com/rti-doc/510/ndds/doc/html/api_java/interfacecom_1_1rti_1_1dds_1_1domain_1_1DomainParticipant.html#a6570a42371264e26acde1b5c6915ce20
Good luck,
Roy.
Thanks a lot! I finally got it following your advice. This is the result, in case it could be useful to somebody (for .NET):
DDS.InstanceHandleSeq topics = new DDS.InstanceHandleSeq();
_participant.get_discovered_topics(topics);
for (int i = 0; i < topics.length; i++) {
DDS.InstanceHandle_t tp = topics.get_at(i);
TopicBuiltinTopicData topic_data = new TopicBuiltinTopicData();
_participant.get_discovered_topic_data(topic_data, ref tp);
System.Diagnostics.Debug.WriteLine("participant contains topic: " + topic_data.name);
}