Start refactoring of ObjectFactory#6162
Conversation
|
I would be happy to discuss this point and it is worth having a look there as there was lengthy discussion on the topic in the past. If I remember correctly, the general idea was that both canCreate and create should be removed.
To move forward the idea was thus to:
If there is a deep refactoring of ObjectFactory, I would also recommand adding the namespace features and user define aliases suggested in: And also to remove the use of GetClass which cause a code bloat. |
|
|
||
| const objectmodel::BaseClass* getClass() override | ||
| { | ||
| return RealComponent::GetClass(); |
There was a problem hiding this comment.
If we are refactoring component factory could we drop this please.
If I remenber correctly this single line is causing a compilation code bloat (just to provide the class name). When we are registering a component into the factory the class name could be passed with a std::string instead of relying a complex custom "reflection" system.
There was a problem hiding this comment.
For now, the only reason I had to keep this function was to list components deriving from another, using the method hasParent in BaseClass. If we find another mechanism for that (or if we remove this feature), we can remove this usage in the factory.
Early stage of a simplification of the object factory (now
ComponentFactory).Two unanswered questions:
canCreate)? And how to get rid ofcreate?runSofacompiles, but no guarantee for others.Current changes allow:
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