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

[SofaHelper] Factory key type can be other than std::string #2259

Merged
merged 9 commits into from
Jul 29, 2021

Conversation

alxbilger
Copy link
Contributor

Factories were used only with std::string as a key. That is why it was not noticeable that factories were not compatible with other types than std::string as the key.
The limitations come from:

  • logFactoryRegister assumed Key is a string. It is now a template function.
  • Creator inherits from Key and instances was used such as it was a string. Now, Creator no longer inherits from Key but just stores the key as a class member.

A unit test is added for enum type as a key.

Small downside: std::string& getFactoryLog() is now available outside the translation unit.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request labels Jul 20, 2021
@guparan guparan added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Jul 21, 2021
@alxbilger alxbilger added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Jul 22, 2021
@alxbilger
Copy link
Contributor Author

[ci-build][with-all-tests]

@fredroy
Copy link
Contributor

fredroy commented Jul 23, 2021

Lots of weird stuff happening with those *_API (dllimport/dllexport) thingies 🥴
TIL I learnt that you cannot put it after the type if it is a reference (I suppose the & bothers the compilation)
Seems better to put it always before the type.

@fredroy fredroy added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Jul 28, 2021
@fredroy fredroy merged commit 8dccb6a into sofa-framework:master Jul 29, 2021
@guparan guparan added this to the v21.12 milestone Oct 1, 2021
@alxbilger alxbilger deleted the factory_key branch June 28, 2022 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants