DiscussionsIssue archiveOCCT:Application Framework

Archived issue #0029385

OCAF - TDataStd_IntPackedMap lacks interface to set map as TColStd_PackedMapOfInteger

Open CASCADEOCCT:Application Frameworkclosed11 public notes

Search issues

Description

TDataStd_IntPackedMap provides interface to access stored map as both const TColStd_PackedMapOfInteger& and Handle(TColStd_HPackedMapOfInteger); however, method ChangeMap() accepts only Handle(TColStd_HPackedMapOfInteger). This means that to set map available as TColStd_PackedMapOfInteger I need to create intermediate TColStd_HPackedMapOfInteger which is inefficient. It would be logical to have interface for setting the map accepting const TColStd_PackedMapOfInteger&

Steps to reproduce

N/A

Public activity

11 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: szy
Date: Thu Dec 28 16:53:41 2017 +0300

    0029385: OCAF - TDataStd_IntPackedMap lacks interface to set map as TColStd_PackedMapOfInteger.
    
    Added method ChangeMap (const TColStd_PackedMapOfInteger& theMap).
02Commenter 2
03Commenter 3
In the method TDataStd_IntPackedMap::ChangeMap

it seems the first condition is useless:
if(theMap.IsEmpty()) return Standard_False;

It must be possible to set the empty map and it must change the content of an attribute.
04Commenter 4
In fact this behavior is already implemented in method TDataStd_IntPackedMap::Clear () which cleans current map.
I.e. the map becomes empty exactly as you noticed. I think that adding the second possibility to set empty map looks as extra.
05Commenter 5
I cannot agree: if I call ChangeMap(), I want the attribute to store exactly the map I given as argument. The map can contain any number of items, including zero. It should be stored as well.
06Commenter 6
I agree with Andrey: it is unexpected behavior if the user calls ChangeMap, but it does nothing.
07Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: szy
Date: Thu Dec 28 16:53:41 2017 +0300

    0029385: OCAF - TDataStd_IntPackedMap lacks interface to set map as TColStd_PackedMapOfInteger
    
    // ChangeMap with empty map is allowed.
    
    0029385: OCAF - TDataStd_IntPackedMap lacks interface to set map as TColStd_PackedMapOfInteger.
    
    Added method ChangeMap (const TColStd_PackedMapOfInteger& theMap).
08Commenter 8
09Commenter 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: 18554.749999999753 / 18498.959999999654 [+0.30%]
Products
Total CPU difference: 7488.03999999999 / 7484.560000000007 [+0.05%]
Windows-64-VC10:
OCCT
Total CPU difference: 18025.9155499985 / 17960.90993329856 [+0.36%]
Products
Total CPU difference: 8059.042860199995 / 8020.448212799986 [+0.48%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
10Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
11Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]