Obtain IDL for a registered DDS_TypeCode

2 posts / 0 new
Last post
Last seen: 6 days 12 hours ago
Joined: 10/23/2013
Posts: 42
Obtain IDL for a registered DDS_TypeCode

Is there an API what will give me the IDL-equivalent for a DDS_TypeCode that has been previously registered?  Since the Admin Console can display IDL information, I assume this is possible but haven't been able to find appropriate function.



Gerardo Pardo's picture
Last seen: 4 months 5 days ago
Joined: 06/02/2010
Posts: 594

There is a TypeCode_printIDL() function (in the C API and equivalent in other languages) that does this but unfortunately it outputs the IDL using the Connext DDS logging facility. So it is not so simple to use as a general-purpose function.

Admin Console implemented the output to IDL function in Java as part of the AdminConsole tool itself. Not sure why we did it that way...  We probably should have extended TypeCode_printIDL() to output to a string buffer instead...

Depending on the use-case it may still be possible for you to use TypeCode_printIDL() with a bit of hacking. Note that I have not tried my suggestions below so there may be some gotchas...

As I mentioned the  TypeCode_printIDL() uses the RTI Logging facility. By default this outputs to stdout but you could change it to output to a file instead or even to your own function.

To do this you would use NDDS_Config_Logger_get_instance() to get the NDDS_Config_Logger singleton and then call either NDDS_Config_Logger_set_output_file() to direct the output to a file, or else NDDS_Config_Logger_set_output_device() to direct it to your own function.

Note that this re-direction will affect other logging output.