Archived issue #0024487
Getting rid of generic CDL classes
Description
In context of planned elimination of WOK and CDL it is necessary to get rid of generic CDL classes in OCCT or at least to minimize their number as possible.
The problem is that generic classes are defined through CDL and instantiated to C++ via macro substitution. Each instantiation is represented by two automatically generated files (hxx and cxx) which define this substitution and #include original code. This will be difficult to track and maintain without WOK.
Other major problem with generic classes is that they are practically not usable in debugging: debugger does not recognize relation between source code and symbols in object code.
The steps to be done are:
1. Build a list of existing generic classes and check where each is used
2. Classes which are not used (and other unused stuff found in the process) to be removed
3. Generic classes used in single place should be converted to plan C++ classes
4. Instantiations of TCollection classes should be replaced by NCollection equivalents
5. Remaining classes should be converted to C++ templates or kept as-is (in any case GXX files should be removed from inc folder)
The problem is that generic classes are defined through CDL and instantiated to C++ via macro substitution. Each instantiation is represented by two automatically generated files (hxx and cxx) which define this substitution and #include original code. This will be difficult to track and maintain without WOK.
Other major problem with generic classes is that they are practically not usable in debugging: debugger does not recognize relation between source code and symbols in object code.
The steps to be done are:
1. Build a list of existing generic classes and check where each is used
2. Classes which are not used (and other unused stuff found in the process) to be removed
3. Generic classes used in single place should be converted to plan C++ classes
4. Instantiations of TCollection classes should be replaced by NCollection equivalents
5. Remaining classes should be converted to C++ templates or kept as-is (in any case GXX files should be removed from inc folder)
Public activity
5 archived notes
Participants are labeled by their role within this record.
Changes are ready for review in CR24487 branch.
I have redefined this issue as general for dealing with generic classes; particular fixes are to be done within separate issues, children of this one
I have attached file Attachment 1 (TXT), which is result of executing the following command on the current master:
> cd inc; ls -1 *.gxx | gawk '{print($1); system("grep " $1 " ../src/*/* ../drv/*/* ../inc/* /dev/null")}' >../gxx
The log thus shows where each of GXX files found in inc folder is used.
The files which are not used anywhere (e.g. AppBlend_Line.gxx) and relevant classes can be removed immediately, I suppose (to be checked: perhaps they are still used indirectly somehow? e.g. pure abstract classes...)
The files used once (such as AppParCurves_Variational.gxx) highlight generic classes which are first candidates for conversion to plain C++ classes.
The files referred from src and/or inc folder (such as GCPnts_AbscissaPoint.gxx) most likely do not correspond to real CDL generic classes but just a way to abuse WOK. They should be analyzed on case-by-case basis.
> cd inc; ls -1 *.gxx | gawk '{print($1); system("grep " $1 " ../src/*/* ../drv/*/* ../inc/* /dev/null")}' >../gxx
The log thus shows where each of GXX files found in inc folder is used.
The files which are not used anywhere (e.g. AppBlend_Line.gxx) and relevant classes can be removed immediately, I suppose (to be checked: perhaps they are still used indirectly somehow? e.g. pure abstract classes...)
The files used once (such as AppParCurves_Variational.gxx) highlight generic classes which are first candidates for conversion to plain C++ classes.
The files referred from src and/or inc folder (such as GCPnts_AbscissaPoint.gxx) most likely do not correspond to real CDL generic classes but just a way to abuse WOK. They should be analyzed on case-by-case basis.
Considered as fixed with OCCT 7.0 since there are no CDL there. Remains of generic classes will be removed later in the frames of separate issues.
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records
- #0024545 · parent of · closedConvertation of the generic classes to the non-generic (XmlObjMgt)
- #0024547 · parent of · closedConvertation of the generic classes to the non-generic (math)
- #0024552 · parent of · closedConvertation of the generic classes to the non-generic (BndLib)
- #0023959 · parent of · closedGetting rid of generic classes in Visualization
- #0023997 · parent of · feedbackGetting rid of generic classes in DataExchange
- #0024553 · parent of · closedDeleting obsolete/unused ".gxx" files from "GCPnts"
- #0024742 · parent of · closedRemove rarely used collection classes
- #0024748 · parent of · closedRemove unused instantiations of collection classes
- #0024750 · parent of · closedReplace instantiations of TCollection generic classes by NCollection templates
- #0024778 · parent of · closedConvertation of the generic classes to the non-generic. Part 9
- #0024773 · parent of · closedConvertation of the generic classes to the non-generic. Part 7
- #0024761 · parent of · closedConvertation of the generic classes to the non-generic. Part 5
- #0024763 · parent of · closedConvertation of the generic classes to the non-generic. Part 6
- #0024774 · parent of · closedConvertation of the generic classes to the non-generic. Part 8
- #0024734 · parent of · closedConvertation of the generic classes to the non-generic. Part 4
- #0024683 · parent of · closedConvertation of the generic classes to the non-generic. Part 1
- #0024727 · parent of · closedConvertation of the generic classes to the non-generic. Part 3
- #0024662 · parent of · closedRemoving unused "generic" classes. Part 3
- #0024663 · parent of · closedRemoving unused "generic" classes. Part 4
- #0024660 · parent of · closedRemoving unused "generic" classes. Part 1
- #0024661 · parent of · closedRemoving unused "generic" classes. Part 2
- #0024708 · parent of · closedConvertation of the generic classes to the non-generic. Part 2
- #0024859 · parent of · closedReplace SortTools by STL equivalents
- #0026850 · parent of · closedReplace nested instantiations of TCollection generic classes by NCollection templates
- #0031975 · parent of · closedCoding Rules - get rid of generic classes in Adaptor3d_GenHSurface
- #0024866 · related to · newSingle definition of axis-aligned bounding box should be used across OCCT
- #0028966 · related to · closedCoding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSurface classes
- #0031025 · related to · closedCoding - declared but unimplemented methods BRepBlend_AppSurf
- #0024002 · child of · closedOverall code and build procedure refactoring
- #0024784 · child of · closedMove documentation in CDL files to proper location