mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0031546: Application Framework - Memory leak (100 bytes) on Load / Close OCAF document
Class Standard_BaseDriver is inherited from Standard_Transient, its descendants are updated accordingly. Handle is used to manipulate objects of this class and its descendants (instead of references or raw pointers) to ensure automatic destruction. Added test bugs caf bug31546 Related: - Standard_OVERRIDE is added in declarations of virtual methods in descendants of Storage_BaseDriver - Methods operator << and operator >> are removed in descendants of Storage_BaseDriver (they repeat the same methods inherited from the base class) - Typedef PCDM_BaseDriverPointer is marked as deprecated - Unused class DDI_Ostream is removed - Private field Standard_Transient::count is renamed to myRefCount_ to avoid compiler warnings if the same name is used within the scope of a descendant class - Output of meaningful error messages is restored in DRAW commands fsdread and fsdwrite
This commit is contained in:
@@ -54,31 +54,29 @@ Storage_Error StdStorage::Read(const TCollection_AsciiString& theFileName,
|
||||
Handle(StdStorage_Data)& theData)
|
||||
{
|
||||
// Create a driver appropriate for the given file
|
||||
PCDM_BaseDriverPointer aDriverPtr;
|
||||
if (PCDM::FileDriverType(theFileName, aDriverPtr) == PCDM_TOFD_Unknown)
|
||||
Handle(Storage_BaseDriver) aDriver;
|
||||
if (PCDM::FileDriverType(theFileName, aDriver) == PCDM_TOFD_Unknown)
|
||||
return Storage_VSWrongFileDriver;
|
||||
|
||||
NCollection_Handle<Storage_BaseDriver> aDriver(aDriverPtr);
|
||||
|
||||
// Try to open the file
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
PCDM_ReadWriter::Open(*aDriver, theFileName, Storage_VSRead);
|
||||
PCDM_ReadWriter::Open(aDriver, theFileName, Storage_VSRead);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
return Storage_VSOpenError;
|
||||
}
|
||||
|
||||
return Read(*aDriver, theData);
|
||||
return Read(aDriver, theData);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// StdStorage::Read
|
||||
// Reads data from a pre-opened for reading driver
|
||||
//=======================================================================
|
||||
Storage_Error StdStorage::Read(Storage_BaseDriver& theDriver,
|
||||
Storage_Error StdStorage::Read(const Handle(Storage_BaseDriver)& theDriver,
|
||||
Handle(StdStorage_Data)& theData)
|
||||
{
|
||||
if (theData.IsNull())
|
||||
@@ -120,18 +118,18 @@ Storage_Error StdStorage::Read(Storage_BaseDriver& theDriver,
|
||||
// Read and parse reference section
|
||||
StdObjMgt_ReadData aReadData(theDriver, aHeaderData->NumberOfObjects());
|
||||
|
||||
anError = theDriver.BeginReadRefSection();
|
||||
anError = theDriver->BeginReadRefSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
|
||||
Standard_Integer aNbRefs = theDriver.RefSectionSize();
|
||||
Standard_Integer aNbRefs = theDriver->RefSectionSize();
|
||||
for (Standard_Integer i = 1; i <= aNbRefs; i++)
|
||||
{
|
||||
Standard_Integer aRef = 0, aType = 0;
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.ReadReferenceType(aRef, aType);
|
||||
theDriver->ReadReferenceType(aRef, aType);
|
||||
anError = Storage_VSOk;
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
@@ -145,12 +143,12 @@ Storage_Error StdStorage::Read(Storage_BaseDriver& theDriver,
|
||||
aReadData.CreatePersistentObject(aRef, anInstantiators(aType));
|
||||
}
|
||||
|
||||
anError = theDriver.EndReadRefSection();
|
||||
anError = theDriver->EndReadRefSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
|
||||
// Read and parse data section
|
||||
anError = theDriver.BeginReadDataSection();
|
||||
anError = theDriver->BeginReadDataSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
|
||||
@@ -170,7 +168,7 @@ Storage_Error StdStorage::Read(Storage_BaseDriver& theDriver,
|
||||
return anError;
|
||||
}
|
||||
|
||||
anError = theDriver.EndReadDataSection();
|
||||
anError = theDriver->EndReadDataSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
|
||||
@@ -211,7 +209,7 @@ static TCollection_AsciiString currentDate()
|
||||
//=======================================================================
|
||||
// StdStorage::Write
|
||||
//=======================================================================
|
||||
Storage_Error StdStorage::Write(Storage_BaseDriver& theDriver,
|
||||
Storage_Error StdStorage::Write(const Handle(Storage_BaseDriver)& theDriver,
|
||||
const Handle(StdStorage_Data)& theData)
|
||||
{
|
||||
Standard_NullObject_Raise_if(theData.IsNull(), "Null storage data");
|
||||
@@ -278,24 +276,24 @@ Storage_Error StdStorage::Write(Storage_BaseDriver& theDriver,
|
||||
Storage_Error anError;
|
||||
|
||||
// Write reference section
|
||||
anError = theDriver.BeginWriteRefSection();
|
||||
anError = theDriver->BeginWriteRefSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
|
||||
theDriver.SetRefSectionSize(aPObjs.Length());
|
||||
theDriver->SetRefSectionSize(aPObjs.Length());
|
||||
for (StdStorage_BucketIterator anIt(&aPObjs); anIt.More(); anIt.Next())
|
||||
{
|
||||
Handle(StdObjMgt_Persistent) aPObj = anIt.Value();
|
||||
if (!aPObj.IsNull())
|
||||
theDriver.WriteReferenceType(aPObj->RefNum(), aPObj->TypeNum());
|
||||
theDriver->WriteReferenceType(aPObj->RefNum(), aPObj->TypeNum());
|
||||
}
|
||||
|
||||
anError = theDriver.EndWriteRefSection();
|
||||
anError = theDriver->EndWriteRefSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
|
||||
// Write data section
|
||||
anError = theDriver.BeginWriteDataSection();
|
||||
anError = theDriver->BeginWriteDataSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
|
||||
@@ -307,7 +305,7 @@ Storage_Error StdStorage::Write(Storage_BaseDriver& theDriver,
|
||||
aWriteData.WritePersistentObject(aPObj);
|
||||
}
|
||||
|
||||
anError = theDriver.EndWriteDataSection();
|
||||
anError = theDriver->EndWriteDataSection();
|
||||
if (anError != Storage_VSOk)
|
||||
return anError;
|
||||
}
|
||||
|
@@ -57,14 +57,14 @@ public:
|
||||
//! These data are aggregated in a StdStorage_Data object which may be
|
||||
//! browsed in order to extract the root objects from the container.
|
||||
//! Note: - theData object will be created if it is null or cleared otherwise.
|
||||
Standard_EXPORT static Storage_Error Read(Storage_BaseDriver& theDriver,
|
||||
Standard_EXPORT static Storage_Error Read(const Handle(Storage_BaseDriver)& theDriver,
|
||||
Handle(StdStorage_Data)& theData);
|
||||
|
||||
//! Writes the data aggregated in theData object into the container defined by
|
||||
//! theDriver. The storage format is compartible with legacy persistent one.
|
||||
//! Note: - theData may aggregate several root objects to be stored together.
|
||||
//! - createion date specified in the srorage header will be overwritten.
|
||||
Standard_EXPORT static Storage_Error Write(Storage_BaseDriver& theDriver,
|
||||
Standard_EXPORT static Storage_Error Write(const Handle(Storage_BaseDriver)& theDriver,
|
||||
const Handle(StdStorage_Data)& theData);
|
||||
|
||||
};
|
||||
|
@@ -26,11 +26,11 @@ StdStorage_HeaderData::StdStorage_HeaderData()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
Standard_Boolean StdStorage_HeaderData::Read(const Handle(Storage_BaseDriver)& theDriver)
|
||||
{
|
||||
// Check driver open mode
|
||||
if (theDriver.OpenMode() != Storage_VSRead
|
||||
&& theDriver.OpenMode() != Storage_VSReadWrite)
|
||||
if (theDriver->OpenMode() != Storage_VSRead
|
||||
&& theDriver->OpenMode() != Storage_VSReadWrite)
|
||||
{
|
||||
myErrorStatus = Storage_VSModeError;
|
||||
myErrorStatusExt = "OpenMode";
|
||||
@@ -38,7 +38,7 @@ Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Read info section
|
||||
myErrorStatus = theDriver.BeginReadInfoSection();
|
||||
myErrorStatus = theDriver->BeginReadInfoSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginReadInfoSection";
|
||||
@@ -48,15 +48,8 @@ Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.ReadInfo(myNBObj,
|
||||
myStorageVersion,
|
||||
myDate,
|
||||
mySchemaName,
|
||||
mySchemaVersion,
|
||||
myApplicationName,
|
||||
myApplicationVersion,
|
||||
myDataType,
|
||||
myUserInfo);
|
||||
theDriver->ReadInfo(myNBObj, myStorageVersion, myDate, mySchemaName, mySchemaVersion,
|
||||
myApplicationName, myApplicationVersion, myDataType, myUserInfo);
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -71,7 +64,7 @@ Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndReadInfoSection();
|
||||
myErrorStatus = theDriver->EndReadInfoSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndReadInfoSection";
|
||||
@@ -79,7 +72,7 @@ Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Read comment section
|
||||
myErrorStatus = theDriver.BeginReadCommentSection();
|
||||
myErrorStatus = theDriver->BeginReadCommentSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginReadCommentSection";
|
||||
@@ -89,7 +82,7 @@ Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.ReadComment(myComments);
|
||||
theDriver->ReadComment(myComments);
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -104,7 +97,7 @@ Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndReadCommentSection();
|
||||
myErrorStatus = theDriver->EndReadCommentSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndReadCommentSection";
|
||||
@@ -114,11 +107,11 @@ Standard_Boolean StdStorage_HeaderData::Read(Storage_BaseDriver& theDriver)
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean StdStorage_HeaderData::Write(Storage_BaseDriver& theDriver)
|
||||
Standard_Boolean StdStorage_HeaderData::Write(const Handle(Storage_BaseDriver)& theDriver)
|
||||
{
|
||||
// Check driver open mode
|
||||
if (theDriver.OpenMode() != Storage_VSWrite
|
||||
&& theDriver.OpenMode() != Storage_VSReadWrite)
|
||||
if (theDriver->OpenMode() != Storage_VSWrite
|
||||
&& theDriver->OpenMode() != Storage_VSReadWrite)
|
||||
{
|
||||
myErrorStatus = Storage_VSModeError;
|
||||
myErrorStatusExt = "OpenMode";
|
||||
@@ -126,7 +119,7 @@ Standard_Boolean StdStorage_HeaderData::Write(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Write info section
|
||||
myErrorStatus = theDriver.BeginWriteInfoSection();
|
||||
myErrorStatus = theDriver->BeginWriteInfoSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginWriteInfoSection";
|
||||
@@ -136,15 +129,8 @@ Standard_Boolean StdStorage_HeaderData::Write(Storage_BaseDriver& theDriver)
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.WriteInfo(myNBObj,
|
||||
myStorageVersion,
|
||||
myDate,
|
||||
mySchemaName,
|
||||
mySchemaVersion,
|
||||
myApplicationName,
|
||||
myApplicationVersion,
|
||||
myDataType,
|
||||
myUserInfo);
|
||||
theDriver->WriteInfo(myNBObj, myStorageVersion, myDate, mySchemaName, mySchemaVersion,
|
||||
myApplicationName, myApplicationVersion, myDataType, myUserInfo);
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -159,7 +145,7 @@ Standard_Boolean StdStorage_HeaderData::Write(Storage_BaseDriver& theDriver)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndWriteInfoSection();
|
||||
myErrorStatus = theDriver->EndWriteInfoSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndWriteInfoSection";
|
||||
@@ -167,7 +153,7 @@ Standard_Boolean StdStorage_HeaderData::Write(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Write comment section
|
||||
myErrorStatus = theDriver.BeginWriteCommentSection();
|
||||
myErrorStatus = theDriver->BeginWriteCommentSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginWriteCommentSection";
|
||||
@@ -177,7 +163,7 @@ Standard_Boolean StdStorage_HeaderData::Write(Storage_BaseDriver& theDriver)
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.WriteComment(myComments);
|
||||
theDriver->WriteComment(myComments);
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -192,7 +178,7 @@ Standard_Boolean StdStorage_HeaderData::Write(Storage_BaseDriver& theDriver)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndWriteCommentSection();
|
||||
myErrorStatus = theDriver->EndWriteCommentSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndWriteCommentSection";
|
||||
|
@@ -47,13 +47,13 @@ public:
|
||||
//! Returns Standard_True in case of success. Otherwise, one need to get
|
||||
//! an error code and description using ErrorStatus and ErrorStatusExtension
|
||||
//! functions correspondingly.
|
||||
Standard_EXPORT Standard_Boolean Read(Storage_BaseDriver& theDriver);
|
||||
Standard_EXPORT Standard_Boolean Read(const Handle(Storage_BaseDriver)& theDriver);
|
||||
|
||||
//! Writes the header data section to the container defined by theDriver.
|
||||
//! Returns Standard_True in case of success. Otherwise, one need to get
|
||||
//! an error code and description using ErrorStatus and ErrorStatusExtension
|
||||
//! functions correspondingly.
|
||||
Standard_EXPORT Standard_Boolean Write(Storage_BaseDriver& theDriver);
|
||||
Standard_EXPORT Standard_Boolean Write(const Handle(Storage_BaseDriver)& theDriver);
|
||||
|
||||
//! Return the creation date
|
||||
Standard_EXPORT TCollection_AsciiString CreationDate() const;
|
||||
|
@@ -28,11 +28,11 @@ StdStorage_RootData::StdStorage_RootData()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Boolean StdStorage_RootData::Read(Storage_BaseDriver& theDriver)
|
||||
Standard_Boolean StdStorage_RootData::Read(const Handle(Storage_BaseDriver)& theDriver)
|
||||
{
|
||||
// Check driver open mode
|
||||
if (theDriver.OpenMode() != Storage_VSRead
|
||||
&& theDriver.OpenMode() != Storage_VSReadWrite)
|
||||
if (theDriver->OpenMode() != Storage_VSRead
|
||||
&& theDriver->OpenMode() != Storage_VSReadWrite)
|
||||
{
|
||||
myErrorStatus = Storage_VSModeError;
|
||||
myErrorStatusExt = "OpenMode";
|
||||
@@ -40,7 +40,7 @@ Standard_Boolean StdStorage_RootData::Read(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Read root section
|
||||
myErrorStatus = theDriver.BeginReadRootSection();
|
||||
myErrorStatus = theDriver->BeginReadRootSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginReadRootSection";
|
||||
@@ -50,13 +50,13 @@ Standard_Boolean StdStorage_RootData::Read(Storage_BaseDriver& theDriver)
|
||||
TCollection_AsciiString aRootName, aTypeName;
|
||||
Standard_Integer aRef;
|
||||
|
||||
Standard_Integer len = theDriver.RootSectionSize();
|
||||
Standard_Integer len = theDriver->RootSectionSize();
|
||||
for (Standard_Integer i = 1; i <= len; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.ReadRoot(aRootName, aRef, aTypeName);
|
||||
theDriver->ReadRoot(aRootName, aRef, aTypeName);
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ Standard_Boolean StdStorage_RootData::Read(Storage_BaseDriver& theDriver)
|
||||
myObjects.Add(aRootName, aRoot);
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndReadRootSection();
|
||||
myErrorStatus = theDriver->EndReadRootSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndReadRootSection";
|
||||
@@ -79,11 +79,11 @@ Standard_Boolean StdStorage_RootData::Read(Storage_BaseDriver& theDriver)
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean StdStorage_RootData::Write(Storage_BaseDriver& theDriver)
|
||||
Standard_Boolean StdStorage_RootData::Write(const Handle(Storage_BaseDriver)& theDriver)
|
||||
{
|
||||
// Check driver open mode
|
||||
if (theDriver.OpenMode() != Storage_VSWrite
|
||||
&& theDriver.OpenMode() != Storage_VSReadWrite)
|
||||
if (theDriver->OpenMode() != Storage_VSWrite
|
||||
&& theDriver->OpenMode() != Storage_VSReadWrite)
|
||||
{
|
||||
myErrorStatus = Storage_VSModeError;
|
||||
myErrorStatusExt = "OpenMode";
|
||||
@@ -91,21 +91,21 @@ Standard_Boolean StdStorage_RootData::Write(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Write root section
|
||||
myErrorStatus = theDriver.BeginWriteRootSection();
|
||||
myErrorStatus = theDriver->BeginWriteRootSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginWriteRootSection";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theDriver.SetRootSectionSize(NumberOfRoots());
|
||||
theDriver->SetRootSectionSize(NumberOfRoots());
|
||||
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());
|
||||
theDriver->WriteRoot(aRoot->Name(), aRoot->Reference(), aRoot->Type());
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ Standard_Boolean StdStorage_RootData::Write(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndWriteRootSection();
|
||||
myErrorStatus = theDriver->EndWriteRootSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndWriteRootSection";
|
||||
|
@@ -48,13 +48,13 @@ public:
|
||||
//! Returns Standard_True in case of success. Otherwise, one need to get
|
||||
//! an error code and description using ErrorStatus and ErrorStatusExtension
|
||||
//! functions correspondingly.
|
||||
Standard_EXPORT Standard_Boolean Read(Storage_BaseDriver& theDriver);
|
||||
Standard_EXPORT Standard_Boolean Read(const Handle(Storage_BaseDriver)& theDriver);
|
||||
|
||||
//! Writes the root data section to the container defined by theDriver.
|
||||
//! Returns Standard_True in case of success. Otherwise, one need to get
|
||||
//! an error code and description using ErrorStatus and ErrorStatusExtension
|
||||
//! functions correspondingly.
|
||||
Standard_EXPORT Standard_Boolean Write(Storage_BaseDriver& theDriver);
|
||||
Standard_EXPORT Standard_Boolean Write(const Handle(Storage_BaseDriver)& theDriver);
|
||||
|
||||
//! Returns the number of roots.
|
||||
Standard_EXPORT Standard_Integer NumberOfRoots() const;
|
||||
|
@@ -28,11 +28,11 @@ StdStorage_TypeData::StdStorage_TypeData()
|
||||
StdDrivers::BindTypes(myMapOfPInst);
|
||||
}
|
||||
|
||||
Standard_Boolean StdStorage_TypeData::Read(Storage_BaseDriver& theDriver)
|
||||
Standard_Boolean StdStorage_TypeData::Read(const Handle(Storage_BaseDriver)& theDriver)
|
||||
{
|
||||
// Check driver open mode
|
||||
if (theDriver.OpenMode() != Storage_VSRead
|
||||
&& theDriver.OpenMode() != Storage_VSReadWrite)
|
||||
if (theDriver->OpenMode() != Storage_VSRead
|
||||
&& theDriver->OpenMode() != Storage_VSReadWrite)
|
||||
{
|
||||
myErrorStatus = Storage_VSModeError;
|
||||
myErrorStatusExt = "OpenMode";
|
||||
@@ -40,7 +40,7 @@ Standard_Boolean StdStorage_TypeData::Read(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Read type section
|
||||
myErrorStatus = theDriver.BeginReadTypeSection();
|
||||
myErrorStatus = theDriver->BeginReadTypeSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginReadTypeSection";
|
||||
@@ -50,13 +50,13 @@ Standard_Boolean StdStorage_TypeData::Read(Storage_BaseDriver& theDriver)
|
||||
Standard_Integer aTypeNum;
|
||||
TCollection_AsciiString aTypeName;
|
||||
|
||||
Standard_Integer len = theDriver.TypeSectionSize();
|
||||
Standard_Integer len = theDriver->TypeSectionSize();
|
||||
for (Standard_Integer i = 1; i <= len; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.ReadTypeInformations (aTypeNum, aTypeName);
|
||||
theDriver->ReadTypeInformations (aTypeNum, aTypeName);
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ Standard_Boolean StdStorage_TypeData::Read(Storage_BaseDriver& theDriver)
|
||||
myPt.Add (aTypeName, aTypeNum);
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndReadTypeSection();
|
||||
myErrorStatus = theDriver->EndReadTypeSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndReadTypeSection";
|
||||
@@ -78,11 +78,11 @@ Standard_Boolean StdStorage_TypeData::Read(Storage_BaseDriver& theDriver)
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean StdStorage_TypeData::Write(Storage_BaseDriver& theDriver)
|
||||
Standard_Boolean StdStorage_TypeData::Write(const Handle(Storage_BaseDriver)& theDriver)
|
||||
{
|
||||
// Check driver open mode
|
||||
if (theDriver.OpenMode() != Storage_VSWrite
|
||||
&& theDriver.OpenMode() != Storage_VSReadWrite)
|
||||
if (theDriver->OpenMode() != Storage_VSWrite
|
||||
&& theDriver->OpenMode() != Storage_VSReadWrite)
|
||||
{
|
||||
myErrorStatus = Storage_VSModeError;
|
||||
myErrorStatusExt = "OpenMode";
|
||||
@@ -90,7 +90,7 @@ Standard_Boolean StdStorage_TypeData::Write(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
// Write type section
|
||||
myErrorStatus = theDriver.BeginWriteTypeSection();
|
||||
myErrorStatus = theDriver->BeginWriteTypeSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "BeginWriteTypeSection";
|
||||
@@ -98,13 +98,13 @@ Standard_Boolean StdStorage_TypeData::Write(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
|
||||
Standard_Integer len = NumberOfTypes();
|
||||
theDriver.SetTypeSectionSize(len);
|
||||
theDriver->SetTypeSectionSize(len);
|
||||
for (Standard_Integer i = 1; i <= len; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
theDriver.WriteTypeInformations(i, Type(i));
|
||||
theDriver->WriteTypeInformations(i, Type(i));
|
||||
}
|
||||
catch (Storage_StreamTypeMismatchError const&)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ Standard_Boolean StdStorage_TypeData::Write(Storage_BaseDriver& theDriver)
|
||||
}
|
||||
}
|
||||
|
||||
myErrorStatus = theDriver.EndWriteTypeSection();
|
||||
myErrorStatus = theDriver->EndWriteTypeSection();
|
||||
if (myErrorStatus != Storage_VSOk)
|
||||
{
|
||||
myErrorStatusExt = "EndWriteTypeSection";
|
||||
|
@@ -47,13 +47,13 @@ public:
|
||||
//! Returns Standard_True in case of success. Otherwise, one need to get
|
||||
//! an error code and description using ErrorStatus and ErrorStatusExtension
|
||||
//! functions correspondingly.
|
||||
Standard_EXPORT Standard_Boolean Read(Storage_BaseDriver& theDriver);
|
||||
Standard_EXPORT Standard_Boolean Read(const Handle(Storage_BaseDriver)& theDriver);
|
||||
|
||||
//! Writes the type data section to the container defined by theDriver.
|
||||
//! Returns Standard_True in case of success. Otherwise, one need to get
|
||||
//! an error code and description using ErrorStatus and ErrorStatusExtension
|
||||
//! functions correspondingly.
|
||||
Standard_EXPORT Standard_Boolean Write(Storage_BaseDriver& theDriver);
|
||||
Standard_EXPORT Standard_Boolean Write(const Handle(Storage_BaseDriver)& theDriver);
|
||||
|
||||
//! Returns the number of registered types
|
||||
Standard_EXPORT Standard_Integer NumberOfTypes() const;
|
||||
|
Reference in New Issue
Block a user