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

Simplify conditional fed codegen #970

Merged
merged 10 commits into from
Feb 18, 2022
Merged

Conversation

edwardalee
Copy link
Collaborator

This PR is a small step towards improving the C codegen structure. It includes the following:

  • Disallow ports in top-level reactors and remove such ports from one test that had them.
  • Merge nearly identical methods in CGenerator into one consolidated method.
  • Homogenize the way that the generator determines which components are included in a federate.
  • A few other small fixes.

@Soroosh129
Copy link
Contributor

It looks like a few validation tests have ports in the main reactor.

Copy link
Contributor

@Soroosh129 Soroosh129 left a comment

Choose a reason for hiding this comment

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

This PR makes the CGenerater code a lot cleaner!
I think we should perhaps wait for @housengw to see if these changes would interfere with his work in #958.

One note: It looks like I had missed the addition of currentFederate as a class variable in a previous PR. I think relying on currentFederate could make it harder to break the CGenerator into multiple, smaller generators (like the CppGenerator).

@housengw
Copy link
Contributor

the code changes that overlap with #958 are minor. Is there a reason behind using currentFederate instead of passing a federate parameter to the code generating functions?

@edwardalee
Copy link
Collaborator Author

the code changes that overlap with #958 are minor. Is there a reason behind using currentFederate instead of passing a federate parameter to the code generating functions?

Every function needs it. We could pass it as a parameter, but it gets pretty tedious.

Copy link
Contributor

@housengw housengw left a comment

Choose a reason for hiding this comment

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

this PR looks good. We just need to keep track of where currentFederate can be modified..

@edwardalee edwardalee merged commit c63b5d2 into master Feb 18, 2022
@edwardalee edwardalee deleted the simplify-conditional-fed-codegen branch February 18, 2022 00:44
@lhstrh lhstrh added the refactoring Code quality enhancement label Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code quality enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants