-
Notifications
You must be signed in to change notification settings - Fork 74
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
No way to retrieve numeric value of enums in cpp generated code #944
Comments
Added enum_value member to YLeaf class, which carries int value of the enum member. Expended unit tests for access/check of int value of enum leaf. |
Failed to get enum_value when reading enumeration data from device. |
Developed partial solution for the issue by providing a static function inside generated ydk::Enum inherited class, which translates enum name to enum_value. Here how it looks like in the bundle code:
It would be complete, if the set_value() generated function would set the leaf enum_value automatically. Unfortunately I could not figure out how to do that for the common use, because the enum class could be declared in another C++ file and have different namespace. In current implementation the user should add one line of code to get/set enum_value in a leaf, like this:
|
Expected Behavior
I expect to be able to retrieve the numeric value of an enum in cpp generated code.
Current Behavior
This seems not possible.
Steps to Reproduce
This yang is passed in a bundle to the generator:
This is an excerpt of the cpp generated code for the yang above:
The loglevel field of the main class is of type ydk:YLeaf where the numeric value is not present.
Is there a way to retrieve it?
System Information
YDK-0.8.4
Ubuntu 18.04.2 LTS on a x86_64 machine
The text was updated successfully, but these errors were encountered: