-
Notifications
You must be signed in to change notification settings - Fork 316
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
[All] Refactor create/cancreate in ObjectFactory #5195
base: master
Are you sure you want to change the base?
[All] Refactor create/cancreate in ObjectFactory #5195
Conversation
@damienmarchal in case you missed them, there are some compilation errors |
@@ -260,13 +290,51 @@ class ObjectCreator : public ObjectFactory::Creator | |||
public: | |||
bool canCreate(objectmodel::BaseContext* context, objectmodel::BaseObjectDescription* arg) override | |||
{ | |||
RealObject* instance = nullptr; | |||
return RealObject::canCreate(instance, context, arg); | |||
if constexpr( HasCanCreateMethod<RealObject>::value ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can now use a concept. I would look like:
if constexpr (requires { RealObject::canCreate; })
Thank @alxbilger for pointing the compilation error. |
@@ -53,6 +53,33 @@ namespace sofa::core | |||
|
|||
class ObjectRegistrationData; | |||
|
|||
template<class T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait for concepts.
This topic has been addressed in a lot of previous postpone PR.
In this one I propose an approach which has a compatibility layer to be not breaking.
The important code is in ObjectFactory.h
All the rest is just there to point where are the "yet to fix" components.
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