Sat, 12/23/2017 - 13:47
Good Morning,
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"
Walter
Mon, 12/25/2017 - 18:38
Dear Walter,
Thank you for your message and your contribution.
At the moment I can confirm that the reported problem is reproduced.
The issue is registered in OCCT BugTracker with ID = 29402.
We will take care to analyze it (as soon as we can) in order to elaborate the most effective solution.
Best regards
Forum supervisor