Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:17

0001 // Created on: 1996-11-25
0002 // Created by: Christophe LEYNADIER
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Storage_BaseDriver_HeaderFile
0018 #define _Storage_BaseDriver_HeaderFile
0019 
0020 #include <Storage_OpenMode.hxx>
0021 #include <Storage_Data.hxx>
0022 #include <Storage_Position.hxx>
0023 #include <TCollection_AsciiString.hxx>
0024 #include <TColStd_SequenceOfAsciiString.hxx>
0025 #include <TColStd_SequenceOfExtendedString.hxx>
0026 
0027 class TCollection_ExtendedString;
0028 
0029 DEFINE_STANDARD_HANDLE(Storage_BaseDriver,Standard_Transient)
0030 
0031 //! Root class for drivers. A driver assigns a physical container
0032 //! to data to be stored or retrieved, for instance a file.
0033 //! The FSD package provides two derived concrete classes :
0034 //! -   FSD_File is a general driver which defines a
0035 //! file as the container of data.
0036 class Storage_BaseDriver : public Standard_Transient
0037 {
0038 public:
0039   DEFINE_STANDARD_RTTIEXT(Storage_BaseDriver,Standard_Transient)
0040 
0041 public:
0042 
0043   Standard_EXPORT virtual ~Storage_BaseDriver();
0044   
0045   TCollection_AsciiString Name() const { return myName; }
0046   
0047   Storage_OpenMode OpenMode() const { return myOpenMode; }
0048 
0049   Standard_EXPORT static TCollection_AsciiString ReadMagicNumber(Standard_IStream& theIStream);
0050   
0051 public:
0052   //!@name Virtual methods, to be provided by descendants
0053 
0054   Standard_EXPORT virtual Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode) = 0;
0055   
0056   //! returns True if we are at end of the stream
0057   Standard_EXPORT virtual Standard_Boolean IsEnd() = 0;
0058   
0059   //! return position in the file. Return -1 upon error.
0060   Standard_EXPORT virtual Storage_Position Tell() = 0;
0061   
0062   Standard_EXPORT virtual Storage_Error BeginWriteInfoSection() = 0;
0063   
0064   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) = 0;
0065   
0066   Standard_EXPORT virtual Storage_Error EndWriteInfoSection() = 0;
0067   
0068   Standard_EXPORT virtual Storage_Error BeginReadInfoSection() = 0;
0069   
0070   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) = 0;
0071 
0072   Standard_EXPORT virtual void ReadCompleteInfo (Standard_IStream& theIStream, Handle(Storage_Data)& theData) = 0;
0073   
0074   Standard_EXPORT virtual Storage_Error EndReadInfoSection() = 0;
0075   
0076   Standard_EXPORT virtual Storage_Error BeginWriteCommentSection() = 0;
0077   
0078   Standard_EXPORT virtual void WriteComment (const TColStd_SequenceOfExtendedString& userComments) = 0;
0079   
0080   Standard_EXPORT virtual Storage_Error EndWriteCommentSection() = 0;
0081   
0082   Standard_EXPORT virtual Storage_Error BeginReadCommentSection() = 0;
0083   
0084   Standard_EXPORT virtual void ReadComment (TColStd_SequenceOfExtendedString& userComments) = 0;
0085   
0086   Standard_EXPORT virtual Storage_Error EndReadCommentSection() = 0;
0087   
0088   Standard_EXPORT virtual Storage_Error BeginWriteTypeSection() = 0;
0089   
0090   Standard_EXPORT virtual void SetTypeSectionSize (const Standard_Integer aSize) = 0;
0091   
0092   Standard_EXPORT virtual void WriteTypeInformations (const Standard_Integer typeNum, const TCollection_AsciiString& typeName) = 0;
0093   
0094   Standard_EXPORT virtual Storage_Error EndWriteTypeSection() = 0;
0095   
0096   Standard_EXPORT virtual Storage_Error BeginReadTypeSection() = 0;
0097   
0098   Standard_EXPORT virtual Standard_Integer TypeSectionSize() = 0;
0099   
0100   Standard_EXPORT virtual void ReadTypeInformations (Standard_Integer& typeNum, TCollection_AsciiString& typeName) = 0;
0101   
0102   Standard_EXPORT virtual Storage_Error EndReadTypeSection() = 0;
0103   
0104   Standard_EXPORT virtual Storage_Error BeginWriteRootSection() = 0;
0105   
0106   Standard_EXPORT virtual void SetRootSectionSize (const Standard_Integer aSize) = 0;
0107   
0108   Standard_EXPORT virtual void WriteRoot (const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& aType) = 0;
0109   
0110   Standard_EXPORT virtual Storage_Error EndWriteRootSection() = 0;
0111   
0112   Standard_EXPORT virtual Storage_Error BeginReadRootSection() = 0;
0113   
0114   Standard_EXPORT virtual Standard_Integer RootSectionSize() = 0;
0115   
0116   Standard_EXPORT virtual void ReadRoot (TCollection_AsciiString& rootName, Standard_Integer& aRef, TCollection_AsciiString& aType) = 0;
0117   
0118   Standard_EXPORT virtual Storage_Error EndReadRootSection() = 0;
0119   
0120   Standard_EXPORT virtual Storage_Error BeginWriteRefSection() = 0;
0121   
0122   Standard_EXPORT virtual void SetRefSectionSize (const Standard_Integer aSize) = 0;
0123   
0124   Standard_EXPORT virtual void WriteReferenceType (const Standard_Integer reference, const Standard_Integer typeNum) = 0;
0125   
0126   Standard_EXPORT virtual Storage_Error EndWriteRefSection() = 0;
0127   
0128   Standard_EXPORT virtual Storage_Error BeginReadRefSection() = 0;
0129   
0130   Standard_EXPORT virtual Standard_Integer RefSectionSize() = 0;
0131   
0132   Standard_EXPORT virtual void ReadReferenceType (Standard_Integer& reference, Standard_Integer& typeNum) = 0;
0133   
0134   Standard_EXPORT virtual Storage_Error EndReadRefSection() = 0;
0135   
0136   Standard_EXPORT virtual Storage_Error BeginWriteDataSection() = 0;
0137   
0138   Standard_EXPORT virtual void WritePersistentObjectHeader (const Standard_Integer aRef, const Standard_Integer aType) = 0;
0139   
0140   Standard_EXPORT virtual void BeginWritePersistentObjectData() = 0;
0141   
0142   Standard_EXPORT virtual void BeginWriteObjectData() = 0;
0143   
0144   Standard_EXPORT virtual void EndWriteObjectData() = 0;
0145   
0146   Standard_EXPORT virtual void EndWritePersistentObjectData() = 0;
0147   
0148   Standard_EXPORT virtual Storage_Error EndWriteDataSection() = 0;
0149   
0150   Standard_EXPORT virtual Storage_Error BeginReadDataSection() = 0;
0151   
0152   Standard_EXPORT virtual void ReadPersistentObjectHeader (Standard_Integer& aRef, Standard_Integer& aType) = 0;
0153   
0154   Standard_EXPORT virtual void BeginReadPersistentObjectData() = 0;
0155   
0156   Standard_EXPORT virtual void BeginReadObjectData() = 0;
0157   
0158   Standard_EXPORT virtual void EndReadObjectData() = 0;
0159   
0160   Standard_EXPORT virtual void EndReadPersistentObjectData() = 0;
0161   
0162   Standard_EXPORT virtual Storage_Error EndReadDataSection() = 0;
0163   
0164   Standard_EXPORT virtual void SkipObject() = 0;
0165   
0166   Standard_EXPORT virtual Storage_Error Close() = 0;
0167 
0168 public:
0169   //!@name Output methods
0170 
0171   Standard_EXPORT virtual Storage_BaseDriver& PutReference (const Standard_Integer aValue) = 0;
0172   
0173   Standard_EXPORT virtual Storage_BaseDriver& PutCharacter (const Standard_Character aValue) = 0;
0174   Storage_BaseDriver& operator << (const Standard_Character aValue)
0175   {
0176     return PutCharacter(aValue);
0177   }
0178 
0179   Standard_EXPORT virtual Storage_BaseDriver& PutExtCharacter(const Standard_ExtCharacter aValue) = 0;
0180   Storage_BaseDriver& operator << (const Standard_ExtCharacter aValue)
0181   {
0182     return PutExtCharacter(aValue);
0183   }
0184 
0185   Standard_EXPORT virtual Storage_BaseDriver& PutInteger(const Standard_Integer aValue) = 0;
0186   Storage_BaseDriver& operator << (const Standard_Integer aValue)
0187   {
0188     return PutInteger(aValue);
0189   }
0190 
0191   Standard_EXPORT virtual Storage_BaseDriver& PutBoolean(const Standard_Boolean aValue) = 0;
0192   Storage_BaseDriver& operator << (const Standard_Boolean aValue)
0193   {
0194     return PutBoolean(aValue);
0195   }
0196 
0197   Standard_EXPORT virtual Storage_BaseDriver& PutReal(const Standard_Real aValue) = 0;
0198   Storage_BaseDriver& operator << (const Standard_Real aValue)
0199   {
0200     return PutReal(aValue);
0201   }
0202 
0203   Standard_EXPORT virtual Storage_BaseDriver& PutShortReal(const Standard_ShortReal aValue) = 0;
0204   Storage_BaseDriver& operator << (const Standard_ShortReal aValue)
0205   {
0206     return PutShortReal(aValue);
0207   }
0208 
0209 public:
0210   //!@name Input methods
0211 
0212   Standard_EXPORT virtual Storage_BaseDriver& GetReference (Standard_Integer& aValue) = 0;
0213   
0214   Standard_EXPORT virtual Storage_BaseDriver& GetCharacter (Standard_Character& aValue) = 0;
0215   Storage_BaseDriver& operator >> (Standard_Character& aValue)
0216   {
0217     return GetCharacter(aValue);
0218   }
0219 
0220   Standard_EXPORT virtual Storage_BaseDriver& GetExtCharacter(Standard_ExtCharacter& aValue) = 0;
0221   Storage_BaseDriver& operator >> (Standard_ExtCharacter& aValue)
0222   {
0223     return GetExtCharacter(aValue);
0224   }
0225 
0226   Standard_EXPORT virtual Storage_BaseDriver& GetInteger(Standard_Integer& aValue) = 0;
0227   Storage_BaseDriver& operator >> (Standard_Integer& aValue)
0228   {
0229     return GetInteger(aValue);
0230   }
0231 
0232   Standard_EXPORT virtual Storage_BaseDriver& GetBoolean(Standard_Boolean& aValue) = 0;
0233   Storage_BaseDriver& operator >> (Standard_Boolean& aValue)
0234   {
0235     return GetBoolean(aValue);
0236   }
0237 
0238   Standard_EXPORT virtual Storage_BaseDriver& GetReal(Standard_Real& aValue) = 0;
0239   Storage_BaseDriver& operator >> (Standard_Real& aValue)
0240   {
0241     return GetReal(aValue);
0242   }
0243 
0244   Standard_EXPORT virtual Storage_BaseDriver& GetShortReal(Standard_ShortReal& aValue) = 0;
0245   Storage_BaseDriver& operator >> (Standard_ShortReal& aValue)
0246   {
0247     return GetShortReal(aValue);
0248   }
0249 
0250 protected:
0251   
0252   Standard_EXPORT Storage_BaseDriver();
0253   
0254   void SetName(const TCollection_AsciiString& aName) { myName = aName; }
0255 
0256   void SetOpenMode(const Storage_OpenMode aMode) { myOpenMode = aMode; }
0257 
0258 private:
0259 
0260   Storage_OpenMode myOpenMode;
0261   TCollection_AsciiString myName;
0262 };
0263 
0264 #endif // _Storage_BaseDriver_HeaderFile