Portable interfaces to standard DDS - enum values

2 posts / 0 new
Last post
Offline
Last seen: 3 years 2 months ago
Joined: 09/07/2021
Posts: 1
Portable interfaces to standard DDS - enum values

When creating an interface (IDL) for RTI Connext - I can create an enumeration with constant values. To interface to users using openDDS this doesn't work - enums can't have values. Is there a recommended design idea to create an interface where I can use these constant values? It seems like if I want to use an enum portably then I need to carry an additional header with constants to map the enums to the values I want.

 

Organization:
Keywords:
Howard's picture
Offline
Last seen: 3 hours 39 min ago
Joined: 11/29/2012
Posts: 605

Hi Dominic,

Well, unfortunately, even though RTI's support of the IDL 4.0 standard includes the assignment of values to enums, the open source openDDS doesn't.  You can try to get the maintainers of openDDS to do so...

A kludge is to define constants in IDL

 

const long ORANGE = 1;

const long APPLE = 2;

etc.

And then use a "long" as the datatype of the enumeration.  You lose the type safety, but get defined values for symbols.