Rtiddsgen2 and Custom Directives

2 posts / 0 new
Last post
Last seen: 7 months 3 weeks ago
Joined: 05/20/2015
Posts: 5
Rtiddsgen2 and Custom Directives

Hey guys,

I am looking for a way to add some custom directives to our IDL definitions.  I would like to be able to specify some tags and metadata for each of the fields we define.  These IDL files are run through rtiddsgen2 to generate the C++11 code, and then run through a second time with the -convertToXml switch so that we can easily parse these files in a C# application.  I'd like to be able to get this metadata into the XML files so that we can have access to them in the C# app for things like UI input validation and such.  I don't need these to appear in any of the C++ generated code, but right now, any unrecognized directive blows up rtiddsgen instead of just ignoring it.

For example:


struct ThisIsAStruct 
    long field1; //@key 
                 //@minvalue 10 
                 //@maxvalue 100 

And the converted XML would look like this:

<struct name="ThisIsAStruct">
    <member name="field1" id="1" type="long" key="true" minvalue="10" maxvalue="100"/>

Is this possible via some Velocity template magic?  Or do you have any other suggestions to accomplish this?


Last seen: 2 years 5 months ago
Joined: 01/17/2013
Posts: 23


Rtiddsgen does not support parsing custom directives. As you mention, the current version of rtiddsgen is throwing an error when it founds a unrecognized annotation and it does not generates code. We have an issue filled for this problem (CODEGENII-551) and it is going to be fixed in the 5.2.0 Maintenance Release (5.2.3) scheduled for the end of Q2. In that release rtiddsgen will just show a warning for the unrecognized annotation but it will  generate code.  However, the custom directive is just ignored so there is no template magic to include that information in the generated code yet.