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());
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:
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();
// theDriver.WriteRoot(aRoot->Name(), aRoot->Reference(), aRoot->Type());
theDriver.WriteRoot(aRoot->Name(), I, aRoot->Type()); // HERE THE COUNTER IS USED IN PLACE OF aRoot->Reference()
myErrorStatus = Storage_VSTypeMismatch;
myErrorStatusExt = "ReadRoot";
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"