View Issue Details

IDProjectCategoryView StatusLast Update
0024971Open CASCADEOCCT:Foundation Classespublic2014-11-11 12:52
ReporterabvAssigned Toapn  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version6.7.1 
Target Version6.8.0Fixed in Version6.8.0 
Summary0024971: Incomplete interface of NCollection classes
DescriptionAs revealed during implementation of 0024750, NCollection classes lack some features provided by their TCollection equivalents:

- HArray1, HArr1y2: constructor with additional argument of element_type allowing to initialize the array at construction time by specified value

- List: methods First() and Last() (and method Value() of the iterator) return const &, while in TCollection they return non-const &

- Constructor of NCollection_DataMap::DataMapNode uses operator = to assign its key; hence default constructor is necessary for key type to initialize a node. In TCollection_DataMap, copy constructor is used instead; this allows using type with no default constructor as a key type to a data map. In this, TCollection implementation seems to be more consistent with STL, see e.g. http://msdn.microsoft.com/en-us/library/bb385469.aspx
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0007698 closedagv Wrong behaviour of NCollection_Vector::operator= 

Activities

abv

2014-05-30 16:28

manager   ~0029624

Fix pushed to branches CR24971 in OCCT and Products, please review

abv

2014-06-02 08:10

manager   ~0029625

Note that one drawback of this change is that now it is not any more possible to use one container type directly as element of another one, since most of containers do not provide public copy constructor. Such cases can be corrected via use of Handles. The changes of this kind in Visualization are included (mostly use HSequence instead of Sequence in List).

kgv

2014-06-02 17:51

developer   ~0029636

Please test the patch.

apv

2014-06-04 11:52

tester   ~0029668

Last edited: 2014-06-04 11:54

Dear BugMaster,

Branch CR24971 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 8686432248a5aec5d1c1bfa301b28e8e5ea8964c
SHA-1: d8e84d5bb6e0d684b6849b663d0d508ff056fac1

Number of compiler warnings:

Linux: 16 (16 on master)
Windows: 0 (0 on master)
MacOS: 200 (203 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
omf - emesh (014) - A2, A3, A4, A6, A7, B1, B2, B3, B4, B5, B6, B7
omf - quality 9015) - A1, A2, A3, A4, B1, B2, B3, B4, C1

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 376012688 / 383800460
Total CPU difference: 40887.671875 / 42820.09375

Testing on Windows:
Total MEMORY difference: 376012688 / 383800460
Total CPU difference: 40887.671875 / 42820.09375

abv

2014-06-05 09:01

manager   ~0029684

The regression is caused by bug in copy constructor of NCollection_Vector, which creates invalid copy if original vector is empty. This problem has been fixed long ago for assignment operator (see 0007698), but not for copy constructor.

The trigger for regression to appear was change made in 0024971 to use copy constructor instead of assignment operator in list, sequence, and maps.

abv

2014-06-05 10:57

manager   ~0029691

I have pushed fix to CR24971, please re-test

mkv

2014-06-06 14:53

tester   ~0029733

Dear BugMaster,

Branch CR24971 from occt git repository and CR24971 from products git repository are compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: aaf0fb30b8b738e846df9fc11a99cce42480ec36
SHA-1: d600ace5089adfc5193c439daa2eb890e33a44c6

Number of compiler warnings:

