Archived issue #0029814
Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
Description
Sometimes it is needed to check if TopoDS_Shape has any sub-shapes / has only single sub-shape (for example, when creating an empty TopoDS_Compound).
Using TopoDS_Iterator in this context is annoying (requires several lines of code for creation, Next() + More()).
So that it is proposed adding a method TopoDS_Shape::NbChildren() which would allow making these queries simple and compact.
Using TopoDS_Iterator in this context is annoying (requires several lines of code for creation, Next() + More()).
So that it is proposed adding a method TopoDS_Shape::NbChildren() which would allow making these queries simple and compact.
Steps to reproduce
N/A
Public activity
14 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu May 24 18:06:37 2018 +0300
0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
TopoDS_Shape::NbChildren() - new method has been introduced.
TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx.
TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu May 24 18:06:37 2018 +0300
0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
TopoDS_Shape::NbChildren() - new method has been introduced.
TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx.
TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros.
Patch is ready for review.
Some remarks:
1. Is "#include <TopoDS_Shape.hxx>" really needed at the end of TopoDS_TShape.hxx? Can we avoid having cyclic inclusion here?
2. Please stop reorganizing the code of touched headers by moving DEFINE_STANDARD_HANDLE() macro to the end of the header file. The default variant (inherited from CDL times) is when it is located before definition of relevant class, and it is how this is done in most places. If you think it should be moved to the end, please do this systematically for the whole code base in the frames of separate issue.
3. Note that Standard_Type.hxx includes (directly or indirectly) most of general headers from Standard (Standard.hxx, Standard_Transient.hxx, Standard_Boolean.hxx etc.), thus including it alone is sufficient in most cases.
1. Is "#include <TopoDS_Shape.hxx>" really needed at the end of TopoDS_TShape.hxx? Can we avoid having cyclic inclusion here?
2. Please stop reorganizing the code of touched headers by moving DEFINE_STANDARD_HANDLE() macro to the end of the header file. The default variant (inherited from CDL times) is when it is located before definition of relevant class, and it is how this is done in most places. If you think it should be moved to the end, please do this systematically for the whole code base in the frames of separate issue.
3. Note that Standard_Type.hxx includes (directly or indirectly) most of general headers from Standard (Standard.hxx, Standard_Transient.hxx, Standard_Boolean.hxx etc.), thus including it alone is sufficient in most cases.
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been updated by Author.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu May 31 10:45:01 2018 +0300
# remove some redundant headers inclusion and comment #include <TopoDS_Shape.hxx> at the end of TopoDS_TShape.hxx
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu May 31 10:45:01 2018 +0300
# remove some redundant headers inclusion and comment #include <TopoDS_Shape.hxx> at the end of TopoDS_TShape.hxx
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu May 24 18:06:37 2018 +0300
0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
TopoDS_Shape::NbChildren() - new method has been introduced.
TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx.
TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros.
Cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx eliminated.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu May 24 18:06:37 2018 +0300
0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
TopoDS_Shape::NbChildren() - new method has been introduced.
TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx.
TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros.
Cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx eliminated.
Reviewed with amendments:
- removed cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx;
- location of DEFINE_STANDARD_RTTI macro is restored in TopoDS_TShape.hxx
- removed cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx;
- location of DEFINE_STANDARD_RTTI macro is restored in TopoDS_TShape.hxx
Testing of branch CR29814_1 passed in Jenkins job CR29814-master-KGV
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: abv
Date: Mon Jun 4 11:50:10 2018 +0300
Places where TopoDS_Iterator is used only for calculation of number of sub-shapes are updated to use NbChildren() instead
[revision removed]
Detailed log of new commits:
Author: abv
Date: Mon Jun 4 11:50:10 2018 +0300
Places where TopoDS_Iterator is used only for calculation of number of sub-shapes are updated to use NbChildren() instead
Testing of updated branch CR29814_1 passed in Jenkins job CR29814-master-KGV
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian70-64:
OCCT
Total CPU difference: 17100.790000000114 / 17011.039999999866 [+0.53%]
Products
Total CPU difference: 7467.240000000033 / 7518.570000000041 [-0.68%]
Windows-64-VC10:
OCCT
Total CPU difference: 16856.594454398568 / 16821.806231398525 [+0.21%]
Products
Total CPU difference: 8228.3039451999 / 8177.369618699882 [+0.62%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian70-64:
OCCT
Total CPU difference: 17100.790000000114 / 17011.039999999866 [+0.53%]
Products
Total CPU difference: 7467.240000000033 / 7518.570000000041 [-0.68%]
Windows-64-VC10:
OCCT
Total CPU difference: 16856.594454398568 / 16821.806231398525 [+0.21%]
Products
Total CPU difference: 8228.3039451999 / 8177.369618699882 [+0.62%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]
Related records