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

Zivid 8878 support nested data model types #293

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

Conversation

johningve
Copy link
Contributor

This PR updates the datamodel wrapper and frontend generator to support nested datamodels.

It won't build yet due to lacking IsDataModelRoot trait

TypeName returns the name of the Python type that represents a data
model node. For a nested datamodel this is the wrapped class of
the nested datamodel.
Nested datamodels are stored within the datamodel frontend as instances
of the frontend of the nested datamodel model.
@johningve johningve requested a review from a team as a code owner November 27, 2024 13:49
Copy link
Contributor

@vawale vawale left a comment

Choose a reason for hiding this comment

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

looks good to me. Would be easier to review with an example of nested datamodel type in python generated code :)


std::array<char, prefixLength + nameLength + 1> result{ '\0' };

// TODO: Switch to std::copy_n when we can switch to C++20 and drop support for GCC 9.
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: maybe mention that std::copy is not used because it is not constexpr before C++20?

datamodel_name = child.underlying_zivid_class.value_type.split(".")[-1]
datamodel_name_snake = _to_snake_case(datamodel_name)
child.is_nested_datamodel = True
datamodel_snake_case = _to_snake_case(datamodel_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

datamodel_name_snake and datamodel_snake_case are the same thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops

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

Successfully merging this pull request may close these issues.

2 participants