RISCSoftware / cpacs_tigl_gen

Generates CPACS schema based classes for TiGL
Apache License 2.0
5 stars 5 forks source link

BUG: Base classes not used anymore #36

Closed rainman110 closed 4 years ago

rainman110 commented 4 years ago

I am trying to rebase the branch profiles_with_kinks and I experienced a bug in the generator, leading to the deletion of CPACSPointListXYZVector , which should be the base class of CPACSCurvePointListXYZ.

Commit ab134b35f2508092c introduced this bug, which :

rainman110 commented 4 years ago

The bug can be reproduced with the test case "custombasetype". Here the reference to "CPACSBase" is completely missing.

RlanderRISCSW commented 4 years ago

Ok, the removal of the base class was done intentionally: The problem is that we are storing information about the CPACS tree hierarchy in our generated types via the parent pointers. Now when a type extends another type via inheritance, we would also inherit the parent pointers of the base type, which might be completely unrelated to the positions where the derived type can occur. In order to cope with this issue I extended the code generator to check whether parent pointers are generated or not. In case parent pointers are generated, the xml-schema type extension is realized by integrating the member variables of the base type in the extending type. This way the new type still has all the members of the base type but does not inherit constructors which point to completely unrelated types. We never ran into this problem so far, since we only needed the parent pointers for selected types. But for the UID reference and invalidation logic the parent pointers are necessary for all types which have a UID or can reference a UID. So the number of types which have a parent pointer increased a lot. One possibility to solve this problem, in case you really need a common base class, is to implement a custom class CCPACSCurvePointListXYZ and use virtual inheritance for inheriting from a common type.

This change probably explains your second problem. The removal of CPACSPointListXYZVector could happen when it is never directly used as type. Have you checked if this is the case?

rainman110 commented 4 years ago

I get it. I try to change the code to not use CPACSPointListXYZVector anymore. If I succeed, we can close this issue.

I simply was not aware, that this behavior is intentional.

rainman110 commented 4 years ago

Suceeded removing CPACSPointListXYZVector. Closing this issue.