Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDL enum issues - Same enumerator names, and a value specified [13812] #90

Closed
webhoppery opened this issue Feb 7, 2022 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@webhoppery
Copy link

Example : Test.idl (Test.txt attached)

Errors with : UNKNOWN = 0,
Had to Edit : UNKNOWN , // = 0,

Same enumerator names - UNKNOWN

cmake ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.30.30706.0
cmake --build .
Test.cxx(44,46): error C2365: 'orov::msg::system::UNKNOWN': redefinition; previous definition was 'enumerator'

Test.h : Edit enum to enum class
Test.cxx(46,47): error C2065: 'UNKNOWN': undeclared identifier

Test.cxx : Prefix UNKNOWN with enum name ::
m_crc_result = orov::msg::system::EChecksumResult::UNKNOWN;
m_reset_cause = orov::msg::system::EMCUResetCause::UNKNOWN;

But other statements prefix with the enum name :
Test.txt

Could fastddsgen assume the enum is enum class and prefix UNKNOWN?

 m_crc_result = (orov::msg::system::EChecksumResult)enum_value;
m_reset_cause = (orov::msg::system::EMCUResetCause)enum_value;
@JLBuenoLopez JLBuenoLopez changed the title IDL enum issues - Same enumerator names, and a value specified IDL enum issues - Same enumerator names, and a value specified [13812] Feb 8, 2022
@zip-link
Copy link

zip-link commented May 9, 2022

I use the gen program of version 2.0.0 and use @ value to specify the default value of enum, but the actual value is 0, 1, 2 and 3; Has this problem been solved.

enum Enumeration
{
@value(10) RED,
GREEN,
BLUE
};

@JLBuenoLopez
Copy link
Contributor

Hi @webhoppery,

As @zip-link comment states, the proper way defined by the OMG IDL specification to set specific values into an Enumerator is using the builtin annotation @value. Consequently, instead of UNKNOWN = 0,, you should write @value(0) UNKNOWN,.

However, @zip-link is right and this builtin annotation is not yet supported in Fast DDS-Gen. I have just issued eProsima/Fast-DDS-docs#368 to clarify this point in the documentation. And I will leave this issue open until @value annotation is supported by Fast DDS-Gen.

@JLBuenoLopez JLBuenoLopez added the enhancement New feature or request label Sep 29, 2023
@JLBuenoLopez
Copy link
Contributor

Labeling this ticket as an enhancement as it is something not yet supported (though defined in the specification). Moving the ticket to the Ideas discussion forum where enhancements and feature requests are discussed.

@eProsima eProsima locked and limited conversation to collaborators Sep 29, 2023
@JLBuenoLopez JLBuenoLopez converted this issue into discussion #235 Sep 29, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants