eProsima / Fast-DDS-Gen

Fast-DDS IDL code generator tool. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
80 stars 59 forks source link

allow modern enum class/scoped enums with type specifier and assigning values #291

Closed JSG-0 closed 8 months ago

JSG-0 commented 8 months ago

Scoped enums have been available since C++-11 (13 years ago). Other DDS implementations support this in their IDL. The advantages are well documented.

Add IDL support for scoped enums a.k.a. "enum classes" with a type specified "enum base" that can be any cstdint and allow specifying a value for each enumeration independently, including negative values, and since scoped allow different enums to reuse label names.

JLBuenoLopez commented 8 months ago

@JSG-0

Thanks for your contribution. According to Fast DDS CONTRIBUTING guidelines I am moving this ticket to the Ideas forum where feature requests are discussed.

On the one hand, enum class support has been introduced in #271 into the development branch feature/xtypes_typeobject. This branch will be merged and released soon.

On the other hand, I am afraid that support for @bit_bound builtin annotation that allows modifying the enum base and the @value builtin annotation that allows setting the value of each enumeration literal, is not in the current roadmap. You might contact eProsima's commercial support team to discuss options to accelerate their development.

Regarding the scope, this is something already supported in the current Fast DDS-Gen. Nevertheless I have issued eProsima/dds-types-test#22 to add this specific test case into Fast DDS-Gen CI. The CI is updated in #292.