DiscussionsIssue archiveOCCT:Application Framework

Archived issue #0029402

In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.

CommunityOCCT:Application Frameworkclosed9 public notes

Search issues

Description

Customer complaint:

"I am still experiencing problem with fsd files written by the following code:
   Handle(StdStorage_Data) data = new StdStorage_Data();
   .....adding a few roots to data ...
  NCollection_Handle<Storage_BaseDriver> fileDriver(new FSD_File());
  fileDriver->Open(TCollection_ExtendedString(fileName), Storage_VSWrite);
  StdStorage::Write(*fileDriver, data);
The file is written but names associated with different roots are not well preserved in a following StdStorage::Read.
To be more precise the names are associated with wrong shapes in the sense that they are permuted.
I have observed that the proper name association can be reestablished applying a small change to the function "Standard_Boolean StdStorage_RootData::Write(Storage_BaseDriver& theDriver)" which is defined in "src/StdStorage/StdStorage_RootData.cxx".
The changed lines are the following:
  theDriver.SetRootSectionSize(NumberOfRoots());
  int I=0; //HERE A COUNTER IS ADDED
  for (StdStorage_MapOfRoots::Iterator anIt(myObjects); anIt.More(); anIt.Next())
  {
    const Handle(StdStorage_Root)& aRoot = anIt.Value();
    try
    {
      OCC_CATCH_SIGNALS
// theDriver.WriteRoot(aRoot->Name(), aRoot->Reference(), aRoot->Type());
      I++;
      theDriver.WriteRoot(aRoot->Name(), I, aRoot->Type()); // HERE THE COUNTER IS USED IN PLACE OF aRoot->Reference()
    }
    catch (Storage_StreamTypeMismatchError)
    {
      myErrorStatus = Storage_VSTypeMismatch;
      myErrorStatusExt = "ReadRoot";
      return Standard_False;
    }
  }
With this change the arguments passed to the function "theDriver.WriteRoot(const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& rootType)" are the same as it happens inside of the function
"void Storage_Schema::Write(Storage_BaseDriver& f, const Handle(Storage_Data)& aData) const"
which is defined in "src/Storage/Storage_Schema.cxx"
"

The problem is reproduced using Draw commands 'fsdwrite' & modified 'fsdread' .

Steps to reproduce

The issue can be reproduced (tested) using new test case tests\persist\fsd\B2 and the modified Draw command "fsdread".

Public activity

9 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: Wed Dec 27 17:28:54 2017 +0300

    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    //the issue is fixed using another solution (changing DataMap to IndexedDataMap).
02Commenter 2
03Commenter 3
Please, correct the usage-text in DDocStd_ShapeSchemaCommands.cxx DDocStd_fsdread method.
04Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Thu Dec 28 11:21:04 2017 +0300

    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    //Fixed misprint in comments to Draw command fsdread.

05Commenter 5
The misprint fixed.
Review it, please.
06Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Wed Dec 27 17:28:54 2017 +0300

    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    //Fixed misprint in comments to Draw command fsdread.
    
    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    The issue of incorrect Roots indexing is fixed by changing DataMap to IndexedDataMap.
    //Also Draw command fsdread is improved to allow restoring of shapes with kept names.
07Commenter 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

Test case:
persist fsd B2 - OK

CPU differences:
Debian70-64:
OCCT
Total CPU difference: 18443.819999999672 / 18513.219999999714 [-0.37%]
Products
Total CPU difference: 7502.219999999996 / 7509.620000000005 [-0.10%]
Windows-64-VC10:
OCCT
Total CPU difference: 17890.272680498576 / 17919.33566679854 [-0.16%]
Products
Total CPU difference: 8078.090582299989 / 8016.251785899991 [+0.77%]


Image differences :
No differences that require special attention

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

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

[revision removed]