occt component :
Linux: 16 (16 on master)
Windows: 0 (0 on master)
MacOS: 200 (203 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 347767356 / 361261972
Total CPU difference: 48794.049999999865 / 53203.24999999999

Testing on Windows:
Total MEMORY difference: 376076616 / 383786928
Total CPU difference: 39641.53125 / 42819.859375

There are no differences in images found by testdiff.

Related Changesets

occt: master e3a6386d

2014-06-11 06:43:27

abv


Committer: apn Details Diff
0024971: Incomplete interface of NCollection classes

NCollection classes amended to be compatible with TCollection equivalents:

- List and Maps: copy constructor is used for placement of new items in collection instead of assignment operator, thus default constructor is not necessary any more for the item class
- Constructors with additional argument of element type added in array classes operated by Handle, defined by NCollection_DefineHArray*.hxx, allowing to initialize array immediately by specified value
- Non-const methods First() and Last() are added in List class, and method Value() in TListIterator class
- Method Append() accepting Handle(HSequence) provided in NCollection_DefineHSequence.hxx
- Default implementation of global function IsEqual() is provided as template (using operator ==)

Code using lists and maps of sequences is refactored to operate sequence by Handle (since Sequence does not to have public copy constructor).

In addition, error checking code is simplified to use macros _Raise_if instead of custom #ifdefs with the same meaning.
Comments within declaration of instances of generic classes in CDL removed.

Fixed bug in copy constructor of NCollection_BaseVector leading to corrupt data if original vector is empty; simplistic test command for vectors is added.
Affected Issues
0024971
mod - src/AIS/AIS_LocalContext_1.cxx Diff File
mod - src/CDM/CDM.cdl Diff File
mod - src/IGESBasic/IGESBasic.cdl Diff File
mod - src/Interface/Interface.cdl Diff File
mod - src/MeshTest/MeshTest_CheckTopology.cxx Diff File
mod - src/MeshTest/MeshTest_CheckTopology.hxx Diff File
mod - src/MeshVS/MeshVS_Mesh.cxx Diff File
mod - src/NCollection/NCollection_Array1.hxx Diff File
mod - src/NCollection/NCollection_Array2.hxx Diff File
mod - src/NCollection/NCollection_BaseVector.hxx Diff File
mod - src/NCollection/NCollection_DataMap.hxx Diff File
mod - src/NCollection/NCollection_DefaultHasher.hxx Diff File
mod - src/NCollection/NCollection_DefineHArray1.hxx Diff File
mod - src/NCollection/NCollection_DefineHArray2.hxx Diff File
mod - src/NCollection/NCollection_DefineHSequence.hxx Diff File
mod - src/NCollection/NCollection_DoubleMap.hxx Diff File
mod - src/NCollection/NCollection_IndexedDataMap.hxx Diff File
mod - src/NCollection/NCollection_IndexedMap.hxx Diff File
mod - src/NCollection/NCollection_List.hxx Diff File
mod - src/NCollection/NCollection_Map.hxx Diff File
mod - src/NCollection/NCollection_Sequence.hxx Diff File
mod - src/NCollection/NCollection_TListIterator.hxx Diff File
mod - src/NCollection/NCollection_TListNode.hxx Diff File
mod - src/Prs3d/Prs3d_NListOfSequenceOfPnt.hxx Diff File
mod - src/Prs3d/Prs3d_WFShape.cxx Diff File
mod - src/QANCollection/QANCollection_Test.cxx Diff File
mod - src/SelectMgr/FILES Diff File
rm - src/SelectMgr/SelectMgr_DataMapOfObjectOwners.hxx Diff File
mod - src/StdPrs/StdPrs_WFDeflectionRestrictedFace.cxx Diff File
mod - src/StdPrs/StdPrs_WFRestrictedFace.cxx Diff File
mod - src/StdPrs/StdPrs_WFSurface.cxx Diff File

Issue History

Date Modified Username Field Change
2014-05-29 09:16 abv New Issue
2014-05-29 09:16 abv Assigned To => abv
2014-05-29 10:52 abv Description Updated
2014-05-30 16:28 abv Note Added: 0029624
2014-05-30 16:28 abv Assigned To abv => kgv
2014-05-30 16:28 abv Status new => resolved
2014-06-02 08:10 abv Note Added: 0029625
2014-06-02 17:51 kgv Note Added: 0029636
2014-06-02 17:51 kgv Assigned To kgv => bugmaster
2014-06-02 17:51 kgv Status resolved => reviewed
2014-06-03 11:37 bugmaster Assigned To bugmaster => apn
2014-06-04 11:13 apv Test case number => Not needed
2014-06-04 11:52 apv Note Added: 0029668
2014-06-04 11:54 apv Note Edited: 0029668
2014-06-04 11:54 apv Assigned To apn => abv
2014-06-04 11:54 apv Status reviewed => assigned
2014-06-05 08:58 abv Relationship added related to 0007698
2014-06-05 09:01 abv Note Added: 0029684
2014-06-05 10:57 abv Note Added: 0029691
2014-06-05 10:57 abv Status assigned => resolved
2014-06-05 10:57 abv Assigned To abv => bugmaster
2014-06-05 10:57 abv Status resolved => reviewed
2014-06-05 11:23 mkv Assigned To bugmaster => mkv
2014-06-06 14:53 mkv Note Added: 0029733
2014-06-06 14:53 mkv Assigned To mkv => bugmaster
2014-06-06 14:53 mkv Status reviewed => tested
2014-06-17 17:22 apn Changeset attached => occt master e3a6386d
2014-06-17 17:22 apn Assigned To bugmaster => apn
2014-06-17 17:22 apn Status tested => verified
2014-06-17 17:22 apn Resolution open => fixed
2014-11-11 12:46 aiv Fixed in Version => 6.8.0
2014-11-11 12:52 aiv Status verified => closed