DiscussionsIssue archiveOCCT:Modeling Data

Archived issue #0029814

Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number

Open CASCADEOCCT:Modeling Dataclosed14 public notes

Search issues

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.

Steps to reproduce

N/A

Public activity

14 archived notes

Participants are labeled by their role within this record.

01Commenter 2
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.
02Author
Patch is ready for review.
03Commenter 3
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.
04Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
05Commenter 2
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

06Author
07Commenter 2
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.
08Commenter 8
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
09Commenter 9
Testing of branch CR29814_1 passed in Jenkins job CR29814-master-KGV
10Commenter 2
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

11Commenter 11
Testing of updated branch CR29814_1 passed in Jenkins job CR29814-master-KGV
12Commenter 1
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
13Commenter 2
Branch [archived branch] has been deleted by Author.

[revision removed]
14Commenter 2
Branch [archived branch] has been deleted by Author.

[revision removed]

Related records