]> OCCT Git - occt-copy.git/commitdiff
0031546: Application Framework - Memory leak (100 bytes) on Load / Close OCAF document
authorabv <abv@opencascade.com>
Mon, 4 May 2020 19:25:03 +0000 (22:25 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 7 May 2020 18:24:46 +0000 (21:24 +0300)
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

54 files changed:
src/DDF/DDF_BasicCommands.cxx
src/DDF/DDF_IOStream.cxx [deleted file]
src/DDF/DDF_IOStream.hxx [deleted file]
src/DDF/FILES
src/DDocStd/DDocStd_ShapeSchemaCommands.cxx
src/FSD/FSD_BinaryFile.cxx
src/FSD/FSD_BinaryFile.hxx
src/FSD/FSD_CmpFile.cxx
src/FSD/FSD_CmpFile.hxx
src/FSD/FSD_File.cxx
src/FSD/FSD_File.hxx
src/FSD/FSD_FileHeader.hxx
src/PCDM/PCDM.cxx
src/PCDM/PCDM.hxx
src/PCDM/PCDM_BaseDriverPointer.hxx
src/PCDM/PCDM_ReadWriter.cxx
src/PCDM/PCDM_ReadWriter.hxx
src/PCDM/PCDM_ReadWriter_1.cxx
src/PCDM/PCDM_StorageDriver.cxx
src/Standard/Standard_Transient.cxx
src/Standard/Standard_Transient.hxx
src/StdLDrivers/StdLDrivers_DocumentRetrievalDriver.cxx
src/StdObjMgt/StdObjMgt_ReadData.cxx
src/StdObjMgt/StdObjMgt_ReadData.hxx
src/StdObjMgt/StdObjMgt_WriteData.cxx
src/StdObjMgt/StdObjMgt_WriteData.hxx
src/StdStorage/StdStorage.cxx
src/StdStorage/StdStorage.hxx
src/StdStorage/StdStorage_HeaderData.cxx
src/StdStorage/StdStorage_HeaderData.hxx
src/StdStorage/StdStorage_RootData.cxx
src/StdStorage/StdStorage_RootData.hxx
src/StdStorage/StdStorage_TypeData.cxx
src/StdStorage/StdStorage_TypeData.hxx
src/Storage/FILES
src/Storage/Storage_BaseDriver.cxx
src/Storage/Storage_BaseDriver.hxx
src/Storage/Storage_BaseDriver.lxx [deleted file]
src/Storage/Storage_CallBack.hxx
src/Storage/Storage_DefaultCallBack.cxx
src/Storage/Storage_DefaultCallBack.hxx
src/Storage/Storage_HeaderData.cxx
src/Storage/Storage_HeaderData.hxx
src/Storage/Storage_RootData.cxx
src/Storage/Storage_RootData.hxx
src/Storage/Storage_Schema.cxx
src/Storage/Storage_Schema.hxx
src/Storage/Storage_Schema.lxx [deleted file]
src/Storage/Storage_TypeData.cxx
src/Storage/Storage_TypeData.hxx
src/UTL/UTL.cxx
src/UTL/UTL.hxx
tests/bugs/caf/bug31546 [new file with mode: 0644]
tests/bugs/fclasses/bug29355

index f1471f88553e70d917c5e3e6b3c6f24b8866d4b4..de9dbb86070a73a57dfa2799cb4ef3c6a5ed400f 100644 (file)
@@ -55,9 +55,6 @@
 #include <TDF_RelocationTable.hxx>
 #include <TDF_Tool.hxx>
 
-#include <DDF_IOStream.hxx>
-
-
 //=======================================================================
 //function : Children
 //purpose  : Returns a list of sub-label entries.
@@ -167,66 +164,6 @@ static Standard_Integer DDF_ForgetAttribute(Draw_Interpretor& di,
   return 0;
 }
 
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// save/restore & Store/Retrieve commands
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-//==========================================================
-// ErrorMessage
-//==========================================================
-
-void ErrorMessage (const Storage_Error n) 
-{
-  std::cout << "Storage Error: " << std::flush;
-
-  switch (n) {
-  case Storage_VSOk:
-    std::cout << "no problem" << std::endl;
-    break;
-  case Storage_VSOpenError:
-    std::cout << "while opening the stream" << std::endl;
-    break;
-  case Storage_VSModeError:
-    std::cout << "the stream is opened with a wrong mode for operation " << std::endl;
-    break;
-  case Storage_VSCloseError:
-    std::cout << "while closing the stream" << std::endl;
-    break;
-  case Storage_VSAlreadyOpen:
-    std::cout << "stream is already opened" << std::endl;
-    break;
-  case Storage_VSNotOpen:
-    std::cout << "stream not opened" << std::endl;
-    break;
-  case Storage_VSSectionNotFound:
-    std::cout << "the section is not found" << std::endl;
-    break;
-  case Storage_VSWriteError:
-    std::cout << "error during writing" << std::endl;
-    break;
-  case Storage_VSFormatError:
-    std::cout << "wrong format error occured while reading" << std::endl;
-    break;
-  case Storage_VSUnknownType:
-    std::cout << "try to read an unknown type" << std::endl;
-    break;
-  case Storage_VSTypeMismatch:
-    std::cout << "try to read a wrong primitive type (read a char while expecting a real)" << std::endl;
-    break;
-  case Storage_VSInternalError:
-    std::cout << "internal error" << std::endl;
-    break;
-  case Storage_VSExtCharParityError:      std::cout << "parity error" << std::endl;
-    break;
-  default:
-    std::cout << "unknown error code" << std::endl;
-    break;
-  }
-}
-
-
 //=======================================================================
 //function : DDF_SetTagger
 //purpose  : SetTagger (DF, entry)
diff --git a/src/DDF/DDF_IOStream.cxx b/src/DDF/DDF_IOStream.cxx
deleted file mode 100644 (file)
index 4eed1c8..0000000
+++ /dev/null
@@ -1,1367 +0,0 @@
-// Created by: DAUTRY Philippe
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//             ----------------
-
-// Version:    0.0
-//Version      Date            Purpose
-//             0.0     Aug 22 1997     Creation
-
-#include <Standard_Stream.hxx>
-
-#include <DDF_IOStream.hxx>
-
-// This file has been written using FSD_File.cxx as template.
-// This is a specific adaptation for Draw use (save & restore commands).
-// It is not sure at all this code is portable on any other plateform than
-// SUN OS. Don't use it anywhere else.
-// Thanks for comprehension. (22 august 97)
-
-
-#include <Storage_StreamTypeMismatchError.hxx>
-#include <Storage_StreamFormatError.hxx>
-#include <Storage_StreamWriteError.hxx>
-#include <Storage_StreamExtCharParityError.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-
-const Standard_CString MAGICNUMBER = "FSDFILE";
-
-
-//=======================================================================
-//function : DDF_IOStream
-//purpose  : 
-//=======================================================================
-
-DDF_IOStream::DDF_IOStream() : 
-       myIStream(NULL),
-       myOStream(NULL)
-{}
-
-//=======================================================================
-//function : Open
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode)
-{
-  //myIStream = NULL;
-  //myOStream = NULL;
-  //return Storage_VSOk;
-
-  Storage_Error result = Storage_VSOk;
-
-  SetName(aName);
-
-  if (OpenMode() == Storage_VSNone) {
-    if (aMode == Storage_VSRead) {
-      if (myIStream != NULL) delete myIStream;
-      myIStream = new std::ifstream(aName.ToCString(),std::ios::in); // std::ios::nocreate is not portable
-      if (myIStream->fail()) {
-       result = Storage_VSOpenError;
-      }
-      else {
-       myIStream->precision(17);
-        myIStream->imbue (std::locale::classic()); // always use C locale
-       SetOpenMode(aMode);
-      }
-    }
-    else if (aMode == Storage_VSWrite) {
-      if (myOStream != NULL) delete myOStream;
-      myOStream = new std::ofstream(aName.ToCString(),std::ios::out);
-      if (myOStream->fail()) {
-       result = Storage_VSOpenError;
-      }
-      else {
-       myOStream->precision(17);
-        myOStream->imbue (std::locale::classic()); // make sure to always use C locale
-       SetOpenMode(aMode);
-      }
-    }
-  }
-  else {
-    result = Storage_VSAlreadyOpen;
-  }
-
-  return result;
-}
-
-//=======================================================================
-//function : Open
-//purpose  : "Opens" an std::istream.
-//=======================================================================
-
-Storage_Error DDF_IOStream::Open(std::istream* anIStream)
-{
-  myOStream = NULL;
-  SetOpenMode(Storage_VSRead);
-  myIStream = anIStream;
-  myIStream->precision(17);
-  myIStream->imbue (std::locale::classic()); // use always C locale
-  SetName("DDF_IOStream");
-  return Storage_VSOk; // ou Storage_VSAlreadyOpen ?
-}
-
-//=======================================================================
-//function : Open
-//purpose  : "Opens" an std::ostream.
-//=======================================================================
-
-Storage_Error DDF_IOStream::Open(std::ostream* anOStream)
-{
-  myIStream = NULL;
-  SetOpenMode(Storage_VSWrite);
-  myOStream = anOStream;
-  myOStream->precision(17);
-  myOStream->imbue (std::locale::classic()); // use always C locale
-  SetName("DDF_IOStream");
-  return Storage_VSOk; // ou Storage_VSAlreadyOpen ?
-}
-
-//=======================================================================
-//function : IsEnd
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean DDF_IOStream::IsEnd()
-{
-  if (OpenMode() == Storage_VSRead) return myIStream->eof();
-  else                              return myOStream->eof();
-}
-
-//=======================================================================
-//function : Close
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::Close()
-{ return Storage_VSOk; }
-
-
-// ------------------ PROTECTED
-
-
-//=======================================================================
-//function : MagicNumber
-//purpose  : 
-//=======================================================================
-
-Standard_CString DDF_IOStream::MagicNumber()
-{ return MAGICNUMBER; }
-
-//=======================================================================
-//function : FlushEndOfLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::FlushEndOfLine()
-{
-  static char Buffer[8192];
-  char c;
-  Standard_Boolean IsEnd = Standard_False;
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    Buffer[0] = '\0';
-    myIStream->get(Buffer,8192,'\n');
-
-    if (myIStream->get(c) && c != '\n') {
-    }
-    else {
-      IsEnd = Standard_True;
-    }
-  }
-}
-
-//=======================================================================
-//function : ReadLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadLine(TCollection_AsciiString& buffer)
-{
-  static char Buffer[8193];
-  char c;
-  Standard_Boolean IsEnd = Standard_False;
-  
-  buffer.Clear();
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    Buffer[0] = '\0';
-    myIStream->get(Buffer,8192,'\n');
-    
-    if (myIStream->get(c) && c != '\n') {
-      buffer += Buffer;
-      buffer += c;
-    }
-    else {
-      buffer += Buffer;
-      IsEnd = Standard_True;
-    }
-  }
-}
-
-
-//=======================================================================
-//function : WriteExtendedLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteExtendedLine(const TCollection_ExtendedString& buffer)
-{
-  Standard_ExtString extBuffer;
-  Standard_Integer   i,c,d;
-
-  extBuffer = buffer.ToExtString();
-
-  for (i = 0; i < buffer.Length(); i++) {
-    c = (extBuffer[i] & 0x0000FF00 ) >> 8 ;
-    d = extBuffer[i] & 0x000000FF;
-
-    *myOStream << (char)c << (char)d;
-  }
-
-  *myOStream << (char)0 << "\n";
-}
-
-//=======================================================================
-//function : ReadExtendedLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadExtendedLine(TCollection_ExtendedString& buffer)
-{
-  char c = '\0';
-  Standard_ExtCharacter i = 0,j,check = 0;
-  Standard_Boolean fin = Standard_False;
-
-  buffer.Clear();
-
-  while (!fin && !IsEnd()) {
-    myIStream->get(c);
-    check++; 
-//    if (!(check % 2)) throw Storage_StreamExtCharParityError();
-    i = (Standard_ExtCharacter)c;
-    if (c == '\0') fin = Standard_True;
-    i = (i << 8);
-
-    myIStream->get(c);
-    check++;
-//    if ((check % 2) != 0) throw Storage_StreamExtCharParityError();
-//    std::cout << check << std::endl;
-    j = (Standard_ExtCharacter)c;
-    if (c != '\n') fin = Standard_False;
-    i |= (0x00FF & j);
-    buffer += (Standard_ExtCharacter)i;
-  }
-
-//  if ((check % 2) != 0) throw Storage_StreamExtCharParityError();
-//  std::cout << check << std::endl;
-}
-
-//=======================================================================
-//function : ReadChar
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadChar(TCollection_AsciiString& buffer, const Standard_Integer rsize)
-{
-  char c = '\0';
-  Standard_Integer ccount = 0;
-
-  buffer.Clear();
-
-  while (!IsEnd() && (ccount < rsize)) {
-    myIStream->get(c);
-    buffer += c;
-    ccount++;
-  }
-}
-
-//=======================================================================
-//function : ReadString
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadString(TCollection_AsciiString& buffer)
-{
-  char c = '\0';
-  Standard_Boolean IsEnd = Standard_False;
-
-  buffer.Clear();
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    myIStream->get(c);
-    if ((c != ' ') && (c != '\n')) IsEnd = Standard_True;
-  }
-
-  IsEnd = Standard_False;
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    buffer += c;
-    myIStream->get(c);
-    if (c == '\n') IsEnd = Standard_True;
-  }
-}
-
-//=======================================================================
-//function : ReadWord
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadWord(TCollection_AsciiString& buffer)
-{
-  char c = '\0';
-  Standard_Boolean IsEnd = Standard_False;
-
-  buffer.Clear();
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    myIStream->get(c);
-    if ((c != ' ') && (c != '\n')) IsEnd = Standard_True;
-  }
-
-  IsEnd = Standard_False;
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    buffer += c;
-    myIStream->get(c);
-    if ((c == '\n') || (c == ' ')) IsEnd = Standard_True;
-  }
-}
-
-//=======================================================================
-//function : FindTag
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::FindTag(const Standard_CString aTag)
-{
-  TCollection_AsciiString l;
-  
-  ReadString(l);
-
-  while ((strcmp(l.ToCString(),aTag) != 0) && !IsEnd()) {
-    ReadString(l);
-  }
-
-  if (IsEnd()) {
-    return Storage_VSSectionNotFound;
-  }
-  else {
-    return Storage_VSOk;
-  }
-}
-
-//=======================================================================
-//function : SkipObject
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SkipObject()
-{
-  FlushEndOfLine();
-}
-
-
-// ---------------------- PUBLIC : PUT
-
-
-//=======================================================================
-//function : PutReference
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutReference(const Standard_Integer aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) throw Storage_StreamWriteError("PutReference");
-  return *this;
-}
-
-//=======================================================================
-//function : PutCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutCharacter(const Standard_Character aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) throw Storage_StreamWriteError("PutCharacter");
-  return *this;
-}
-
-//=======================================================================
-//function : PutExtCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutExtCharacter(const Standard_ExtCharacter aValue)
-{
-  *myOStream << (short )aValue << " ";
-  if (myOStream->bad()) throw Storage_StreamWriteError("PutExtCharacter");
-  return *this;
-}
-
-//=======================================================================
-//function : PutInteger
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutInteger(const Standard_Integer aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) throw Storage_StreamWriteError("PutInteger");
-  return *this;
-}
-
-//=======================================================================
-//function : PutBoolean
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutBoolean(const Standard_Boolean aValue)
-{
-  *myOStream << ((Standard_Integer)aValue) << " ";
-  if (myOStream->bad()) throw Storage_StreamWriteError("PutBoolean");
-  return *this;
-}
-
-//=======================================================================
-//function : PutReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutReal(const Standard_Real aValue)
-{
-  *myOStream << ((Standard_Real)aValue) << " ";
-  if (myOStream->bad()) throw Storage_StreamWriteError("PutReal");
-  return *this;
-}
-
-//=======================================================================
-//function : PutShortReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutShortReal(const Standard_ShortReal aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) throw Storage_StreamWriteError("PutShortReal");
-  return *this;
-}
-
-
-// ----------------- PUBLIC : GET
-
-
-//=======================================================================
-//function : GetReference
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetReference(Standard_Integer& aValue)
-{
-  if (!(*myIStream >> aValue)) throw Storage_StreamTypeMismatchError("GetReference");
-  return *this;
-}
-
-//=======================================================================
-//function : GetCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetCharacter(Standard_Character& aValue)
-{
-  if (!(*myIStream >> aValue)) throw Storage_StreamTypeMismatchError("GetCharacter");
-  return *this;
-}
-
-//=======================================================================
-//function : GetExtCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetExtCharacter(Standard_ExtCharacter& aValue)
-{
-  short aChar = 0;
-  if (!(*myIStream >> aChar)) throw Storage_StreamTypeMismatchError("GetExtCharacter");
-  aValue = aChar;
-  return *this;
-}
-
-//=======================================================================
-//function : GetInteger
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetInteger(Standard_Integer& aValue)
-{
-  if (!(*myIStream >> aValue)) throw Storage_StreamTypeMismatchError("GetInteger");
-  return *this;
-}
-
-//=======================================================================
-//function : GetBoolean
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetBoolean(Standard_Boolean& aValue)
-{
-  if (!(*myIStream >> aValue)) throw Storage_StreamTypeMismatchError("GetBoolean");
-  return *this;
-}
-
-//=======================================================================
-//function : GetReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetReal(Standard_Real& aValue)
-{
-  if (!(*myIStream >> aValue)) throw Storage_StreamTypeMismatchError("GetReal");
-  return *this;
-}
-
-//=======================================================================
-//function : GetShortReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetShortReal(Standard_ShortReal& aValue)
-{
-  if (!(*myIStream >> aValue)) throw Storage_StreamTypeMismatchError("GetShortReal");
-  return *this;
-}
-
-// -------------------------- DESTROY
-
-//=======================================================================
-//function : Destroy
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::Destroy()
-{
-  if (OpenMode() != Storage_VSNone) Close();
-}
-
-
-// -------------------------- INFO : WRITE
-
-
-//=======================================================================
-//function : BeginWriteInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteInfoSection() 
-{
-  *myOStream << DDF_IOStream::MagicNumber() << '\n';
-  *myOStream << "BEGIN_INFO_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : WriteInfo
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteInfo(const Standard_Integer nbObj,
-                        const TCollection_AsciiString& dbVersion,
-                        const TCollection_AsciiString& date,
-                        const TCollection_AsciiString& schemaName,
-                        const TCollection_AsciiString& schemaVersion,
-                        const TCollection_ExtendedString& appName,
-                        const TCollection_AsciiString& appVersion,
-                        const TCollection_ExtendedString& dataType,
-                        const TColStd_SequenceOfAsciiString& userInfo) 
-{
-  Standard_Integer i;
-//  char *extBuffer;
-
-  *myOStream << nbObj;
-  *myOStream << "\n";
-  *myOStream << dbVersion.ToCString() << "\n";
-  *myOStream << date.ToCString() << "\n";
-  *myOStream << schemaName.ToCString() << "\n";
-  *myOStream << schemaVersion.ToCString() << "\n";
-  WriteExtendedLine(appName);
-  *myOStream << appVersion.ToCString() << "\n";
-  WriteExtendedLine(dataType);
-  *myOStream << userInfo.Length() << "\n";
-
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-
-  for (i = 1; i <= userInfo.Length(); i++) {
-    *myOStream << userInfo.Value(i).ToCString() << "\n";
-    if (myOStream->bad()) throw Storage_StreamWriteError();
-  }
-}
-
-
-//=======================================================================
-//function : EndWriteInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteInfoSection() 
-{
-  *myOStream << "END_INFO_SECTION\n";
-  if (myOStream->bad())  throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : BeginReadInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadInfoSection() 
-{
-  Storage_Error s;
-  TCollection_AsciiString l;
-  Standard_Integer        len = (Standard_Integer) strlen(DDF_IOStream::MagicNumber());
-
-  // Added because of Draw:
-  // It don't go to next line after reading its own header line information!
-  FlushEndOfLine();
-  ReadChar(l,len);
-  
-  if (strncmp(DDF_IOStream::MagicNumber(),l.ToCString(),len) != 0) {
-#ifdef OCCT_DEBUG
-    std::cout<<"BeginReadInfoSection: format error"<<std::endl;
-#endif
-    s = Storage_VSFormatError;
-  }
-  else {
-    s = FindTag("BEGIN_INFO_SECTION");
-  }
-
-  return s;
-}
-
-
-// ------------------- INFO : READ
-
-
-//=======================================================================
-//function : ReadInfo
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadInfo(Standard_Integer& nbObj,
-                       TCollection_AsciiString& dbVersion,
-                       TCollection_AsciiString& date,
-                       TCollection_AsciiString& schemaName,
-                       TCollection_AsciiString& schemaVersion,
-                       TCollection_ExtendedString& appName,
-                       TCollection_AsciiString& appVersion,
-                       TCollection_ExtendedString& dataType,
-                       TColStd_SequenceOfAsciiString& userInfo) 
-{
-  if (!(*myIStream >> nbObj)) throw Storage_StreamTypeMismatchError("ReadInfo 1");
-
-  FlushEndOfLine();
-
-  ReadLine(dbVersion);
-  ReadLine(date);
-  ReadLine(schemaName);
-  ReadLine(schemaVersion);
-  ReadExtendedLine(appName);
-  ReadLine(appVersion);
-  ReadExtendedLine(dataType);
-
-  Standard_Integer i,len = 0;
-
-  if (!(*myIStream >> len)) throw Storage_StreamTypeMismatchError("ReadInfo 2");
-
-  FlushEndOfLine();
-
-  TCollection_AsciiString line;
-
-  for (i = 1; i <= len && !IsEnd(); i++) {
-    ReadLine(line);
-    userInfo.Append(line);
-    line.Clear();
-  }
-}
-
-//=======================================================================
-//function : ReadCompleteInfo
-//purpose  : 
-//=======================================================================
-void DDF_IOStream::ReadCompleteInfo( Standard_IStream& /*theIStream*/, Handle(Storage_Data)& /*theData*/ )
-{
-
-}
-
-//=======================================================================
-//function : EndReadInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadInfoSection() 
-{ return FindTag("END_INFO_SECTION"); }
-
-
-// ---------------- COMMENTS : WRITE
-
-
-//=======================================================================
-//function : BeginWriteCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteCommentSection() 
-{
-  *myOStream << "BEGIN_COMMENT_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : WriteComment
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteComment(const TColStd_SequenceOfExtendedString& aCom)
-{
- Standard_Integer i,aSize;
-
- aSize = aCom.Length();
- *myOStream << aSize << "\n";
- if (myOStream->bad()) throw Storage_StreamWriteError();
-
- for (i = 1; i <= aSize; i++) {
-   WriteExtendedLine(aCom.Value(i));
-   if (myOStream->bad()) throw Storage_StreamWriteError();
- }
-}
-
-//=======================================================================
-//function : EndWriteCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteCommentSection() 
-{
-  *myOStream << "END_COMMENT_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-
-// ---------------- COMMENTS : READ
-
-
-//=======================================================================
-//function : BeginReadCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadCommentSection() 
-{
-  return FindTag("BEGIN_COMMENT_SECTION");
-}
-
-//=======================================================================
-//function : ReadComment
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadComment(TColStd_SequenceOfExtendedString& aCom)
-{
-  TCollection_ExtendedString line;
-  Standard_Integer           len,i;
-
-  if (!(*myIStream >> len)) throw Storage_StreamTypeMismatchError("ReadComment");
-  
-  FlushEndOfLine();  
-
-  for (i = 1; i <= len && !IsEnd(); i++) {
-    ReadExtendedLine(line);
-    aCom.Append(line);
-    line.Clear();
-  }
-}
-
-//=======================================================================
-//function : EndReadCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadCommentSection() 
-{ return FindTag("END_COMMENT_SECTION"); }
-
-
-// --------------- TYPE : WRITE
-
-
-//=======================================================================
-//function : BeginWriteTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteTypeSection() 
-{
-  *myOStream << "BEGIN_TYPE_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : SetTypeSectionSize
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SetTypeSectionSize(const Standard_Integer aSize) 
-{
-  *myOStream << aSize << "\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : WriteTypeInformations
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteTypeInformations(const Standard_Integer typeNum,
-                                     const TCollection_AsciiString& typeName) 
-{
-  *myOStream << typeNum << " " << typeName.ToCString() << "\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : EndWriteTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteTypeSection() 
-{
-  *myOStream << "END_TYPE_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-
-// ------------------- TYPE : READ
-
-
-//=======================================================================
-//function : BeginReadTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadTypeSection() 
-{ return FindTag("BEGIN_TYPE_SECTION"); }
-
-//=======================================================================
-//function : TypeSectionSize
-//purpose  : 
-//=======================================================================
-
-Standard_Integer DDF_IOStream::TypeSectionSize() 
-{
-  Standard_Integer i;
-
-  if (!(*myIStream >> i)) throw Storage_StreamTypeMismatchError("TypeSectionSize");
-
-  FlushEndOfLine();
-
-  return i;
-}
-
-//=======================================================================
-//function : ReadTypeInformations
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadTypeInformations(Standard_Integer& typeNum,
-                                   TCollection_AsciiString& typeName) 
-{
-  if (!(*myIStream >> typeNum)) throw Storage_StreamTypeMismatchError("ReadTypeInformations 1");
-  if (!(*myIStream >> typeName)) throw Storage_StreamTypeMismatchError("ReadTypeInformations 2");
-  FlushEndOfLine();
-}
-
-//=======================================================================
-//function : EndReadTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadTypeSection() 
-{
-  return FindTag("END_TYPE_SECTION");
-}
-
-
-// -------------------- ROOT : WRITE
-
-
-//=======================================================================
-//function : BeginWriteRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteRootSection() 
-{
-  *myOStream << "BEGIN_ROOT_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : SetRootSectionSize
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SetRootSectionSize(const Standard_Integer aSize) 
-{
-  *myOStream << aSize << "\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : WriteRoot
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteRoot(const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& rootType) 
-{
-  *myOStream << aRef << " " << rootName.ToCString() << " " << rootType.ToCString() << "\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : EndWriteRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteRootSection() 
-{
-  *myOStream << "END_ROOT_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-
-// ----------------------- ROOT : READ
-
-
-//=======================================================================
-//function : BeginReadRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadRootSection() 
-{ return FindTag("BEGIN_ROOT_SECTION"); }
-
-//=======================================================================
-//function : RootSectionSize
-//purpose  : 
-//=======================================================================
-
-Standard_Integer DDF_IOStream::RootSectionSize() 
-{
-  Standard_Integer i;
-
-  if (!(*myIStream >> i)) throw Storage_StreamTypeMismatchError("RootSectionSize");
-  
-  FlushEndOfLine();
-  
-  return i;
-}
-
-//=======================================================================
-//function : ReadRoot
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadRoot(TCollection_AsciiString& rootName, Standard_Integer& aRef,TCollection_AsciiString& rootType) 
-{
-  if (!(*myIStream >> aRef)) throw Storage_StreamTypeMismatchError("ReadRoot");
-  ReadWord(rootName);
-  ReadWord(rootType);
-}
-
-//=======================================================================
-//function : EndReadRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadRootSection() 
-{ return FindTag("END_ROOT_SECTION"); }
-
-
-// -------------------------- REF : WRITE
-
-
-//=======================================================================
-//function : BeginWriteRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteRefSection() 
-{
-  *myOStream << "BEGIN_REF_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : SetRefSectionSize
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SetRefSectionSize(const Standard_Integer aSize) 
-{
-  *myOStream << aSize << "\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : WriteReferenceType
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteReferenceType(const Standard_Integer reference,
-                                 const Standard_Integer typeNum) 
-{
-  *myOStream << reference << " " << typeNum << "\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : EndWriteRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteRefSection() 
-{
-  *myOStream << "END_REF_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-
-// ----------------------- REF : READ
-
-
-//=======================================================================
-//function : BeginReadRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadRefSection() 
-{ return FindTag("BEGIN_REF_SECTION"); }
-
-//=======================================================================
-//function : RefSectionSize
-//purpose  : 
-//=======================================================================
-
-Standard_Integer DDF_IOStream::RefSectionSize() 
-{
-  Standard_Integer i;
-
-  if (!(*myIStream >> i)) throw Storage_StreamTypeMismatchError("RefSectionSize");
-  FlushEndOfLine();
-
-  return i;
-}
-
-//=======================================================================
-//function : ReadReferenceType
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadReferenceType(Standard_Integer& reference,
-                                Standard_Integer& typeNum) 
-{
-  if (!(*myIStream >> reference)) throw Storage_StreamTypeMismatchError("ReadReferenceType 1");
-  if (!(*myIStream >> typeNum)) throw Storage_StreamTypeMismatchError("ReadReferenceType 2");
-  FlushEndOfLine();
-}
-
-//=======================================================================
-//function : EndReadRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadRefSection() 
-{
-  return FindTag("END_REF_SECTION");
-}
-
-
-// -------------------- DATA : WRITE
-
-
-//=======================================================================
-//function : BeginWriteDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteDataSection() 
-{
-  *myOStream << "BEGIN_DATA_SECTION";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : WritePersistentObjectHeader
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WritePersistentObjectHeader(const Standard_Integer aRef,
-                                          const Standard_Integer aType) 
-{
-  *myOStream << "\n#" << aRef << "=%" << aType;
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : BeginWritePersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginWritePersistentObjectData() 
-{
-  *myOStream << "( ";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : BeginWriteObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginWriteObjectData() 
-{
-  *myOStream << "( ";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : EndWriteObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndWriteObjectData() 
-{
-  *myOStream << ") ";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : EndWritePersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndWritePersistentObjectData() 
-{
-  *myOStream << ")";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-}
-
-//=======================================================================
-//function : EndWriteDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteDataSection() 
-{
-  *myOStream << "\nEND_DATA_SECTION\n";
-  if (myOStream->bad()) throw Storage_StreamWriteError();
-  return Storage_VSOk;
-}
-
-
-// ---------------------- DATA : READ
-
-
-//=======================================================================
-//function : BeginReadDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadDataSection() 
-{ return FindTag("BEGIN_DATA_SECTION"); }
-
-//=======================================================================
-//function : ReadPersistentObjectHeader
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadPersistentObjectHeader(Standard_Integer& aRef,
-                                         Standard_Integer& aType) 
-{
-  char c = '\0';
-
-  myIStream->get(c);
-
-  while (c != '#') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      throw Storage_StreamFormatError();
-    }
-    myIStream->get(c);
-  }
-
-  if (!(*myIStream >> aRef)) throw Storage_StreamTypeMismatchError("ReadPersistentObjectHeader 1");
-  myIStream->get(c);
-
-  while (c != '=') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      throw Storage_StreamFormatError();
-    }
-    myIStream->get(c);
-  }
-
-  myIStream->get(c);
-
-  while (c != '%') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      throw Storage_StreamFormatError();
-    }
-    myIStream->get(c);
-  }
-
-  if (!(*myIStream >> aType)) throw Storage_StreamTypeMismatchError("ReadPersistentObjectHeader 2");
-}
-
-//=======================================================================
-//function : BeginReadPersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginReadPersistentObjectData() 
-{
-  char c = '\0';
-  myIStream->get(c);
-  while (c != '(') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      throw Storage_StreamFormatError();
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : BeginReadObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginReadObjectData() 
-{
-  char c = '\0';
-  myIStream->get(c);
-  while (c != '(') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      throw Storage_StreamFormatError("BeginReadObjectData");
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : EndReadObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndReadObjectData() 
-{
-  char c = '\0';
-  myIStream->get(c);
-  while (c != ')') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      throw Storage_StreamFormatError("EndReadObjectData");
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : EndReadPersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndReadPersistentObjectData() 
-{
-  char c = '\0';
-
-  myIStream->get(c);
-  while (c != ')') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      throw Storage_StreamFormatError("EndReadPersistentObjectData");
-    }
-    myIStream->get(c);
-  }
-
-  myIStream->get(c);
-  while (c != '\n') {
-    if (IsEnd() || (c != ' ')) {
-      throw Storage_StreamFormatError();
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : EndReadDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadDataSection() 
-{ return FindTag("END_DATA_SECTION"); }
-
-//=======================================================================
-//function : IsGoodFileType
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::IsGoodFileType(std::istream* anIStream)
-{
-  DDF_IOStream      f;
-  Storage_Error s;
-
-  s = f.Open(anIStream);
-
-  if (s == Storage_VSOk) {
-    TCollection_AsciiString l;
-    Standard_Integer        len = (Standard_Integer) strlen(DDF_IOStream::MagicNumber());
-
-    f.ReadChar(l,len);
-
-    f.Close();
-
-    if (strncmp(DDF_IOStream::MagicNumber(),l.ToCString(),len) != 0) {
-#ifdef OCCT_DEBUG
-    std::cout<<"IsGoodFileType: format error"<<std::endl;
-#endif
-      s = Storage_VSFormatError;
-    }
-  }
-
-  return s;
-}
-
diff --git a/src/DDF/DDF_IOStream.hxx b/src/DDF/DDF_IOStream.hxx
deleted file mode 100644 (file)
index 3ac1dd1..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-// Created on: 1997-08-22
-// Created by: DAUTRY Philippe
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// This file has been written using FSD_File.hxx as template.
-// This is a specific adaptation for Draw use (save & restore commands).
-// It is not sure at all this code is portable on any other plateform than
-// SUN OS. Don't use it anywhere else.
-// Thanks for comprehension. (22 august 97)
-
-
-#ifndef DDF_IOStream_HeaderFile
-#define DDF_IOStream_HeaderFile
-
-#include <stdio.h>
-
-#include <Storage_BaseDriver.hxx>
-#include <Storage_Error.hxx>
-#include <Storage_OpenMode.hxx>
-#include <Storage_Position.hxx>
-
-class Storage_StreamTypeMismatchError;
-class Storage_StreamFormatError;
-class Storage_StreamWriteError;
-class Storage_StreamExtCharParityError;
-
-#include <TColStd_SequenceOfExtendedString.hxx>
-
-class DDF_IOStream  : public Storage_BaseDriver {
-
-public:
-
- // Methods PUBLIC
- // 
-DDF_IOStream();
-  Storage_Error Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode) ;
-  Storage_Error Open(std::istream* anIStream) ;
-  Storage_Error Open(std::ostream* anOStream) ;
-  Standard_Boolean IsEnd() ;
-  Storage_Position Tell() { return -1; }
-static  Storage_Error IsGoodFileType(std::istream* anIStream) ;
-  Storage_Error BeginWriteInfoSection() ;
-  void WriteInfo(const Standard_Integer nbObj,const TCollection_AsciiString& dbVersion,const TCollection_AsciiString& date,const TCollection_AsciiString& schemaName,const TCollection_AsciiString& schemaVersion,const TCollection_ExtendedString& appName,const TCollection_AsciiString& appVersion,const TCollection_ExtendedString& objectType,const TColStd_SequenceOfAsciiString& userInfo) ;
-  Storage_Error EndWriteInfoSection() ;
-  Storage_Error BeginReadInfoSection() ;
-  void ReadInfo(Standard_Integer& nbObj,TCollection_AsciiString& dbVersion,TCollection_AsciiString& date,TCollection_AsciiString& schemaName,TCollection_AsciiString& schemaVersion,TCollection_ExtendedString& appName,TCollection_AsciiString& appVersion,TCollection_ExtendedString& objectType,TColStd_SequenceOfAsciiString& userInfo) ;
-  void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData);
-  Storage_Error EndReadInfoSection() ;
-  Storage_Error BeginWriteCommentSection() ;
-  void WriteComment(const TColStd_SequenceOfExtendedString& userComments) ;
-  Storage_Error EndWriteCommentSection() ;
-  Storage_Error BeginReadCommentSection() ;
-  void ReadComment(TColStd_SequenceOfExtendedString& userComments) ;
-  Storage_Error EndReadCommentSection() ;
-  Storage_Error BeginWriteTypeSection() ;
-  void SetTypeSectionSize(const Standard_Integer aSize) ;
-  void WriteTypeInformations(const Standard_Integer typeNum,const TCollection_AsciiString& typeName) ;
-  Storage_Error EndWriteTypeSection() ;
-  Storage_Error BeginReadTypeSection() ;
-  Standard_Integer TypeSectionSize() ;
-  void ReadTypeInformations(Standard_Integer& typeNum,TCollection_AsciiString& typeName) ;
-  Storage_Error EndReadTypeSection() ;
-  Storage_Error BeginWriteRootSection() ;
-  void SetRootSectionSize(const Standard_Integer aSize) ;
-  void WriteRoot(const TCollection_AsciiString& rootName,const Standard_Integer aRef,const TCollection_AsciiString& aType) ;
-  Storage_Error EndWriteRootSection() ;
-  Storage_Error BeginReadRootSection() ;
-  Standard_Integer RootSectionSize() ;
-  void ReadRoot(TCollection_AsciiString& rootName,Standard_Integer& aRef,TCollection_AsciiString& aType) ;
-  Storage_Error EndReadRootSection() ;
-  Storage_Error BeginWriteRefSection() ;
-  void SetRefSectionSize(const Standard_Integer aSize) ;
-  void WriteReferenceType(const Standard_Integer reference,const Standard_Integer typeNum) ;
-  Storage_Error EndWriteRefSection() ;
-  Storage_Error BeginReadRefSection() ;
-  Standard_Integer RefSectionSize() ;
-  void ReadReferenceType(Standard_Integer& reference,Standard_Integer& typeNum) ;
-  Storage_Error EndReadRefSection() ;
-  Storage_Error BeginWriteDataSection() ;
-  void WritePersistentObjectHeader(const Standard_Integer aRef,const Standard_Integer aType) ;
-  void BeginWritePersistentObjectData() ;
-  void BeginWriteObjectData() ;
-  void EndWriteObjectData() ;
-  void EndWritePersistentObjectData() ;
-  Storage_Error EndWriteDataSection() ;
-  Storage_Error BeginReadDataSection() ;
-  void ReadPersistentObjectHeader(Standard_Integer& aRef,Standard_Integer& aType) ;
-  void BeginReadPersistentObjectData() ;
-  void BeginReadObjectData() ;
-  void EndReadObjectData() ;
-  void EndReadPersistentObjectData() ;
-  Storage_Error EndReadDataSection() ;
-  void SkipObject() ;
-  Storage_BaseDriver& PutReference(const Standard_Integer aValue) ;
-  Storage_BaseDriver& PutCharacter(const Standard_Character aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Character aValue) 
-{
-  return PutCharacter(aValue);
-}
-
-  Storage_BaseDriver& PutExtCharacter(const Standard_ExtCharacter aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_ExtCharacter aValue) 
-{
-  return PutExtCharacter(aValue);
-}
-
-  Storage_BaseDriver& PutInteger(const Standard_Integer aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Integer aValue) 
-{
-  return PutInteger(aValue);
-}
-
-  Storage_BaseDriver& PutBoolean(const Standard_Boolean aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Boolean aValue) 
-{
-  return PutBoolean(aValue);
-}
-
-  Storage_BaseDriver& PutReal(const Standard_Real aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Real aValue) 
-{
-  return PutReal(aValue);
-}
-
-  Storage_BaseDriver& PutShortReal(const Standard_ShortReal aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_ShortReal aValue) 
-{
-  return PutShortReal(aValue);
-}
-
-  Storage_BaseDriver& GetReference(Standard_Integer& aValue) ;
-  Storage_BaseDriver& GetCharacter(Standard_Character& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Character& aValue) 
-{
-  return GetCharacter(aValue);
-}
-
-  Storage_BaseDriver& GetExtCharacter(Standard_ExtCharacter& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_ExtCharacter& aValue) 
-{
-  return GetExtCharacter(aValue);
-}
-
-  Storage_BaseDriver& GetInteger(Standard_Integer& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Integer& aValue) 
-{
-  return GetInteger(aValue);
-}
-
-  Storage_BaseDriver& GetBoolean(Standard_Boolean& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Boolean& aValue) 
-{
-  return GetBoolean(aValue);
-}
-
-  Storage_BaseDriver& GetReal(Standard_Real& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Real& aValue) 
-{
-  return GetReal(aValue);
-}
-
-  Storage_BaseDriver& GetShortReal(Standard_ShortReal& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_ShortReal& aValue) 
-{
-  return GetShortReal(aValue);
-}
-
-  Storage_Error Close() ;
-  void Destroy() ;
-~DDF_IOStream()
-{
-  Destroy();
-}
-
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- // 
-  void ReadLine(TCollection_AsciiString& buffer) ;
-  void ReadWord(TCollection_AsciiString& buffer) ;
-  void ReadExtendedLine(TCollection_ExtendedString& buffer) ;
-  void WriteExtendedLine(const TCollection_ExtendedString& buffer) ;
-  void ReadChar(TCollection_AsciiString& buffer,const Standard_Integer rsize) ;
-  void ReadString(TCollection_AsciiString& buffer) ;
-  void FlushEndOfLine() ;
-  Storage_Error FindTag(const Standard_CString aTag) ;
-
-
- // Fields PROTECTED
- //
-
-
-private: 
-
- // Methods PRIVATE
- // 
-static Standard_CString MagicNumber() ;
-
-
- // Fields PRIVATE
- //
-//FSD_FStream myStream;
-std::istream* myIStream;
-std::ostream* myOStream;
-
-
-};
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-#endif
index 7e9808d9dd45c82c19135bd42bebc1a01e2e4b02..96414a78a20393c0eeba86175b1fe321444c5af8 100755 (executable)
@@ -9,8 +9,6 @@ DDF_BrowserCommands.cxx
 DDF_Data.cxx
 DDF_Data.hxx
 DDF_DataCommands.cxx
-DDF_IOStream.cxx
-DDF_IOStream.hxx
 DDF_ListIteratorOfTransactionStack.hxx
 DDF_Transaction.cxx
 DDF_Transaction.hxx
index 3237ae4e311dd61b6c5a9128a3aacffb380e04c8..b18462bc8ecbc68e8bb6642068b4542f0b9f93ba 100644 (file)
 #include <StdStorage_TypeData.hxx>
 #include <ShapePersistent_TopoDS.hxx>
 
+//==========================================================
+// ErrorMessage
+//==========================================================
+
+static void DDocStd_StorageErrorMessage (Draw_Interpretor& theDI, const Storage_Error theStatus)
+{
+  switch (theStatus) {
+  case Storage_VSOk:
+    break;
+  case Storage_VSOpenError:
+    theDI << "Storage error: failed to open the stream";
+    break;
+  case Storage_VSModeError:
+    theDI << "Storage error: the stream is opened with a wrong mode for operation ";
+    break;
+  case Storage_VSCloseError:
+    theDI << "Storage error: failed to closing the stream";
+    break;
+  case Storage_VSAlreadyOpen:
+    theDI << "Storage error: stream is already opened";
+    break;
+  case Storage_VSNotOpen:
+    theDI << "Storage error: stream not opened";
+    break;
+  case Storage_VSSectionNotFound:
+    theDI << "Storage error: the section is not found";
+    break;
+  case Storage_VSWriteError:
+    theDI << "Storage error: error during writing";
+    break;
+  case Storage_VSFormatError:
+    theDI << "Storage error: wrong format error occured while reading";
+    break;
+  case Storage_VSUnknownType:
+    theDI << "Storage error: try to read an unknown type";
+    break;
+  case Storage_VSTypeMismatch:
+    theDI << "Storage error: try to read a wrong primitive type (read a char while expecting a real)";
+    break;
+  case Storage_VSInternalError:
+    theDI << "Storage error: internal error";
+    break;
+  case Storage_VSExtCharParityError:
+    theDI << "Storage error: parity error";
+    break;
+  default:
+    theDI << "Storage error: unknown error code";
+    break;
+  }
+}
+
 //=======================================================================
 //function : DDocStd_ShapeSchema_Write 
 //=======================================================================
@@ -51,7 +102,7 @@ static Standard_Integer DDocStd_fsdwrite(Draw_Interpretor& theDI,
     return 1;
   }
 
-  NCollection_Handle<Storage_BaseDriver> aFileDriver(new FSD_File);
+  Handle(Storage_BaseDriver) aFileDriver(new FSD_File);
 
   Standard_Boolean hasStorageDriver = Standard_False;
   Standard_Integer iArgN = theArgNb - 1;
@@ -76,8 +127,9 @@ static Standard_Integer DDocStd_fsdwrite(Draw_Interpretor& theDI,
 
   Storage_Error aStatus = aFileDriver->Open(theArgs[iArgN], Storage_VSWrite);
   if (aStatus != Storage_VSOk) {
-    theDI << "Error : couldn't open file '" << "' for writing (" << aStatus << ")\n";
-    return 1;
+    theDI << "Error: cannot  open file '" << "' for writing (" << aStatus << ")\n";
+    DDocStd_StorageErrorMessage (theDI, aStatus);
+    return 0;
   }
 
   TopTools_SequenceOfShape aShapes;
@@ -129,15 +181,9 @@ static Standard_Integer DDocStd_fsdwrite(Draw_Interpretor& theDI,
     aData->RootData()->AddRoot(aRoot);
   }
 
-  Storage_Error anError = StdStorage::Write(*aFileDriver, aData);
-
+  Storage_Error anError = StdStorage::Write(aFileDriver, aData);
   aFileDriver->Close();
-
-  if (anError != Storage_VSOk)
-  {
-    theDI << "Error : " << anError << "\n";
-    return 1;
-  }
+  DDocStd_StorageErrorMessage(theDI, anError);
 
   return 0;
 }
@@ -170,8 +216,8 @@ static Standard_Integer DDocStd_fsdread(Draw_Interpretor& theDI,
   Storage_Error anError = StdStorage::Read(TCollection_AsciiString(theArgs[1]), aData);
   if (anError != Storage_VSOk)
   {
-    theDI << "Error : " << anError << "\n";
-    return 1;
+    DDocStd_StorageErrorMessage(theDI, anError);
+    return 0;
   }
 
   TopTools_SequenceOfShape aShapes;
index 8cc23444cfc15908239c102b0832c53ee0672248..e28344ade0d5ebf1f5c7274db3586477add8b759 100644 (file)
@@ -32,6 +32,8 @@
 
 const Standard_CString MAGICNUMBER = "BINFILE";
 
+IMPLEMENT_STANDARD_RTTIEXT(FSD_BinaryFile,Storage_BaseDriver)
+
 //=======================================================================
 //function : FSD_BinaryFile
 //purpose  : 
index 09921b8b30ab0b3b81b7abc7bf162f0e365e20b7..564734a615e0b88f084ca585e1947a39b65dbd83 100644 (file)
 #ifndef _FSD_BinaryFile_HeaderFile
 #define _FSD_BinaryFile_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
 #include <FSD_BStream.hxx>
 #include <FSD_FileHeader.hxx>
 #include <Storage_BaseDriver.hxx>
 #include <Standard_Integer.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_SequenceOfExtendedString.hxx>
-#include <Standard_Character.hxx>
-#include <Standard_ExtCharacter.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_ShortReal.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Size.hxx>
+
 class Storage_StreamTypeMismatchError;
 class Storage_StreamFormatError;
 class Storage_StreamWriteError;
 class Storage_StreamExtCharParityError;
 class TCollection_AsciiString;
 class TCollection_ExtendedString;
-class Storage_BaseDriver;
 class Storage_HeaderData;
 
-
 // Macro that tells if bytes must be reversed when read/write 
 // data to/from a binary file. It is needed to provide binary file compatibility
 // between little and big endian platforms.
@@ -60,26 +49,27 @@ class Storage_HeaderData;
 #endif
 #endif
 
+DEFINE_STANDARD_HANDLE(FSD_BinaryFile,Storage_BaseDriver)
 
 class FSD_BinaryFile  : public Storage_BaseDriver
 {
 public:
+  DEFINE_STANDARD_RTTIEXT(FSD_BinaryFile,Storage_BaseDriver)
 
-  DEFINE_STANDARD_ALLOC
+public:
 
-  
   Standard_EXPORT FSD_BinaryFile();
   
-  Standard_EXPORT Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
+  Standard_EXPORT Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode) Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Boolean IsEnd();
+  Standard_EXPORT Standard_Boolean IsEnd() Standard_OVERRIDE;
   
   //! return position in the file. Return -1 upon error.
-  Standard_EXPORT Storage_Position Tell();
+  Standard_EXPORT Storage_Position Tell() Standard_OVERRIDE;
   
   Standard_EXPORT static Storage_Error IsGoodFileType (const TCollection_AsciiString& aName);
   
-  Standard_EXPORT Storage_Error BeginWriteInfoSection();
+  Standard_EXPORT Storage_Error BeginWriteInfoSection() Standard_OVERRIDE;
 
   Standard_EXPORT static Standard_Integer WriteInfo (Standard_OStream& theOStream,
                                                      const Standard_Integer nbObj,
@@ -93,223 +83,206 @@ public:
                                                      const TColStd_SequenceOfAsciiString& userInfo,
                                                      const Standard_Boolean theOnlyCount = Standard_False);
   
-  Standard_EXPORT void WriteInfo (const Standard_Integer nbObj, const TCollection_AsciiString& dbVersion, const TCollection_AsciiString& date, const TCollection_AsciiString& schemaName, const TCollection_AsciiString& schemaVersion, const TCollection_ExtendedString& appName, const TCollection_AsciiString& appVersion, const TCollection_ExtendedString& objectType, const TColStd_SequenceOfAsciiString& userInfo);
+  Standard_EXPORT void WriteInfo (const Standard_Integer nbObj, 
+                                  const TCollection_AsciiString& dbVersion, 
+                                  const TCollection_AsciiString& date, 
+                                  const TCollection_AsciiString& schemaName, 
+                                  const TCollection_AsciiString& schemaVersion, 
+                                  const TCollection_ExtendedString& appName, 
+                                  const TCollection_AsciiString& appVersion, 
+                                  const TCollection_ExtendedString& objectType, 
+                                  const TColStd_SequenceOfAsciiString& userInfo) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error EndWriteInfoSection();
+  Standard_EXPORT Storage_Error EndWriteInfoSection() Standard_OVERRIDE;
 
   Standard_EXPORT Storage_Error EndWriteInfoSection(Standard_OStream& theOStream);
   
-  Standard_EXPORT Storage_Error BeginReadInfoSection();
+  Standard_EXPORT Storage_Error BeginReadInfoSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void ReadInfo (Standard_Integer& nbObj, TCollection_AsciiString& dbVersion, TCollection_AsciiString& date, TCollection_AsciiString& schemaName, TCollection_AsciiString& schemaVersion, TCollection_ExtendedString& appName, TCollection_AsciiString& appVersion, TCollection_ExtendedString& objectType, TColStd_SequenceOfAsciiString& userInfo);
+  Standard_EXPORT void ReadInfo (Standard_Integer& nbObj, 
+                                 TCollection_AsciiString& dbVersion, 
+                                 TCollection_AsciiString& date, 
+                                 TCollection_AsciiString& schemaName, 
+                                 TCollection_AsciiString& schemaVersion, 
+                                 TCollection_ExtendedString& appName, 
+                                 TCollection_AsciiString& appVersion, 
+                                 TCollection_ExtendedString& objectType, 
+                                 TColStd_SequenceOfAsciiString& userInfo) Standard_OVERRIDE;
   
-  Standard_EXPORT void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData);
+  Standard_EXPORT void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData) Standard_OVERRIDE;
 
-  Standard_EXPORT Storage_Error EndReadInfoSection();
+  Standard_EXPORT Storage_Error EndReadInfoSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginWriteCommentSection();
+  Standard_EXPORT Storage_Error BeginWriteCommentSection() Standard_OVERRIDE;
   
   Standard_EXPORT Storage_Error BeginWriteCommentSection (Standard_OStream& theOStream);
   
-  Standard_EXPORT void WriteComment (const TColStd_SequenceOfExtendedString& userComments);
+  Standard_EXPORT void WriteComment (const TColStd_SequenceOfExtendedString& userComments) Standard_OVERRIDE;
   
   Standard_EXPORT static Standard_Integer WriteComment (Standard_OStream& theOStream,
                                                         const TColStd_SequenceOfExtendedString& theComments,
                                                         const Standard_Boolean theOnlyCount = Standard_False);
   
-  Standard_EXPORT Storage_Error EndWriteCommentSection();
+  Standard_EXPORT Storage_Error EndWriteCommentSection() Standard_OVERRIDE;
 
   Standard_EXPORT Storage_Error EndWriteCommentSection (Standard_OStream& theOStream);
   
-  Standard_EXPORT Storage_Error BeginReadCommentSection();
+  Standard_EXPORT Storage_Error BeginReadCommentSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void ReadComment (TColStd_SequenceOfExtendedString& userComments);
+  Standard_EXPORT void ReadComment (TColStd_SequenceOfExtendedString& userComments) Standard_OVERRIDE;
 
   Standard_EXPORT static void ReadComment (Standard_IStream& theIStream, TColStd_SequenceOfExtendedString& userComments);
   
-  Standard_EXPORT Storage_Error EndReadCommentSection();
+  Standard_EXPORT Storage_Error EndReadCommentSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginWriteTypeSection();
+  Standard_EXPORT Storage_Error BeginWriteTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void SetTypeSectionSize (const Standard_Integer aSize);
+  Standard_EXPORT void SetTypeSectionSize (const Standard_Integer aSize) Standard_OVERRIDE;
   
-  Standard_EXPORT void WriteTypeInformations (const Standard_Integer typeNum, const TCollection_AsciiString& typeName);
+  Standard_EXPORT void WriteTypeInformations (const Standard_Integer typeNum, const TCollection_AsciiString& typeName) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error EndWriteTypeSection();
+  Standard_EXPORT Storage_Error EndWriteTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginReadTypeSection();
+  Standard_EXPORT Storage_Error BeginReadTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Integer TypeSectionSize();
+  Standard_EXPORT Standard_Integer TypeSectionSize() Standard_OVERRIDE;
 
   Standard_EXPORT static Standard_Integer TypeSectionSize(Standard_IStream& theIStream);
   
-  Standard_EXPORT void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName);
+  Standard_EXPORT void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName) Standard_OVERRIDE;
 
-  Standard_EXPORT static void ReadTypeInformations (Standard_IStream& theIStream, Standard_Integer& typeNum, TCollection_AsciiString& typeName);
+  Standard_EXPORT static void ReadTypeInformations (Standard_IStream& theIStream, 
+                                                    Standard_Integer& typeNum, 
+                                                    TCollection_AsciiString& typeName);
   
-  Standard_EXPORT Storage_Error EndReadTypeSection();
+  Standard_EXPORT Storage_Error EndReadTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginWriteRootSection();
+  Standard_EXPORT Storage_Error BeginWriteRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void SetRootSectionSize (const Standard_Integer aSize);
+  Standard_EXPORT void SetRootSectionSize (const Standard_Integer aSize) Standard_OVERRIDE;
   
-  Standard_EXPORT void WriteRoot (const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& aType);
+  Standard_EXPORT void WriteRoot (const TCollection_AsciiString& rootName, 
+                                  const Standard_Integer aRef, 
+                                  const TCollection_AsciiString& aType) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error EndWriteRootSection();
+  Standard_EXPORT Storage_Error EndWriteRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginReadRootSection();
+  Standard_EXPORT Storage_Error BeginReadRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Integer RootSectionSize();
+  Standard_EXPORT Standard_Integer RootSectionSize() Standard_OVERRIDE;
   
   Standard_EXPORT static Standard_Integer RootSectionSize(Standard_IStream& theIStream);
   
-  Standard_EXPORT void ReadRoot (TCollection_AsciiString& rootName, Standard_Integer& aRef, TCollection_AsciiString& aType);
+  Standard_EXPORT void ReadRoot (TCollection_AsciiString& rootName, 
+                                 Standard_Integer& aRef, 
+                                 TCollection_AsciiString& aType) Standard_OVERRIDE;
 
-  Standard_EXPORT static void ReadRoot (Standard_IStream& theIStream, TCollection_AsciiString& rootName, Standard_Integer& aRef, TCollection_AsciiString& aType);
+  Standard_EXPORT static void ReadRoot (Standard_IStream& theIStream, 
+                                        TCollection_AsciiString& rootName, 
+                                        Standard_Integer& aRef, 
+                                        TCollection_AsciiString& aType);
   
-  Standard_EXPORT Storage_Error EndReadRootSection();
+  Standard_EXPORT Storage_Error EndReadRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginWriteRefSection();
+  Standard_EXPORT Storage_Error BeginWriteRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void SetRefSectionSize (const Standard_Integer aSize);
+  Standard_EXPORT void SetRefSectionSize (const Standard_Integer aSize) Standard_OVERRIDE;
   
-  Standard_EXPORT void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum);
+  Standard_EXPORT void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error EndWriteRefSection();
+  Standard_EXPORT Storage_Error EndWriteRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginReadRefSection();
+  Standard_EXPORT Storage_Error BeginReadRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Integer RefSectionSize();
+  Standard_EXPORT Standard_Integer RefSectionSize() Standard_OVERRIDE;
 
   Standard_EXPORT static Standard_Integer RefSectionSize(Standard_IStream& theIStream);
   
-  Standard_EXPORT void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum);
+  Standard_EXPORT void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum) Standard_OVERRIDE;
 
-  Standard_EXPORT static void ReadReferenceType (Standard_IStream& theIStream, Standard_Integer& reference, Standard_Integer& typeNum);
+  Standard_EXPORT static void ReadReferenceType (Standard_IStream& theIStream, 
+                                                 Standard_Integer& reference, 
+                                                 Standard_Integer& typeNum);
   
-  Standard_EXPORT Storage_Error EndReadRefSection();
+  Standard_EXPORT Storage_Error EndReadRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginWriteDataSection();
+  Standard_EXPORT Storage_Error BeginWriteDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType);
+  Standard_EXPORT void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType) Standard_OVERRIDE;
   
-  Standard_EXPORT void BeginWritePersistentObjectData();
+  Standard_EXPORT void BeginWritePersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT void BeginWriteObjectData();
+  Standard_EXPORT void BeginWriteObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT void EndWriteObjectData();
+  Standard_EXPORT void EndWriteObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT void EndWritePersistentObjectData();
+  Standard_EXPORT void EndWritePersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error EndWriteDataSection();
+  Standard_EXPORT Storage_Error EndWriteDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error BeginReadDataSection();
+  Standard_EXPORT Storage_Error BeginReadDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType);
+  Standard_EXPORT void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType) Standard_OVERRIDE;
   
-  Standard_EXPORT void BeginReadPersistentObjectData();
+  Standard_EXPORT void BeginReadPersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT void BeginReadObjectData();
+  Standard_EXPORT void BeginReadObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT void EndReadObjectData();
+  Standard_EXPORT void EndReadObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT void EndReadPersistentObjectData();
+  Standard_EXPORT void EndReadPersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error EndReadDataSection();
+  Standard_EXPORT Storage_Error EndReadDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT void SkipObject();
+  Standard_EXPORT void SkipObject() Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& PutReference (const Standard_Integer aValue);
+  Standard_EXPORT Storage_BaseDriver& PutReference (const Standard_Integer aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& PutCharacter (const Standard_Character aValue);
-Storage_BaseDriver& operator << (const Standard_Character aValue)
-{
-  return PutCharacter(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& PutCharacter (const Standard_Character aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& PutExtCharacter (const Standard_ExtCharacter aValue);
-Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
-{
-  return PutExtCharacter(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& PutExtCharacter (const Standard_ExtCharacter aValue) Standard_OVERRIDE;
   
   Standard_EXPORT static Standard_Integer PutInteger (Standard_OStream& theOStream,
                                                       const Standard_Integer aValue,
                                                       const Standard_Boolean theOnlyCount = Standard_False);
 
-  Standard_EXPORT Storage_BaseDriver& PutInteger (const Standard_Integer aValue);
-Storage_BaseDriver& operator << (const Standard_Integer aValue)
-{
-  return PutInteger(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& PutInteger (const Standard_Integer aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue);
-Storage_BaseDriver& operator << (const Standard_Boolean aValue)
-{
-  return PutBoolean(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& PutReal (const Standard_Real aValue);
-Storage_BaseDriver& operator << (const Standard_Real aValue)
-{
-  return PutReal(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& PutReal (const Standard_Real aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue);
-Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
-{
-  return PutShortReal(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& GetReference (Standard_Integer& aValue);
+  Standard_EXPORT Storage_BaseDriver& GetReference (Standard_Integer& aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& GetCharacter (Standard_Character& aValue);
-Storage_BaseDriver& operator >> (Standard_Character& aValue)
-{
-  return GetCharacter(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& GetCharacter (Standard_Character& aValue) Standard_OVERRIDE;
 
   Standard_EXPORT static void GetReference (Standard_IStream& theIStream, Standard_Integer& aValue);
   
-  Standard_EXPORT Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue);
-Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
-{
-  return GetExtCharacter(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& GetInteger (Standard_Integer& aValue);
-Storage_BaseDriver& operator >> (Standard_Integer& aValue)
-{
-  return GetInteger(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& GetInteger (Standard_Integer& aValue) Standard_OVERRIDE;
 
   Standard_EXPORT static void GetInteger (Standard_IStream& theIStream, Standard_Integer& aValue);
   
-  Standard_EXPORT Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue);
-Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
-{
-  return GetBoolean(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& GetReal (Standard_Real& aValue);
-Storage_BaseDriver& operator >> (Standard_Real& aValue)
-{
-  return GetReal(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& GetReal (Standard_Real& aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue);
-Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
-{
-  return GetShortReal(aValue);
-}
+  Standard_EXPORT Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT Storage_Error Close();
+  Standard_EXPORT Storage_Error Close() Standard_OVERRIDE;
   
   Standard_EXPORT void Destroy();
-~FSD_BinaryFile()
-{
-  Destroy();
-}
+
+  ~FSD_BinaryFile()
+  {
+    Destroy();
+  }
+
+public:
+  //!@name Own methods
 
   ///Inverse bytes in integer value
   static Standard_Integer InverseInt(const Standard_Integer theValue)
@@ -353,7 +326,6 @@ Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
   Standard_EXPORT static Standard_CString MagicNumber();
 
 protected:
-
   
   //! read <rsize> character from the current position.
   Standard_EXPORT void ReadChar (TCollection_AsciiString& buffer, const Standard_Size rsize);
index cf85fd31d1b938f8d1e61cbadcb8a5677b8f7ef0..45960e491a1e067a136768f029a4b8a40aa84e4c 100644 (file)
@@ -20,6 +20,8 @@
 
 const Standard_CString MAGICNUMBER = "CMPFILE";
 
+IMPLEMENT_STANDARD_RTTIEXT(FSD_CmpFile, FSD_File)
+
 //=======================================================================
 //function : FSD_CmpFile
 //purpose  : 
index 683ede9dc4047f530c55d6bae314f79b1c53161b..5576850328d689653be18ae7e001f68533010834 100644 (file)
 #include <Storage_BaseDriver.hxx>
 #include <Storage_Error.hxx>
 #include <Storage_OpenMode.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
+
 class TCollection_AsciiString;
 class TCollection_ExtendedString;
 class Storage_BaseDriver;
 
+DEFINE_STANDARD_HANDLE(FSD_CmpFile,FSD_File)
+
 class FSD_CmpFile : public FSD_File
 {
 public:
+  DEFINE_STANDARD_RTTIEXT(FSD_CmpFile,FSD_File)
 
-  DEFINE_STANDARD_ALLOC
-
-
+public:
   Standard_EXPORT FSD_CmpFile();
 
-  Standard_EXPORT Storage_Error Open(const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
+  Standard_EXPORT Storage_Error Open(const TCollection_AsciiString& aName, const Storage_OpenMode aMode) Standard_OVERRIDE;
 
   Standard_EXPORT static Storage_Error IsGoodFileType(const TCollection_AsciiString& aName);
 
-  Standard_EXPORT Storage_Error BeginWriteInfoSection();
+  Standard_EXPORT Storage_Error BeginWriteInfoSection() Standard_OVERRIDE;
 
-  Standard_EXPORT Storage_Error BeginReadInfoSection();
+  Standard_EXPORT Storage_Error BeginReadInfoSection() Standard_OVERRIDE;
 
-  Standard_EXPORT void WritePersistentObjectHeader(const Standard_Integer aRef, const Standard_Integer aType);
+  Standard_EXPORT void WritePersistentObjectHeader(const Standard_Integer aRef, const Standard_Integer aType) Standard_OVERRIDE;
 
-  Standard_EXPORT void BeginWritePersistentObjectData();
+  Standard_EXPORT void BeginWritePersistentObjectData() Standard_OVERRIDE;
 
-  Standard_EXPORT void BeginWriteObjectData();
+  Standard_EXPORT void BeginWriteObjectData() Standard_OVERRIDE;
 
-  Standard_EXPORT void EndWriteObjectData();
+  Standard_EXPORT void EndWriteObjectData() Standard_OVERRIDE;
 
-  Standard_EXPORT void EndWritePersistentObjectData();
+  Standard_EXPORT void EndWritePersistentObjectData() Standard_OVERRIDE;
 
-  Standard_EXPORT void ReadPersistentObjectHeader(Standard_Integer& aRef, Standard_Integer& aType);
+  Standard_EXPORT void ReadPersistentObjectHeader(Standard_Integer& aRef, Standard_Integer& aType) Standard_OVERRIDE;
 
-  Standard_EXPORT void BeginReadPersistentObjectData();
+  Standard_EXPORT void BeginReadPersistentObjectData() Standard_OVERRIDE;
 
-  Standard_EXPORT void BeginReadObjectData();
+  Standard_EXPORT void BeginReadObjectData() Standard_OVERRIDE;
 
-  Standard_EXPORT void EndReadObjectData();
+  Standard_EXPORT void EndReadObjectData() Standard_OVERRIDE;
 
-  Standard_EXPORT void EndReadPersistentObjectData();
+  Standard_EXPORT void EndReadPersistentObjectData() Standard_OVERRIDE;
 
   Standard_EXPORT void Destroy();
   ~FSD_CmpFile()
@@ -73,22 +72,19 @@ public:
 
   Standard_EXPORT static Standard_CString MagicNumber();
 
-
-
 protected:
 
-
   //! read from the current position to the end of line.
-  Standard_EXPORT void ReadLine(TCollection_AsciiString& buffer);
+  Standard_EXPORT void ReadLine(TCollection_AsciiString& buffer) Standard_OVERRIDE;
 
   //! read extended chars (unicode) from the current position to the end of line.
-  Standard_EXPORT void ReadExtendedLine(TCollection_ExtendedString& buffer);
+  Standard_EXPORT void ReadExtendedLine(TCollection_ExtendedString& buffer) Standard_OVERRIDE;
 
   //! write from the current position to the end of line.
-  Standard_EXPORT void WriteExtendedLine(const TCollection_ExtendedString& buffer);
+  Standard_EXPORT void WriteExtendedLine(const TCollection_ExtendedString& buffer) Standard_OVERRIDE;
 
   //! read from the first none space character position to the end of line.
-  Standard_EXPORT void ReadString(TCollection_AsciiString& buffer);
+  Standard_EXPORT void ReadString(TCollection_AsciiString& buffer) Standard_OVERRIDE;
 
 };
 
index 2bdf0f53f4a8ad00a064a5e34bc219ac9a493d37..8ee7e2066d51766249ca67e7985bf550c31915d8 100644 (file)
@@ -30,6 +30,8 @@ const Standard_Integer SIZEOFNORMALEXTENDEDSECTION = 16;
 
 #define USEOSDREAL 1
 
+IMPLEMENT_STANDARD_RTTIEXT(FSD_File, Storage_BaseDriver)
+
 //=======================================================================
 //function : FSD_File
 //purpose  : 
index 7c7fcfd2abc163a7c595cbfbe6f30f25e02d75fd..f50b32660ee3fd421d56c45db9264fa212a54144 100644 (file)
 #ifndef _FSD_File_HeaderFile
 #define _FSD_File_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
 #include <FSD_FStream.hxx>
 #include <Storage_BaseDriver.hxx>
-#include <Storage_Error.hxx>
-#include <Storage_OpenMode.hxx>
-#include <Standard_Boolean.hxx>
-#include <Storage_Position.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-#include <Standard_Character.hxx>
-#include <Standard_ExtCharacter.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_ShortReal.hxx>
-#include <Standard_Size.hxx>
-#include <Standard_CString.hxx>
+
 class Storage_StreamTypeMismatchError;
 class Storage_StreamFormatError;
 class Storage_StreamWriteError;
@@ -44,17 +28,16 @@ class TCollection_AsciiString;
 class TCollection_ExtendedString;
 class Storage_BaseDriver;
 
-
+DEFINE_STANDARD_HANDLE(FSD_File,Storage_BaseDriver)
 
 //! A general driver which defines as a file, the
 //! physical container for data to be stored or retrieved.
 class FSD_File  : public Storage_BaseDriver
 {
 public:
+  DEFINE_STANDARD_RTTIEXT(FSD_File,Storage_BaseDriver)
 
-  DEFINE_STANDARD_ALLOC
-
-  
+public:
 
   //! Constructs a driver defining as a file, the physical
   //! container for data to be stored or retrieved.
@@ -68,203 +51,174 @@ public:
   //! The function returns Storage_VSOk if the file
   //! is opened correctly, or any other value of the
   //! Storage_Error enumeration which specifies the problem encountered.
-  Standard_EXPORT virtual Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
+  Standard_EXPORT virtual Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Standard_Boolean IsEnd();
+  Standard_EXPORT virtual Standard_Boolean IsEnd() Standard_OVERRIDE;
   
   //! return position in the file. Return -1 upon error.
-  Standard_EXPORT virtual Storage_Position Tell();
+  Standard_EXPORT virtual Storage_Position Tell() Standard_OVERRIDE;
   
   Standard_EXPORT static Storage_Error IsGoodFileType (const TCollection_AsciiString& aName);
   
-  Standard_EXPORT virtual Storage_Error BeginWriteInfoSection();
+  Standard_EXPORT virtual Storage_Error BeginWriteInfoSection() Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual void WriteInfo (const Standard_Integer nbObj, 
+                                          const TCollection_AsciiString& dbVersion, 
+                                          const TCollection_AsciiString& date, 
+                                          const TCollection_AsciiString& schemaName, 
+                                          const TCollection_AsciiString& schemaVersion, 
+                                          const TCollection_ExtendedString& appName, 
+                                          const TCollection_AsciiString& appVersion, 
+                                          const TCollection_ExtendedString& objectType, 
+                                          const TColStd_SequenceOfAsciiString& userInfo) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_Error EndWriteInfoSection() Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_Error BeginReadInfoSection() Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual void ReadInfo (Standard_Integer& nbObj, 
+                                         TCollection_AsciiString& dbVersion, 
+                                         TCollection_AsciiString& date, 
+                                         TCollection_AsciiString& schemaName, 
+                                         TCollection_AsciiString& schemaVersion, 
+                                         TCollection_ExtendedString& appName, 
+                                         TCollection_AsciiString& appVersion, 
+                                         TCollection_ExtendedString& objectType, 
+                                         TColStd_SequenceOfAsciiString& userInfo) Standard_OVERRIDE;
+
+  Standard_EXPORT virtual void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void WriteInfo (const Standard_Integer nbObj, const TCollection_AsciiString& dbVersion, const TCollection_AsciiString& date, const TCollection_AsciiString& schemaName, const TCollection_AsciiString& schemaVersion, const TCollection_ExtendedString& appName, const TCollection_AsciiString& appVersion, const TCollection_ExtendedString& objectType, const TColStd_SequenceOfAsciiString& userInfo);
+  Standard_EXPORT virtual Storage_Error EndReadInfoSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndWriteInfoSection();
+  Standard_EXPORT virtual Storage_Error BeginWriteCommentSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginReadInfoSection();
+  Standard_EXPORT virtual void WriteComment (const TColStd_SequenceOfExtendedString& userComments) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ReadInfo (Standard_Integer& nbObj, TCollection_AsciiString& dbVersion, TCollection_AsciiString& date, TCollection_AsciiString& schemaName, TCollection_AsciiString& schemaVersion, TCollection_ExtendedString& appName, TCollection_AsciiString& appVersion, TCollection_ExtendedString& objectType, TColStd_SequenceOfAsciiString& userInfo);
-
-  Standard_EXPORT virtual void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData);
+  Standard_EXPORT virtual Storage_Error EndWriteCommentSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndReadInfoSection();
+  Standard_EXPORT virtual Storage_Error BeginReadCommentSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginWriteCommentSection();
+  Standard_EXPORT virtual void ReadComment (TColStd_SequenceOfExtendedString& userComments) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void WriteComment (const TColStd_SequenceOfExtendedString& userComments);
+  Standard_EXPORT virtual Storage_Error EndReadCommentSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndWriteCommentSection();
+  Standard_EXPORT virtual Storage_Error BeginWriteTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginReadCommentSection();
+  Standard_EXPORT virtual void SetTypeSectionSize (const Standard_Integer aSize) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ReadComment (TColStd_SequenceOfExtendedString& userComments);
+  Standard_EXPORT virtual void WriteTypeInformations (const Standard_Integer typeNum, 
+                                                      const TCollection_AsciiString& typeName) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndReadCommentSection();
+  Standard_EXPORT virtual Storage_Error EndWriteTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginWriteTypeSection();
+  Standard_EXPORT virtual Storage_Error BeginReadTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void SetTypeSectionSize (const Standard_Integer aSize);
+  Standard_EXPORT virtual Standard_Integer TypeSectionSize() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void WriteTypeInformations (const Standard_Integer typeNum, const TCollection_AsciiString& typeName);
+  Standard_EXPORT virtual void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndWriteTypeSection();
+  Standard_EXPORT virtual Storage_Error EndReadTypeSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginReadTypeSection();
+  Standard_EXPORT virtual Storage_Error BeginWriteRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Standard_Integer TypeSectionSize();
+  Standard_EXPORT virtual void SetRootSectionSize (const Standard_Integer aSize) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName);
+  Standard_EXPORT virtual void WriteRoot (const TCollection_AsciiString& rootName, 
+                                          const Standard_Integer aRef, 
+                                          const TCollection_AsciiString& aType) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndReadTypeSection();
+  Standard_EXPORT virtual Storage_Error EndWriteRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginWriteRootSection();
+  Standard_EXPORT virtual Storage_Error BeginReadRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void SetRootSectionSize (const Standard_Integer aSize);
+  Standard_EXPORT virtual Standard_Integer RootSectionSize() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void WriteRoot (const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& aType);
+  Standard_EXPORT virtual void ReadRoot (TCollection_AsciiString& rootName, 
+                                         Standard_Integer& aRef, 
+                                         TCollection_AsciiString& aType) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndWriteRootSection();
+  Standard_EXPORT virtual Storage_Error EndReadRootSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginReadRootSection();
+  Standard_EXPORT virtual Storage_Error BeginWriteRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Standard_Integer RootSectionSize();
+  Standard_EXPORT virtual void SetRefSectionSize (const Standard_Integer aSize) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ReadRoot (TCollection_AsciiString& rootName, Standard_Integer& aRef, TCollection_AsciiString& aType);
+  Standard_EXPORT virtual void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndReadRootSection();
+  Standard_EXPORT virtual Storage_Error EndWriteRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginWriteRefSection();
+  Standard_EXPORT virtual Storage_Error BeginReadRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void SetRefSectionSize (const Standard_Integer aSize);
+  Standard_EXPORT virtual Standard_Integer RefSectionSize() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum);
+  Standard_EXPORT virtual void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndWriteRefSection();
+  Standard_EXPORT virtual Storage_Error EndReadRefSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginReadRefSection();
+  Standard_EXPORT virtual Storage_Error BeginWriteDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Standard_Integer RefSectionSize();
+  Standard_EXPORT virtual void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum);
+  Standard_EXPORT virtual void BeginWritePersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndReadRefSection();
+  Standard_EXPORT virtual void BeginWriteObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginWriteDataSection();
+  Standard_EXPORT virtual void EndWriteObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType);
+  Standard_EXPORT virtual void EndWritePersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void BeginWritePersistentObjectData();
+  Standard_EXPORT virtual Storage_Error EndWriteDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void BeginWriteObjectData();
+  Standard_EXPORT virtual Storage_Error BeginReadDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void EndWriteObjectData();
+  Standard_EXPORT virtual void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void EndWritePersistentObjectData();
+  Standard_EXPORT virtual void BeginReadPersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndWriteDataSection();
+  Standard_EXPORT virtual void BeginReadObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error BeginReadDataSection();
+  Standard_EXPORT virtual void EndReadObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType);
+  Standard_EXPORT virtual void EndReadPersistentObjectData() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void BeginReadPersistentObjectData();
+  Standard_EXPORT virtual Storage_Error EndReadDataSection() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void BeginReadObjectData();
+  Standard_EXPORT virtual void SkipObject() Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void EndReadObjectData();
+  Standard_EXPORT virtual Storage_BaseDriver& PutReference (const Standard_Integer aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void EndReadPersistentObjectData();
+  Standard_EXPORT virtual Storage_BaseDriver& PutCharacter (const Standard_Character aValue) Standard_OVERRIDE;
+
+  Standard_EXPORT virtual Storage_BaseDriver& PutExtCharacter(const Standard_ExtCharacter aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_Error EndReadDataSection();
+  Standard_EXPORT virtual Storage_BaseDriver& PutInteger (const Standard_Integer aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void SkipObject();
+  Standard_EXPORT virtual Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_BaseDriver& PutReference (const Standard_Integer aValue);
+  Standard_EXPORT virtual Storage_BaseDriver& PutReal (const Standard_Real aValue) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Storage_BaseDriver& PutCharacter (const Standard_Character aValue);
-
-  Storage_BaseDriver& operator << (const Standard_Character aValue)
-  {
-    return PutCharacter(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutExtCharacter (const Standard_ExtCharacter aValue);
-  Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
-  {
-    return PutExtCharacter(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutInteger (const Standard_Integer aValue);
-  Storage_BaseDriver& operator << (const Standard_Integer aValue)
-  {
-    return PutInteger(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue);
-  Storage_BaseDriver& operator << (const Standard_Boolean aValue)
-  {
-    return PutBoolean(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutReal (const Standard_Real aValue);
-  Storage_BaseDriver& operator << (const Standard_Real aValue)
-  {
-    return PutReal(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue);
-  Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
-  {
-    return PutShortReal(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetReference (Standard_Integer& aValue);
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetCharacter (Standard_Character& aValue);
-  Storage_BaseDriver& operator >> (Standard_Character& aValue)
-  {
-    return GetCharacter(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue);
-  Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
-  {
-    return GetExtCharacter(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetInteger (Standard_Integer& aValue);
-  Storage_BaseDriver& operator >> (Standard_Integer& aValue)
-  {
-    return GetInteger(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue);
-  Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
-  {
-    return GetBoolean(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetReal (Standard_Real& aValue);
-  Storage_BaseDriver& operator >> (Standard_Real& aValue)
-  {
-    return GetReal(aValue);
-  }
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue);
-  Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
-  {
-    return GetShortReal(aValue);
-  }
+  Standard_EXPORT virtual Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue) Standard_OVERRIDE;
   
+  Standard_EXPORT virtual Storage_BaseDriver& GetReference (Standard_Integer& aValue) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_BaseDriver& GetCharacter (Standard_Character& aValue) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_BaseDriver& GetInteger (Standard_Integer& aValue) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_BaseDriver& GetReal (Standard_Real& aValue) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue) Standard_OVERRIDE;  
 
   //! Closes the file driven by this driver. This file was
   //! opened by the last call to the function Open.
   //! The function returns Storage_VSOk if the
   //! closure is correctly done, or any other value of
   //! the Storage_Error enumeration which specifies the problem encountered.
-  Standard_EXPORT virtual Storage_Error Close();
+  Standard_EXPORT virtual Storage_Error Close() Standard_OVERRIDE;
   
   Standard_EXPORT void Destroy();
 ~FSD_File()
@@ -274,9 +228,7 @@ public:
 
   Standard_EXPORT static Standard_CString MagicNumber();
 
-
-  protected:
-
+protected:
   
   //! read from the current position to the end of line.
   Standard_EXPORT virtual void ReadLine (TCollection_AsciiString& buffer);
@@ -300,7 +252,7 @@ public:
   
   Standard_EXPORT virtual Storage_Error FindTag (const Standard_CString aTag);
 
-
+protected:
   FSD_FStream myStream;
 };
 
index e70a7c143763cd19eb72308e8900449ac1e79266..d6e4c28e8274afe0f431524ccd969557310defea 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef _FSD_FileHeader_HeaderFile
 #define _FSD_FileHeader_HeaderFile
 
+#include <Standard_PrimitiveTypes.hxx>
+
 struct FSD_FileHeader {
   Standard_Integer testindian;
   Standard_Integer binfo;
index db24d1be223202037ff69c6a4cd987fec2ba2940..01f9d8e6b919d96b15d636e147aa742fcc02ec1b 100644 (file)
@@ -37,7 +37,8 @@
 //purpose  : 
 //=======================================================================
 
-PCDM_TypeOfFileDriver PCDM::FileDriverType(const TCollection_AsciiString& aFileName, PCDM_BaseDriverPointer& aBaseDriver) {
+PCDM_TypeOfFileDriver PCDM::FileDriverType(const TCollection_AsciiString& aFileName, Handle(Storage_BaseDriver)& aBaseDriver)
+{
   if(FSD_CmpFile::IsGoodFileType(aFileName) == Storage_VSOk) {
     aBaseDriver=new FSD_CmpFile;
     return PCDM_TOFD_CmpFile;
@@ -61,7 +62,7 @@ PCDM_TypeOfFileDriver PCDM::FileDriverType(const TCollection_AsciiString& aFileN
 //purpose  : 
 //=======================================================================
 
-PCDM_TypeOfFileDriver PCDM::FileDriverType (Standard_IStream& theIStream, PCDM_BaseDriverPointer& theBaseDriver)
+PCDM_TypeOfFileDriver PCDM::FileDriverType (Standard_IStream& theIStream, Handle(Storage_BaseDriver)& theBaseDriver)
 {
   TCollection_AsciiString aReadMagicNumber;
 
index 18ff8ab89381464dc0a2b551e72fcbb444f61aee..30bf4fc7d30603059725ab05ed0c7485a08018cd 100644 (file)
 #ifndef _PCDM_HeaderFile
 #define _PCDM_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_IStream.hxx>
-
-#include <Standard_Boolean.hxx>
+#include <Storage_BaseDriver.hxx>
 #include <PCDM_TypeOfFileDriver.hxx>
-#include <PCDM_BaseDriverPointer.hxx>
+
 class CDM_Document;
 class PCDM_StorageDriver;
 class TCollection_AsciiString;
 
-
 class PCDM 
 {
 public:
-  Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType (const TCollection_AsciiString& aFileName, PCDM_BaseDriverPointer& aBaseDriver);
+  Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType (const TCollection_AsciiString& aFileName, 
+                                                               Handle(Storage_BaseDriver)& aBaseDriver);
   
-  Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType (Standard_IStream& theIStream, PCDM_BaseDriverPointer& theBaseDriver);
+  Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType (Standard_IStream& theIStream, 
+                                                               Handle(Storage_BaseDriver)& theBaseDriver);
 
   DEFINE_STANDARD_ALLOC
 };
index e8bae2cede28b59a0332114deab8b0b378c26848..143f2b0cc16c2b42ef12a099fb419ff58b7a1fa9 100644 (file)
@@ -18,6 +18,8 @@
 #define _PCDM_BaseDriverPointer_HeaderFile
 
 class Storage_BaseDriver;
-typedef Storage_BaseDriver* PCDM_BaseDriverPointer;
+
+Standard_DEPRECATED("Typedef PCDM_BaseDriverPointer is kept for compatibility only, instead consider using Handle(Storage_BaseDriver) explicitly")
+typedef Handle(Storage_BaseDriver) PCDM_BaseDriverPointer;
 
 #endif // _PCDM_BaseDriverPointer_HeaderFile
index e8304bf68dfaaa65c870aafc28f8f73e1aae47f1..f3cc807c5bd68a2af3987da402075e75d4229fbc 100644 (file)
@@ -45,7 +45,7 @@ static TCollection_ExtendedString TryXmlDriverType (Standard_IStream& theIStream
 //purpose  : 
 //=======================================================================
 
-void PCDM_ReadWriter::Open (Storage_BaseDriver&                 aDriver,
+void PCDM_ReadWriter::Open (const Handle(Storage_BaseDriver)&   aDriver,
                             const TCollection_ExtendedString&   aFileName,
                             const Storage_OpenMode              aMode)
 {
@@ -113,7 +113,7 @@ TCollection_ExtendedString PCDM_ReadWriter::FileFormat
 {
   TCollection_ExtendedString theFormat;
   
-  PCDM_BaseDriverPointer theFileDriver;
+  Handle(Storage_BaseDriver) theFileDriver;
 
   // conversion to UTF-8 is done inside
   TCollection_AsciiString theFileName (aFileName);
@@ -126,10 +126,10 @@ TCollection_ExtendedString PCDM_ReadWriter::FileFormat
   try {
     OCC_CATCH_SIGNALS
     
-    Open(*theFileDriver,aFileName,Storage_VSRead);
+    Open(theFileDriver,aFileName,Storage_VSRead);
     theFileIsOpen=Standard_True;
     Storage_HeaderData hd;
-    hd.Read (*theFileDriver);
+    hd.Read (theFileDriver);
     const TColStd_SequenceOfAsciiString &refUserInfo = hd.UserInfo();
     Standard_Boolean found=Standard_False;
     for (Standard_Integer i =1; !found && i<=  refUserInfo.Length() ; i++) {
@@ -142,16 +142,16 @@ TCollection_ExtendedString PCDM_ReadWriter::FileFormat
     if (!found)
     {
       Storage_TypeData td;
-      td.Read (*theFileDriver);
+      td.Read (theFileDriver);
       theFormat = td.Types()->Value(1);
     }
   }
   catch (Standard_Failure const&) {}
-
   
-  if(theFileIsOpen)theFileDriver->Close();
-
-  delete theFileDriver;
+  if(theFileIsOpen)
+  {
+    theFileDriver->Close();
+  }
 
   return theFormat;
 }
@@ -165,7 +165,7 @@ TCollection_ExtendedString PCDM_ReadWriter::FileFormat (Standard_IStream& theISt
 {
   TCollection_ExtendedString aFormat;
 
-  Storage_BaseDriver* aFileDriver = 0L;
+  Handle(Storage_BaseDriver) aFileDriver;
   if (PCDM::FileDriverType (theIStream, aFileDriver) == PCDM_TOFD_XmlFile)
   {
     return ::TryXmlDriverType (theIStream);
index 751b67ea610b34a581c3e3abe0e9fd84a5f77b2f..d81f221f0945534f90197db8f22eda4c50a6b365 100644 (file)
@@ -62,7 +62,9 @@ public:
   
   Standard_EXPORT virtual Standard_Integer ReadDocumentVersion (const TCollection_ExtendedString& aFileName, const Handle(Message_Messenger)& theMsgDriver) const = 0;
   
-  Standard_EXPORT static void Open (Storage_BaseDriver& aDriver, const TCollection_ExtendedString& aFileName, const Storage_OpenMode anOpenMode);
+  Standard_EXPORT static void Open (const Handle(Storage_BaseDriver)& aDriver, 
+                                    const TCollection_ExtendedString& aFileName, 
+                                    const Storage_OpenMode anOpenMode);
   
   //! returns the convenient Reader for a File.
   Standard_EXPORT static Handle(PCDM_ReadWriter) Reader (const TCollection_ExtendedString& aFileName);
index c47b436cf993623e7da36ac1ec2a73c7bde4d0e7..500f485f2cad66a9cbdea9935481ec8537e75504 100644 (file)
@@ -230,7 +230,7 @@ Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const TCollection_Exten
   theReferencesCounter=0;
   static Standard_Integer i ;
 
-  PCDM_BaseDriverPointer theFileDriver;
+  Handle(Storage_BaseDriver) theFileDriver;
   TCollection_AsciiString aFileNameU(aFileName);
   if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
     return theReferencesCounter;
@@ -240,12 +240,12 @@ Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const TCollection_Exten
 
   try {
     OCC_CATCH_SIGNALS
-    PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
+    PCDM_ReadWriter::Open(theFileDriver,aFileName,Storage_VSRead);
     theFileIsOpen=Standard_True;
    
     Handle(Storage_Schema) s = new Storage_Schema;
     Storage_HeaderData hd;
-    hd.Read (*theFileDriver);
+    hd.Read (theFileDriver);
     const TColStd_SequenceOfAsciiString &refUserInfo = hd.UserInfo();
     
     for ( i =1; i<=  refUserInfo.Length() ; i++) {
@@ -264,9 +264,11 @@ Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const TCollection_Exten
   }
   catch (Standard_Failure const&) {}
 
-  if(theFileIsOpen)  theFileDriver->Close();
+  if(theFileIsOpen)
+  {
+    theFileDriver->Close();
+  }
 
-  delete theFileDriver;
   return theReferencesCounter;
 }
   
@@ -338,18 +340,18 @@ void PCDM_ReadWriter_1::ReadUserInfo(const TCollection_ExtendedString& aFileName
                                      const TCollection_AsciiString& Start,
                                      const TCollection_AsciiString& End,
                                      TColStd_SequenceOfExtendedString& theUserInfo,
-                                     const Handle(Message_Messenger)&) {
-
+                                     const Handle(Message_Messenger)&)
+{
   static Standard_Integer i ;
-  PCDM_BaseDriverPointer theFileDriver;
+  Handle(Storage_BaseDriver) theFileDriver;
   TCollection_AsciiString aFileNameU(aFileName);
   if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
     return;
 
-  PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
+  PCDM_ReadWriter::Open(theFileDriver,aFileName,Storage_VSRead);
   Handle(Storage_Schema) s = new Storage_Schema;
   Storage_HeaderData hd;
-  hd.Read (*theFileDriver);
+  hd.Read (theFileDriver);
   const TColStd_SequenceOfAsciiString &refUserInfo = hd.UserInfo();
 
   Standard_Integer debut=0,fin=0;
@@ -366,7 +368,6 @@ void PCDM_ReadWriter_1::ReadUserInfo(const TCollection_ExtendedString& aFileName
     }
   }
   theFileDriver->Close();
-  delete theFileDriver;
 }
 
 //=======================================================================
@@ -379,7 +380,7 @@ Standard_Integer PCDM_ReadWriter_1::ReadDocumentVersion(const TCollection_Extend
   static Standard_Integer theVersion ;
   theVersion=-1;
 
-  PCDM_BaseDriverPointer theFileDriver;
+  Handle(Storage_BaseDriver) theFileDriver;
   TCollection_AsciiString aFileNameU(aFileName);
   if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
     return theVersion;
@@ -389,11 +390,11 @@ Standard_Integer PCDM_ReadWriter_1::ReadDocumentVersion(const TCollection_Extend
 
   try {
     OCC_CATCH_SIGNALS
-    PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
+    PCDM_ReadWriter::Open(theFileDriver,aFileName,Storage_VSRead);
     theFileIsOpen=Standard_True;
     Handle(Storage_Schema) s = new Storage_Schema;
     Storage_HeaderData hd;
-    hd.Read (*theFileDriver);
+    hd.Read (theFileDriver);
     const TColStd_SequenceOfAsciiString &refUserInfo = hd.UserInfo();
 
     static Standard_Integer i ;
@@ -414,7 +415,10 @@ Standard_Integer PCDM_ReadWriter_1::ReadDocumentVersion(const TCollection_Extend
 
   catch (Standard_Failure const&) {}
 
-  if(theFileIsOpen) theFileDriver->Close();
-  delete theFileDriver;
+  if(theFileIsOpen)
+  {
+    theFileDriver->Close();
+  }
+
   return theVersion;
 }
index 5deb83e49ad9439870ba8c15b6894a04def33b7d..c44e0c099008f9c311d004509d9393bea31acd67 100644 (file)
@@ -91,10 +91,10 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
     theData->AddToComments(aComments(i));
   }
 
-  FSD_CmpFile theFile;
+  Handle(FSD_CmpFile) theFile = new FSD_CmpFile;
   PCDM_ReadWriter::Open(theFile,aFileName,Storage_VSWrite);
   theSchema->Write(theFile,theData);
-  theFile.Close();
+  theFile->Close();
 
   if ( theData->ErrorStatus() != Storage_VSOk )
     throw PCDM_DriverError(theData->ErrorStatusExtension().ToCString());
index 3510970fc06e882d85f0d73ba02db0dc4498f1f8..09455a92785282e26c0f42792adce8804777e88a 100644 (file)
@@ -75,11 +75,11 @@ Standard_Transient* Standard_Transient::This() const
 // Increment reference counter
 void Standard_Transient::IncrementRefCounter() const
 {
-  Standard_Atomic_Increment (&count);
+  Standard_Atomic_Increment (&myRefCount_);
 }
 
 // Decrement reference counter
 Standard_Integer Standard_Transient::DecrementRefCounter() const
 {
-  return Standard_Atomic_Decrement (&count);
+  return Standard_Atomic_Decrement(&myRefCount_);
 }
index 576553f0a911fbbe77ad7a39a0a9079d6cf3bed3..dd0f58dad1ab37ad3c7cd6700a6ab7d129f72c5a 100644 (file)
@@ -37,10 +37,10 @@ public:
 public:
 
   //! Empty constructor
-  Standard_Transient() : count(0) {}
+  Standard_Transient() : myRefCount_(0) {}
 
   //! Copy constructor -- does nothing
-  Standard_Transient (const Standard_Transient&) : count(0) {}
+  Standard_Transient (const Standard_Transient&) : myRefCount_(0) {}
 
   //! Assignment operator, needed to avoid copying reference counter
   Standard_Transient& operator= (const Standard_Transient&) { return *this; }
@@ -90,7 +90,7 @@ public:
   //!@name Reference counting, for use by handle<>
 
   //! Get the reference counter of this object
-  Standard_Integer GetRefCount() const { return count; }
+  Standard_Integer GetRefCount() const { return myRefCount_; }
 
   //! Increments the reference counter of this object
   Standard_EXPORT void IncrementRefCounter() const;
@@ -101,8 +101,10 @@ public:
 
 private:
 
-  //! Reference counter
-  mutable volatile Standard_Integer count;
+  //! Reference counter.
+  //! Note use of underscore, aimed to reduce probability 
+  //! of conflict with names of members of derived classes.
+  mutable volatile Standard_Integer myRefCount_;
 };
 
 
index 8dd6398cb89ad0989aef461f5f120bb1e239b4e8..3b2fabea6f0568a1a551975154a5f719c004e610 100644 (file)
@@ -79,20 +79,18 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
   Standard_Integer i;
 
   // Create a driver appropriate for the given file
-  PCDM_BaseDriverPointer aFileDriverPtr;
-  if (PCDM::FileDriverType (TCollection_AsciiString (theFileName), aFileDriverPtr) == PCDM_TOFD_Unknown)
+  Handle(Storage_BaseDriver) aFileDriver;
+  if (PCDM::FileDriverType (TCollection_AsciiString (theFileName), aFileDriver) == PCDM_TOFD_Unknown)
   {
     myReaderStatus = PCDM_RS_UnknownFileDriver;
     return NULL;
   }
 
-  NCollection_Handle<Storage_BaseDriver> aFileDriver (aFileDriverPtr);
-
   // Try to open the file
   try
   {
     OCC_CATCH_SIGNALS
-    PCDM_ReadWriter::Open (*aFileDriver, theFileName, Storage_VSRead);
+    PCDM_ReadWriter::Open (aFileDriver, theFileName, Storage_VSRead);
     myReaderStatus = PCDM_RS_OK;
   } 
   catch (Standard_Failure const& anException)
@@ -105,17 +103,17 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
   }
   
   // Read header section
-  if (!theHeaderData.Read (*aFileDriver))
+  if (!theHeaderData.Read (aFileDriver))
     raiseOnStorageError (theHeaderData.ErrorStatus());
 
   // Read type section
   Storage_TypeData aTypeData;
-  if (!aTypeData.Read (*aFileDriver))
+  if (!aTypeData.Read (aFileDriver))
     raiseOnStorageError (aTypeData.ErrorStatus());
 
   // Read root section
   Storage_RootData aRootData;
-  if (!aRootData.Read (*aFileDriver))
+  if (!aRootData.Read (aFileDriver))
     raiseOnStorageError (aRootData.ErrorStatus());
 
   if (aRootData.NumberOfRoots() < 1)
@@ -169,7 +167,7 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
   }
 
   // Read and parse reference section
-  StdObjMgt_ReadData aReadData (*aFileDriver, theHeaderData.NumberOfObjects());
+  StdObjMgt_ReadData aReadData (aFileDriver, theHeaderData.NumberOfObjects());
 
   raiseOnStorageError (aFileDriver->BeginReadRefSection());
 
index 5d80270ce10bbac0a9f638a946d12fe85d2fc622..4409f1c2129b1fe695705a18855c648d84faa644 100644 (file)
@@ -18,8 +18,8 @@
 
 
 StdObjMgt_ReadData::StdObjMgt_ReadData
-  (Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects)
-    : myDriver (&theDriver)
+  (const Handle(Storage_BaseDriver)& theDriver, const Standard_Integer theNumberOfObjects)
+    : myDriver (theDriver)
     , myPersistentObjects (1, theNumberOfObjects) {}
 
 void StdObjMgt_ReadData::ReadPersistentObject (const Standard_Integer theRef)
index f81d379a02998961eef1f76b4f27ebbca248e21a..d91931de6aa62ee573babbed0f28c7a95ac8d50e 100644 (file)
@@ -46,7 +46,7 @@ public:
   };
 
   Standard_EXPORT StdObjMgt_ReadData
-    (Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects);
+    (const Handle(Storage_BaseDriver)& theDriver, const Standard_Integer theNumberOfObjects);
 
   template <class Instantiator>
   void CreatePersistentObject
@@ -101,7 +101,7 @@ public:
     { return ReadValue (theValue); }
 
 private:
-  Storage_BaseDriver* myDriver;
+  Handle(Storage_BaseDriver) myDriver;
   NCollection_Array1<Handle(StdObjMgt_Persistent)> myPersistentObjects;
 };
 
index 78420b1281b8a92e6c20f2ebc8fbfc3de3ec5d55..04dc374ed22a05a46a28d0280df6878ece5cfc6b 100644 (file)
@@ -17,8 +17,8 @@
 #include <Standard_GUID.hxx>
 
 
-StdObjMgt_WriteData::StdObjMgt_WriteData (Storage_BaseDriver& theDriver)
-    : myDriver (&theDriver)
+StdObjMgt_WriteData::StdObjMgt_WriteData (const Handle(Storage_BaseDriver)& theDriver)
+    : myDriver (theDriver)
 {
 }
 
index 7005877bd640eef40bb651eff5f97455e0de7850..188a6ca1b7097bfcc78a9b2894736df6e222b351 100644 (file)
@@ -44,11 +44,9 @@ public:
     ObjectSentry& operator = (const ObjectSentry&);
   };
 
-  Standard_EXPORT StdObjMgt_WriteData 
-    (Storage_BaseDriver& theDriver);
+  Standard_EXPORT StdObjMgt_WriteData (const Handle(Storage_BaseDriver)& theDriver);
 
-  Standard_EXPORT void WritePersistentObject
-    (const Handle(StdObjMgt_Persistent)& thePersistent);
+  Standard_EXPORT void WritePersistentObject (const Handle(StdObjMgt_Persistent)& thePersistent);
 
   template <class Persistent>
   StdObjMgt_WriteData& operator << (const Handle(Persistent)& thePersistent)
@@ -85,7 +83,7 @@ public:
     { return WriteValue(theValue); }
 
 private:
-  Storage_BaseDriver* myDriver;
+  Handle(Storage_BaseDriver) myDriver;
 };
 
 Standard_EXPORT StdObjMgt_WriteData& operator <<
index fe0bda985007d5ffa8865ac0a38eac84ceee6e0d..568397b41a7ca013b17d2a92048748aa47269ce8 100644 (file)
@@ -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;
   }
index b2800e5f71b80f59a59d87c220237eaa1df18f39..44a9b75c9100d0e2b220feae801b21b32a9344a6 100644 (file)
@@ -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);
 
 };
index 38fb245884a887d954b80b332b96bcc9f04d7d6f..17a979dbb83e071ebd2d543a5ec8a1491293c13c 100644 (file)
@@ -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";
index 70ae1440b0b139d5295edab67510a94e6e33a37f..0d10895a0a7349b852c0f6bf0da3f907aa8430fa 100644 (file)
@@ -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;
index 0747a380520eaa0f9f927397978b37059900c09c..7546cfad48f6009379e070a319ba28ecf2ec0245 100644 (file)
@@ -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";
index 9dc98dc20ca73679c511a056cba03afe35fd81a5..380d5046444c6b4b4f6edf3535182df4d466ea83 100644 (file)
@@ -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;
index 3f2e136c645b89c4799b6faeca8e8c9d6872a2fe..f3ea753df041511e0e549e6b0d20df39f08b8378 100644 (file)
@@ -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";
index f683e618708ef6599f2f9d50e25f41c01dd0f880..11dc25fc5646e50b6cd99cd144a8bc5586d8fc8c 100644 (file)
@@ -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;
index 28345e640ef48afc4828fe62901eb701a5322120..1ebf1036e4df8be7101acf860a6e522ebcae9516 100755 (executable)
@@ -4,7 +4,6 @@ Storage_ArrayOfCallBack.hxx
 Storage_ArrayOfSchema.hxx
 Storage_BaseDriver.cxx
 Storage_BaseDriver.hxx
-Storage_BaseDriver.lxx
 Storage_BucketOfPersistent.hxx
 Storage_CallBack.cxx
 Storage_CallBack.hxx
@@ -36,7 +35,6 @@ Storage_RootData.cxx
 Storage_RootData.hxx
 Storage_Schema.cxx
 Storage_Schema.hxx
-Storage_Schema.lxx
 Storage_SeqOfRoot.hxx
 Storage_SolveMode.hxx
 Storage_StreamExtCharParityError.hxx
index ee0bc8791a23f6805f75580ba5e62b8b5d1e4f26..6772e12c4662abf1a266a486af5a6e548864a672 100644 (file)
@@ -21,6 +21,8 @@
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(Storage_BaseDriver, Standard_Transient)
+
 Storage_BaseDriver::Storage_BaseDriver() : myOpenMode(Storage_VSNone)
 {
 }
index a6f345b144a2cfc15e967536e5f2f45b20db26bf..fb66ba3efc46ad51b601c955ac8ee88a96bf67be 100644 (file)
 #ifndef _Storage_BaseDriver_HeaderFile
 #define _Storage_BaseDriver_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
+#include <Standard_Type.hxx>
 
 #include <Storage_OpenMode.hxx>
-#include <TCollection_AsciiString.hxx>
 #include <Storage_Error.hxx>
-#include <Standard_Boolean.hxx>
 #include <Storage_Data.hxx>
 #include <Storage_Position.hxx>
-#include <Standard_Integer.hxx>
+#include <TCollection_AsciiString.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_SequenceOfExtendedString.hxx>
-#include <Standard_Character.hxx>
-#include <Standard_ExtCharacter.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_ShortReal.hxx>
+
 class Storage_StreamTypeMismatchError;
 class Storage_StreamFormatError;
 class Storage_StreamWriteError;
@@ -41,27 +34,32 @@ class Storage_StreamExtCharParityError;
 class TCollection_AsciiString;
 class TCollection_ExtendedString;
 
+DEFINE_STANDARD_HANDLE(Storage_BaseDriver,Standard_Transient)
 
 //! Root class for drivers. A driver assigns a physical container
 //! to data to be stored or retrieved, for instance a file.
 //! The FSD package provides two derived concrete classes :
 //! -   FSD_File is a general driver which defines a
 //! file as the container of data.
-class Storage_BaseDriver 
+class Storage_BaseDriver : public Standard_Transient
 {
 public:
+  DEFINE_STANDARD_RTTIEXT(Storage_BaseDriver,Standard_Transient)
 
-  DEFINE_STANDARD_ALLOC
+public:
 
   Standard_EXPORT virtual ~Storage_BaseDriver();
   
-  Standard_EXPORT virtual Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode) = 0;
+  TCollection_AsciiString Name() const { return myName; }
   
-    TCollection_AsciiString Name() const;
+  Storage_OpenMode OpenMode() const { return myOpenMode; }
+
+  Standard_EXPORT static TCollection_AsciiString ReadMagicNumber(Standard_IStream& theIStream);
   
-    Storage_OpenMode OpenMode() const;
+public:
+  //!@name Virtual methods, to be provided by descendants
 
-    Standard_EXPORT static TCollection_AsciiString ReadMagicNumber (Standard_IStream& theIStream);
+  Standard_EXPORT virtual Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode) = 0;
   
   //! returns True if we are at end of the stream
   Standard_EXPORT virtual Standard_Boolean IsEnd() = 0;
@@ -173,114 +171,102 @@ public:
   
   Standard_EXPORT virtual void SkipObject() = 0;
   
+  Standard_EXPORT virtual Storage_Error Close() = 0;
+
+public:
+  //!@name Ouput methods
+
   Standard_EXPORT virtual Storage_BaseDriver& PutReference (const Standard_Integer aValue) = 0;
   
   Standard_EXPORT virtual Storage_BaseDriver& PutCharacter (const Standard_Character aValue) = 0;
-Storage_BaseDriver& operator << (const Standard_Character aValue)
-{
-  return PutCharacter(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutExtCharacter (const Standard_ExtCharacter aValue) = 0;
-Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
-{
-  return PutExtCharacter(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutInteger (const Standard_Integer aValue) = 0;
-Storage_BaseDriver& operator << (const Standard_Integer aValue)
-{
-  return PutInteger(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutBoolean (const Standard_Boolean aValue) = 0;
-Storage_BaseDriver& operator << (const Standard_Boolean aValue)
-{
-  return PutBoolean(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutReal (const Standard_Real aValue) = 0;
-Storage_BaseDriver& operator << (const Standard_Real aValue)
-{
-  return PutReal(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& PutShortReal (const Standard_ShortReal aValue) = 0;
-Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
-{
-  return PutShortReal(aValue);
-}
-  
+  Storage_BaseDriver& operator << (const Standard_Character aValue)
+  {
+    return PutCharacter(aValue);
+  }
+
+  Standard_EXPORT virtual Storage_BaseDriver& PutExtCharacter(const Standard_ExtCharacter aValue) = 0;
+  Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
+  {
+    return PutExtCharacter(aValue);
+  }
+
+  Standard_EXPORT virtual Storage_BaseDriver& PutInteger(const Standard_Integer aValue) = 0;
+  Storage_BaseDriver& operator << (const Standard_Integer aValue)
+  {
+    return PutInteger(aValue);
+  }
+
+  Standard_EXPORT virtual Storage_BaseDriver& PutBoolean(const Standard_Boolean aValue) = 0;
+  Storage_BaseDriver& operator << (const Standard_Boolean aValue)
+  {
+    return PutBoolean(aValue);
+  }
+
+  Standard_EXPORT virtual Storage_BaseDriver& PutReal(const Standard_Real aValue) = 0;
+  Storage_BaseDriver& operator << (const Standard_Real aValue)
+  {
+    return PutReal(aValue);
+  }
+
+  Standard_EXPORT virtual Storage_BaseDriver& PutShortReal(const Standard_ShortReal aValue) = 0;
+  Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
+  {
+    return PutShortReal(aValue);
+  }
+
+public:
+  //!@name Input methods
+
   Standard_EXPORT virtual Storage_BaseDriver& GetReference (Standard_Integer& aValue) = 0;
   
   Standard_EXPORT virtual Storage_BaseDriver& GetCharacter (Standard_Character& aValue) = 0;
-Storage_BaseDriver& operator >> (Standard_Character& aValue)
-{
-  return GetCharacter(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetExtCharacter (Standard_ExtCharacter& aValue) = 0;
-Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
-{
-  return GetExtCharacter(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetInteger (Standard_Integer& aValue) = 0;
-Storage_BaseDriver& operator >> (Standard_Integer& aValue)
-{
-  return GetInteger(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetBoolean (Standard_Boolean& aValue) = 0;
-Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
-{
-  return GetBoolean(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetReal (Standard_Real& aValue) = 0;
-Storage_BaseDriver& operator >> (Standard_Real& aValue)
-{
-  return GetReal(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_BaseDriver& GetShortReal (Standard_ShortReal& aValue) = 0;
-Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
-{
-  return GetShortReal(aValue);
-}
-  
-  Standard_EXPORT virtual Storage_Error Close() = 0;
+  Storage_BaseDriver& operator >> (Standard_Character& aValue)
+  {
+    return GetCharacter(aValue);
+  }
 
+  Standard_EXPORT virtual Storage_BaseDriver& GetExtCharacter(Standard_ExtCharacter& aValue) = 0;
+  Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
+  {
+    return GetExtCharacter(aValue);
+  }
 
+  Standard_EXPORT virtual Storage_BaseDriver& GetInteger(Standard_Integer& aValue) = 0;
+  Storage_BaseDriver& operator >> (Standard_Integer& aValue)
+  {
+    return GetInteger(aValue);
+  }
 
+  Standard_EXPORT virtual Storage_BaseDriver& GetBoolean(Standard_Boolean& aValue) = 0;
+  Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
+  {
+    return GetBoolean(aValue);
+  }
 
-protected:
+  Standard_EXPORT virtual Storage_BaseDriver& GetReal(Standard_Real& aValue) = 0;
+  Storage_BaseDriver& operator >> (Standard_Real& aValue)
+  {
+    return GetReal(aValue);
+  }
 
+  Standard_EXPORT virtual Storage_BaseDriver& GetShortReal(Standard_ShortReal& aValue) = 0;
+  Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
+  {
+    return GetShortReal(aValue);
+  }
+
+protected:
   
   Standard_EXPORT Storage_BaseDriver();
   
-    void SetName (const TCollection_AsciiString& aName);
-  
-    void SetOpenMode (const Storage_OpenMode aMode);
-
-
+  void SetName(const TCollection_AsciiString& aName) { myName = aName; }
 
+  void SetOpenMode(const Storage_OpenMode aMode) { myOpenMode = aMode; }
 
 private:
 
-
-
   Storage_OpenMode myOpenMode;
   TCollection_AsciiString myName;
-
-
 };
 
-
-#include <Storage_BaseDriver.lxx>
-
-
-
-
-
 #endif // _Storage_BaseDriver_HeaderFile
diff --git a/src/Storage/Storage_BaseDriver.lxx b/src/Storage/Storage_BaseDriver.lxx
deleted file mode 100644 (file)
index 4bdbc4f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_AsciiString Storage_BaseDriver::Name() const
-{
-  return myName;
-}
-
-inline Storage_OpenMode Storage_BaseDriver::OpenMode() const
-{
-  return myOpenMode;
-}
-
-inline void Storage_BaseDriver::SetName(const TCollection_AsciiString& aName)
-{
-  myName = aName;
-}
-
-inline void Storage_BaseDriver::SetOpenMode(const Storage_OpenMode aMode)
-{
-  myOpenMode = aMode;
-}
-
index ac70b469451d9ba761176e22b56234f692d34c56..92bbe1c4c4517d48424acd9711f9b7f42e9faa51 100644 (file)
@@ -29,42 +29,24 @@ class Storage_BaseDriver;
 class Storage_CallBack;
 DEFINE_STANDARD_HANDLE(Storage_CallBack, Standard_Transient)
 
-
 class Storage_CallBack : public Standard_Transient
 {
-
 public:
-
   
   Standard_EXPORT virtual Handle(Standard_Persistent) New() const = 0;
   
   Standard_EXPORT virtual void Add (const Handle(Standard_Persistent)& aPers, const Handle(Storage_Schema)& aSchema) const = 0;
   
-  Standard_EXPORT virtual void Write (const Handle(Standard_Persistent)& aPers, Storage_BaseDriver& aDriver, const Handle(Storage_Schema)& aSchema) const = 0;
+  Standard_EXPORT virtual void Write (const Handle(Standard_Persistent)& aPers, 
+                                      const Handle(Storage_BaseDriver)& aDriver, 
+                                      const Handle(Storage_Schema)& aSchema) const = 0;
   
-  Standard_EXPORT virtual void Read (const Handle(Standard_Persistent)& aPers, Storage_BaseDriver& aDriver, const Handle(Storage_Schema)& aSchema) const = 0;
-
-
-
+  Standard_EXPORT virtual void Read (const Handle(Standard_Persistent)& aPers, 
+                                     const Handle(Storage_BaseDriver)& aDriver,
+                                     const Handle(Storage_Schema)& aSchema) const = 0;
 
   DEFINE_STANDARD_RTTIEXT(Storage_CallBack,Standard_Transient)
 
-protected:
-
-
-
-
-private:
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _Storage_CallBack_HeaderFile
index 931b47a1d1619cc4cb8244ccae6a98fd47e7feb9..74e86463db47782304002f3044059c3664195ab0 100644 (file)
@@ -36,11 +36,15 @@ void Storage_DefaultCallBack::Add(const Handle(Standard_Persistent)&, const Hand
 {
 }
 
-void Storage_DefaultCallBack::Write(const Handle(Standard_Persistent)&,Storage_BaseDriver&,const Handle(Storage_Schema)&) const
+void Storage_DefaultCallBack::Write(const Handle(Standard_Persistent)&,
+                                    const Handle(Storage_BaseDriver)&,
+                                    const Handle(Storage_Schema)&) const
 {
 }
 
-void Storage_DefaultCallBack::Read(const Handle(Standard_Persistent)&,Storage_BaseDriver& f,const Handle(Storage_Schema)&) const
+void Storage_DefaultCallBack::Read(const Handle(Standard_Persistent)&,
+                                   const Handle(Storage_BaseDriver)& theDriver,
+                                   const Handle(Storage_Schema)&) const
 {
-  f.SkipObject();
+  theDriver->SkipObject();
 }
index 4f27d2929ab560d60ff0c250b78177a0b10db501..441d19ea99493bd378117c51495e5f1e76882328 100644 (file)
 class Standard_Persistent;
 class Storage_Schema;
 class Storage_BaseDriver;
-
-
 class Storage_DefaultCallBack;
-DEFINE_STANDARD_HANDLE(Storage_DefaultCallBack, Storage_CallBack)
 
+DEFINE_STANDARD_HANDLE(Storage_DefaultCallBack, Storage_CallBack)
 
 class Storage_DefaultCallBack : public Storage_CallBack
 {
-
 public:
-
-  
   Standard_EXPORT Storage_DefaultCallBack();
   
   Standard_EXPORT Handle(Standard_Persistent) New() const Standard_OVERRIDE;
   
-  Standard_EXPORT void Add (const Handle(Standard_Persistent)& aPers, const Handle(Storage_Schema)& aSchema) const Standard_OVERRIDE;
+  Standard_EXPORT void Add (const Handle(Standard_Persistent)& thePers, 
+                            const Handle(Storage_Schema)& theSchema) const Standard_OVERRIDE;
   
-  Standard_EXPORT void Write (const Handle(Standard_Persistent)& aPers, Storage_BaseDriver& aDriver, const Handle(Storage_Schema)& aSchema) const Standard_OVERRIDE;
+  Standard_EXPORT void Write (const Handle(Standard_Persistent)& thePers, 
+                              const Handle(Storage_BaseDriver)& theDriver, 
+                              const Handle(Storage_Schema)& theSchema) const Standard_OVERRIDE;
   
-  Standard_EXPORT void Read (const Handle(Standard_Persistent)& aPers, Storage_BaseDriver& aDriver, const Handle(Storage_Schema)& aSchema) const Standard_OVERRIDE;
-
-
-
+  Standard_EXPORT void Read (const Handle(Standard_Persistent)& thePers, 
+                             const Handle(Storage_BaseDriver)& theDriver, 
+                             const Handle(Storage_Schema)& theSchema) const Standard_OVERRIDE;
 
   DEFINE_STANDARD_RTTIEXT(Storage_DefaultCallBack,Storage_CallBack)
-
-protected:
-
-
-
-
-private:
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _Storage_DefaultCallBack_HeaderFile
index 1f8f84c14223a29d652a27dc0046b8cb450186e6..ff1e7fd07050eb06254739525a09d3394a317f28 100644 (file)
@@ -27,11 +27,11 @@ Storage_HeaderData::Storage_HeaderData() : myNBObj(0), myErrorStatus(Storage_VSO
 {
 }
 
-Standard_Boolean Storage_HeaderData::Read (Storage_BaseDriver& theDriver)
+Standard_Boolean Storage_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";
@@ -39,7 +39,7 @@ Standard_Boolean Storage_HeaderData::Read (Storage_BaseDriver& theDriver)
   }
 
   // Read info section
-  myErrorStatus = theDriver.BeginReadInfoSection();
+  myErrorStatus = theDriver->BeginReadInfoSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "BeginReadInfoSection";
@@ -50,15 +50,8 @@ Standard_Boolean Storage_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&)
     {
@@ -74,7 +67,7 @@ Standard_Boolean Storage_HeaderData::Read (Storage_BaseDriver& theDriver)
     }
   }
 
-  myErrorStatus = theDriver.EndReadInfoSection();
+  myErrorStatus = theDriver->EndReadInfoSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "EndReadInfoSection";
@@ -82,7 +75,7 @@ Standard_Boolean Storage_HeaderData::Read (Storage_BaseDriver& theDriver)
   }
 
   // Read comment section
-  myErrorStatus = theDriver.BeginReadCommentSection();
+  myErrorStatus = theDriver->BeginReadCommentSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "BeginReadCommentSection";
@@ -93,7 +86,7 @@ Standard_Boolean Storage_HeaderData::Read (Storage_BaseDriver& theDriver)
     try
     {
       OCC_CATCH_SIGNALS
-      theDriver.ReadComment (myComments);
+      theDriver->ReadComment (myComments);
     }
     catch (Storage_StreamTypeMismatchError const&)
     {
@@ -109,7 +102,7 @@ Standard_Boolean Storage_HeaderData::Read (Storage_BaseDriver& theDriver)
     }
   }
 
-  myErrorStatus = theDriver.EndReadCommentSection();
+  myErrorStatus = theDriver->EndReadCommentSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "EndReadCommentSection";
index db9193f532674fe98fd47af73b048f5e964e4745..7f726976d6a2dccf817706a16bb3469ed8b97284 100644 (file)
@@ -45,7 +45,7 @@ public:
   
   Standard_EXPORT Storage_HeaderData();
 
-  Standard_EXPORT Standard_Boolean Read (Storage_BaseDriver& theDriver);
+  Standard_EXPORT Standard_Boolean Read (const Handle(Storage_BaseDriver)& theDriver);
   
   //! return the creation date
   Standard_EXPORT TCollection_AsciiString CreationDate() const;
index 8d546f58b39d9c82711d24dd2c89defad9481092..e8cf7fbe45c708f78ca6d5675fa9f2bd61391cd7 100644 (file)
@@ -29,11 +29,11 @@ Storage_RootData::Storage_RootData() : myErrorStatus(Storage_VSOk)
 {
 }
 
-Standard_Boolean Storage_RootData::Read (Storage_BaseDriver& theDriver)
+Standard_Boolean Storage_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";
@@ -41,7 +41,7 @@ Standard_Boolean Storage_RootData::Read (Storage_BaseDriver& theDriver)
   }
 
   // Read root section
-  myErrorStatus = theDriver.BeginReadRootSection();
+  myErrorStatus = theDriver->BeginReadRootSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "BeginReadRootSection";
@@ -51,13 +51,13 @@ Standard_Boolean Storage_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&)
     {
@@ -70,7 +70,7 @@ Standard_Boolean Storage_RootData::Read (Storage_BaseDriver& theDriver)
     myObjects.Bind (aRootName, aRoot);
   }
 
-  myErrorStatus = theDriver.EndReadRootSection();
+  myErrorStatus = theDriver->EndReadRootSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "EndReadRootSection";
index 0bc726ae017792865d4a5ad5b45ff4da19a5c6a5..55fdf02513a8193a643bf409ecfb0cf4c34304f9 100644 (file)
@@ -47,7 +47,7 @@ public:
   
   Standard_EXPORT Storage_RootData();
 
-  Standard_EXPORT Standard_Boolean Read (Storage_BaseDriver& theDriver);
+  Standard_EXPORT Standard_Boolean Read (const Handle(Storage_BaseDriver)& theDriver);
   
   //! returns the number of roots.
   Standard_EXPORT Standard_Integer NumberOfRoots() const;
index 7968ffdbfdb17b627a4320aff041773445b1c503..c1740ceb4ef9610c0f72338ecf6049731314bf63 100644 (file)
@@ -340,9 +340,8 @@ TCollection_AsciiString Storage_Schema::Name() const
 //           VSReadWrite
 //=======================================================================
 
-void Storage_Schema::Write
-                         (Storage_BaseDriver& f,
-                          const Handle(Storage_Data)& aData) const
+void Storage_Schema::Write (const Handle(Storage_BaseDriver)& theDriver,
+                            const Handle(Storage_Data)& aData) const
 {
  if (aData.IsNull()) return;
 
@@ -384,42 +383,42 @@ void Storage_Schema::Write
  aData->HeaderData()->SetSchemaName(myName);
  aData->HeaderData()->SetSchemaVersion(myVersion);
 
-  if ((f.OpenMode() == Storage_VSWrite) || (f.OpenMode() == Storage_VSReadWrite)) {
+  if ((theDriver->OpenMode() == Storage_VSWrite) || (theDriver->OpenMode() == Storage_VSReadWrite)) {
     try {
       OCC_CATCH_SIGNALS
       errorContext = "BeginWriteInfoSection";
-      f.BeginWriteInfoSection();
+      theDriver->BeginWriteInfoSection();
       errorContext = "WriteInfo";
-      f.WriteInfo(aData->NumberOfObjects(),
-                  aData->StorageVersion(),
-                  aData->CreationDate(),
-                  aData->SchemaName(),
-                  aData->SchemaVersion(),
-                  aData->ApplicationName(),
-                  aData->ApplicationVersion(),
-                  aData->DataType(),
-                  aData->UserInfo());
+      theDriver->WriteInfo(aData->NumberOfObjects(),
+                           aData->StorageVersion(),
+                           aData->CreationDate(),
+                           aData->SchemaName(),
+                           aData->SchemaVersion(),
+                           aData->ApplicationName(),
+                           aData->ApplicationVersion(),
+                           aData->DataType(),
+                           aData->UserInfo());
       errorContext = "EndWriteInfoSection";
-      f.EndWriteInfoSection();
+      theDriver->EndWriteInfoSection();
 
       errorContext = "BeginWriteCommentSection";
-      f.BeginWriteCommentSection();
+      theDriver->BeginWriteCommentSection();
       errorContext = "WriteComment";
-      f.WriteComment(aData->Comments());
+      theDriver->WriteComment(aData->Comments());
       errorContext = "EndWriteCommentSection";
-      f.EndWriteCommentSection();
+      theDriver->EndWriteCommentSection();
 
       Handle(TColStd_HSequenceOfAsciiString) tlist;
 
       tlist = aData->Types();
 
       errorContext = "BeginWriteTypeSection";
-      f.BeginWriteTypeSection();
+      theDriver->BeginWriteTypeSection();
       len = aData->NumberOfTypes();
 
       Handle(Storage_HArrayOfCallBack) WFunc = new Storage_HArrayOfCallBack(1,len);
 
-      f.SetTypeSectionSize(len);
+      theDriver->SetTypeSectionSize(len);
 
       Storage_DataMapIteratorOfMapOfCallBack cbit(iData->myTypeBinding);
       Handle(Storage_TypedCallBack) atcallBack;
@@ -431,42 +430,42 @@ void Storage_Schema::Write
 
       errorContext = "WriteTypeInformations";
       for (i = 1; i <= len; i++) {
-        f.WriteTypeInformations(i,tlist->Value(i).ToCString());
+        theDriver->WriteTypeInformations(i,tlist->Value(i).ToCString());
       }
 
       errorContext = "EndWriteTypeSection";
-      f.EndWriteTypeSection();
+      theDriver->EndWriteTypeSection();
 
       errorContext = "BeginWriteRootSection";
-      f.BeginWriteRootSection();
-      f.SetRootSectionSize(plist->Length());
+      theDriver->BeginWriteRootSection();
+      theDriver->SetRootSectionSize(plist->Length());
 
       errorContext = "WriteRoot";
       for (i = 1; i <= plist->Length(); i++) {
-        f.WriteRoot(plist->Value(i)->Name(),i,"PDocStd_Document");
+        theDriver->WriteRoot(plist->Value(i)->Name(),i,"PDocStd_Document");
       }
 
       errorContext = "EndWriteRootSection";
-      f.EndWriteRootSection();
+      theDriver->EndWriteRootSection();
 
       errorContext = "BeginWriteRefSection";
-      f.BeginWriteRefSection();
-      f.SetRefSectionSize(iData->myObjId - 1);
+      theDriver->BeginWriteRefSection();
+      theDriver->SetRefSectionSize(iData->myObjId - 1);
       errorContext = "WriteReferenceType";
 
       Storage_BucketIterator bit(&iData->myPtoA);
 
       while(bit.More()) {
         p = bit.Value();
-        if (!p.IsNull()) f.WriteReferenceType(p->_refnum,p->_typenum);
+        if (!p.IsNull()) theDriver->WriteReferenceType(p->_refnum,p->_typenum);
         bit.Next();
       }
 
       errorContext = "EndWriteRefSection";
-      f.EndWriteRefSection();
+      theDriver->EndWriteRefSection();
 
       errorContext = "BeginWriteDataSection";
-      f.BeginWriteDataSection();
+      theDriver->BeginWriteDataSection();
 
       Handle(Storage_Schema) me = this;
 
@@ -477,14 +476,14 @@ void Storage_Schema::Write
       while(bit.More()) {
         p = bit.Value();
         if (!p.IsNull()) {
-          WFunc->Value(p->_typenum)->Write(p,f,me);
+          WFunc->Value(p->_typenum)->Write(p, theDriver, me);
           p->_typenum = 0;
         }
         bit.Next();
       }
 
       errorContext = "EndWriteDataSection";
-      f.EndWriteDataSection();
+      theDriver->EndWriteDataSection();
     }
     catch(Storage_StreamWriteError const&) {
       aData->SetErrorStatus(Storage_VSWriteError);
index cbd638e2678b9374f3bf34707134456bddc63595..b557452aebafa4015454d93a3defc68df5d4c33d 100644 (file)
 #ifndef _Storage_Schema_HeaderFile
 #define _Storage_Schema_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
+#include <Storage_BaseDriver.hxx>
+#include <Storage_HArrayOfSchema.hxx>
+#include <Storage_InternalData.hxx>
 #include <Storage_MapOfCallBack.hxx>
-#include <Standard_Boolean.hxx>
+#include <Storage_SolveMode.hxx>
 #include <TCollection_AsciiString.hxx>
-#include <Storage_HArrayOfSchema.hxx>
-#include <Standard_Transient.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_HSequenceOfAsciiString.hxx>
-#include <Storage_SolveMode.hxx>
-#include <Standard_CString.hxx>
+
 class Storage_CallBack;
 class Storage_StreamFormatError;
 class TCollection_AsciiString;
@@ -105,7 +102,7 @@ public:
   //! schema with which this algorithm is working.
   //! Note: aData may aggregate several root objects
   //! to be stored together.
-  Standard_EXPORT void Write (Storage_BaseDriver& s, const Handle(Storage_Data)& aData) const;
+  Standard_EXPORT void Write (const Handle(Storage_BaseDriver)& s, const Handle(Storage_Data)& aData) const;
   
   //! return a current date string
   Standard_EXPORT static TCollection_AsciiString ICreationDate();
@@ -160,22 +157,28 @@ public:
   //! UseDefaultCallBack() is set.
   Standard_EXPORT Handle(Storage_CallBack) DefaultCallBack() const;
   
-    void WritePersistentObjectHeader (const Handle(Standard_Persistent)& sp, Storage_BaseDriver& s);
-  
-    void WritePersistentReference (const Handle(Standard_Persistent)& sp, Storage_BaseDriver& s);
+  void WritePersistentObjectHeader(const Handle(Standard_Persistent)& sp, const Handle(Storage_BaseDriver)& theDriver)
+  {
+    theDriver->WritePersistentObjectHeader(sp->_refnum, sp->_typenum);
+  }
+
+  void WritePersistentReference(const Handle(Standard_Persistent)& sp, const Handle(Storage_BaseDriver)& theDriver)
+  {
+    theDriver->PutReference(sp.IsNull() ? 0 : sp->_refnum);
+  }
   
   Standard_EXPORT Standard_Boolean AddPersistent (const Handle(Standard_Persistent)& sp, const Standard_CString tName) const;
   
   Standard_EXPORT Standard_Boolean PersistentToAdd (const Handle(Standard_Persistent)& sp) const;
 
-
-
-
   DEFINE_STANDARD_RTTIEXT(Storage_Schema,Standard_Transient)
 
 protected:
   
-    Standard_Boolean HasTypeBinding (const TCollection_AsciiString& aTypeName) const;
+  Standard_Boolean HasTypeBinding(const TCollection_AsciiString& aTypeName) const
+  {
+    return Storage_Schema::ICurrentData()->InternalData()->myTypeBinding.IsBound(aTypeName);
+  }
   
   Standard_EXPORT void BindType (const TCollection_AsciiString& aTypeName, const Handle(Storage_CallBack)& aCallBack) const;
   
@@ -198,11 +201,4 @@ private:
   TCollection_AsciiString myVersion;
 };
 
-
-#include <Storage_Schema.lxx>
-
-
-
-
-
 #endif // _Storage_Schema_HeaderFile
diff --git a/src/Storage/Storage_Schema.lxx b/src/Storage/Storage_Schema.lxx
deleted file mode 100644 (file)
index a8ee2da..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Storage_Data.hxx>
-#include <Storage_InternalData.hxx>
-#include <Storage_BaseDriver.hxx>
-
-
-inline void Storage_Schema::WritePersistentObjectHeader(const Handle(Standard_Persistent)& sp,Storage_BaseDriver& f) 
-{
-  f.WritePersistentObjectHeader(sp->_refnum,sp->_typenum);
-}
-
-inline Standard_Boolean Storage_Schema::HasTypeBinding(const TCollection_AsciiString& aTypeName) const
-{
-  return Storage_Schema::ICurrentData()->InternalData()->myTypeBinding.IsBound(aTypeName);
-}
-
-inline void Storage_Schema::WritePersistentReference(const Handle(Standard_Persistent)& sp,Storage_BaseDriver& f) 
-{
-  if (!sp.IsNull()) {
-    f.PutReference(sp->_refnum);
-  }
-  else {
-    f.PutReference(0);
-  }
-}
-
index 18d1118eab3f681c14972d15325a35e9977f37eb..5335777c37c8a339de636f84ed9184acf1404f40 100644 (file)
@@ -26,11 +26,11 @@ Storage_TypeData::Storage_TypeData() : myErrorStatus(Storage_VSOk)
 {
 }
 
-Standard_Boolean Storage_TypeData::Read (Storage_BaseDriver& theDriver)
+Standard_Boolean Storage_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";
@@ -38,7 +38,7 @@ Standard_Boolean Storage_TypeData::Read (Storage_BaseDriver& theDriver)
   }
 
   // Read type section
-  myErrorStatus = theDriver.BeginReadTypeSection();
+  myErrorStatus = theDriver->BeginReadTypeSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "BeginReadTypeSection";
@@ -48,13 +48,13 @@ Standard_Boolean Storage_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 (const Storage_StreamTypeMismatchError&)
     {
@@ -66,7 +66,7 @@ Standard_Boolean Storage_TypeData::Read (Storage_BaseDriver& theDriver)
     myPt.Add (aTypeName, aTypeNum);
   }
 
-  myErrorStatus = theDriver.EndReadTypeSection();
+  myErrorStatus = theDriver->EndReadTypeSection();
   if (myErrorStatus != Storage_VSOk)
   {
     myErrorStatusExt = "EndReadTypeSection";
index c8a4ff44800b5c709f9091f5f2bb182c44469753..61b47811432e7de491eba592fd65074d8425b2ed 100644 (file)
@@ -45,7 +45,7 @@ public:
   
   Standard_EXPORT Storage_TypeData();
 
-  Standard_EXPORT Standard_Boolean Read (Storage_BaseDriver& theDriver);
+  Standard_EXPORT Standard_Boolean Read (const Handle(Storage_BaseDriver)& theDriver);
   
   Standard_EXPORT Standard_Integer NumberOfTypes() const;
 
index 6c6e120ffa6b8e1f24df8e49effd8cf6b509095b..6b06abc25c23ccfe7286be6f435c3a3119becc19 100644 (file)
@@ -50,11 +50,11 @@ TCollection_ExtendedString UTL::Extension(const TCollection_ExtendedString& aFil
   return TCollection_ExtendedString(theExtension);
 }
 
-Storage_Error UTL::OpenFile(Storage_BaseDriver& aDriver, 
+Storage_Error UTL::OpenFile(const Handle(Storage_BaseDriver)& aDriver, 
                             const TCollection_ExtendedString& aFileName, 
                             const Storage_OpenMode aMode) 
 {
-  return aDriver.Open(TCollection_AsciiString(aFileName),aMode);
+  return aDriver->Open(TCollection_AsciiString(aFileName),aMode);
 }
 
 void UTL::AddToUserInfo(const Handle(Storage_Data)& aData, 
index 1526b5f1fc24b3bae6f2014ad21d556dde841aa0..b141342216961bb8004bb4707e7c88eac1509325 100644 (file)
@@ -46,7 +46,9 @@ public:
   
   Standard_EXPORT static TCollection_ExtendedString xgetenv (const Standard_CString aCString);
   
-  Standard_EXPORT static Storage_Error OpenFile (Storage_BaseDriver& aFile, const TCollection_ExtendedString& aName, const Storage_OpenMode aMode);
+  Standard_EXPORT static Storage_Error OpenFile (const Handle(Storage_BaseDriver)& aFile, 
+                                                 const TCollection_ExtendedString& aName, 
+                                                 const Storage_OpenMode aMode);
   
   Standard_EXPORT static void AddToUserInfo (const Handle(Storage_Data)& aData, const TCollection_ExtendedString& anInfo);
   
diff --git a/tests/bugs/caf/bug31546 b/tests/bugs/caf/bug31546
new file mode 100644 (file)
index 0000000..ac794d6
--- /dev/null
@@ -0,0 +1,19 @@
+puts "==========="
+puts "0031546: Application Framework - Memory leak (100 bytes) on Load / Close OCAF document"
+puts "==========="
+
+puts "Preparing empty document"
+set docname ${imagedir}/${casename}.cbf
+NewDocument D BinOcaf
+SaveAs D $docname
+Close D
+
+puts "Executing Load / Close in cycle to see if allocated heap memory grows"
+set listmem {}
+for {set i 1} {$i < 10} {incr i} {
+  Open $docname D
+  Close D
+
+  lappend listmem [meminfo h]
+  checktrend $listmem 0 0 "Memory leak"
+}
index 88b5a800b5575cdbc1b0c0ee7ecc85bba56c4738..44b4018e5d7151a01db10c63b2790eb06e94b723 100644 (file)
@@ -12,5 +12,5 @@ checknbshapes a -face 14 -solid 0 -edge 39 -vertex 26
 
 puts ""
 puts "# Check that reading fails with expected message on truncated file"
-puts "REQUIRED 29355 ALL: Error : 6"
+puts "REQUIRED 29355 ALL: Storage error: the section is not found"
 catch {fsdread [locate_data_file bug29355_truncated.fsd] a}