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

Support nested variable groups #537

Merged
merged 5 commits into from
Mar 27, 2020

Conversation

ljamt
Copy link
Member

@ljamt ljamt commented Mar 12, 2020

Creating a PR of the status after last mob session.
Tests are failing as we need to create connections from nested variable groups

Closes #536

}
return get_variable_group_variables(nestedDescriptions, element, connector);
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't like to build up the nestedDescription map here. If the variable_goup_decsriptions in the variable_group_description struct (line 560) was a map instead of a vector, we could have this recursion without building up temporary maps.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. Is there any reason to not make it a map?

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't think so. Just didn't want to make changes in the parser now. Let's do this as a separate refactoring task for the ´cse_config_parser´

@ljamt
Copy link
Member Author

ljamt commented Mar 25, 2020

Did an attempt on connecting variables within nested variable groups.

Copy link
Contributor

@hplatou hplatou left a comment

Choose a reason for hiding this comment

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

LGTM

@ljamt ljamt changed the title IN PROGRESS: Support nested variable groups Support nested variable groups Mar 27, 2020
Copy link
Member

@kyllingstad kyllingstad left a comment

Choose a reason for hiding this comment

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

What has been added since the mob session looks good, though I do agree that it might be better to use a map for variable_group_description::variable_group_descriptions.

Marking this as "approved" despite the fact that I have some comments, since getting this in is urgent. Also, none of the issues are really critical. They can be taken care of during a future (inevitable, I'd say) clean-up of the entire parser. Fix if you have the time, otherwise we'll do it later.


std::string variableName = tc(variableElement->getAttribute(tc("name").get())).get();
vgd.variables.push_back(std::move(variableName));
for (auto variableGroupChildElement = variableGroupElement->getFirstElementChild(); variableGroupChildElement != nullptr; variableGroupChildElement = variableGroupChildElement->getNextElementSibling()) {
Copy link
Member

Choose a reason for hiding this comment

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

There are some reeeeally long lines of code in this file, and it's actually a bit tricky to see the end of lines like this one due to how GitHub places the horizontal scroll bar.

I'm not going to suggest that we use this PR to reformat the entire file, but it would be nice if added/modified code was made a tad more readable. ;)

}
return get_variable_group_variables(nestedDescriptions, element, connector);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Agreed. Is there any reason to not make it a map?

test/cpp/cse_config_parser_test.cpp Outdated Show resolved Hide resolved
@@ -562,6 +562,7 @@ struct variable_group_description
std::string name;
std::string type;
std::vector<std::string> variables;
std::vector<variable_group_description> variable_group_descriptions;
Copy link
Member

Choose a reason for hiding this comment

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

I think groups or subgroups would be a more descriptive name for this.

@ljamt
Copy link
Member Author

ljamt commented Mar 27, 2020

Leaving the comments unresolved for a coming refactoring task.

@ljamt ljamt merged commit 2ea32f1 into master Mar 27, 2020
@ljamt ljamt deleted the feature/536-support-nested-variable-groups branch March 27, 2020 15:09
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.

Support nested variable groups
3 participants