Open tlmquintino opened 13 years ago
why? derived_type_name returns this info
This will uniquely identify builders of components with same class name.
Example:
And it makes sense from the type mechanism point of view: if you want to ask a certain class what type it is, this will return the full qualified type.
Moreover (Willem points out) that this will allow to use regex to parse the namespace (and thus the library) from within the typename.
I just found another bug because this is missing:
We have a components common::Action solver::Action
Making a factory for both is now impossible, as the factories only look at the typename "Action". A static knowledge of the full typename is necessary.
Tiago had made a private sandbox with "A" solution, but I still think it is best just to type the full namespace names in the returned type_name() function
Yep. I agree. The sandbox solution is very complex. Putting the namespace there will be simpler.
But be sure to do it:
std::string type_name() { return LibMesh::namespace() +".Field"; }
derived_type_name returns this info, true. but it has 2 flaws:
derived_type_name is useful to ensure that an existing (dynamic) component has a unique classname under different operating systems. Eventually, the CBuilder should register the name just using the type_name() directly, without needing to add the library namespace.
example:
not
Question is, can we do this more automatically?