Skip to content
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

Adding dynamic data enum example #640

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

angelrti
Copy link
Member

@angelrti angelrti commented Nov 24, 2023

Summary

This PR adds an example that shows how to use DynamicData Enums and get their member ordinal values by name (string).

Checks

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added a new C/C++ example and updated examples/connext_dds/CMakeList.txt accordingly.

Copy link

The compilation is starting. Take a look here.

Copy link

The compilation is starting. Take a look here.

Copy link

Everything is OK. Thank you for the PR!

1 similar comment
Copy link

Everything is OK. Thank you for the PR!

Copy link

The compilation is starting. Take a look here.

Copy link

The compilation is starting. Take a look here.

Copy link

Everything is OK. Thank you for the PR!

1 similar comment
Copy link

Everything is OK. Thank you for the PR!

@alexcamposruiz
Copy link
Contributor

alexcamposruiz commented Jan 26, 2024

This looks like a really granular and small example. I don't think it makes sense to create a brand new example instead of adding the relevant code to the documentation, the KB, or incorporating it into an existing example.

{ EnumMember("off", 0), EnumMember("on", 42) });
}

DynamicType create_struct_dynamic_type()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be simplified:

{
    return StructType("EnumStruct", { {"engine_state_element", create_enum_type() } });
}

{ EnumMember("off", 0), EnumMember("on", 42) });
}

DynamicType create_struct_dynamic_type()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DynamicType create_struct_dynamic_type()
StructType create_struct_dynamic_type()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants