1 // Created on: 1997-12-09
2 // Created by: Jean-Louis Frenkel
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _PCDM_ReadWriter_HeaderFile
18 #define _PCDM_ReadWriter_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Transient.hxx>
24 #include <Standard_Integer.hxx>
25 #include <PCDM_SequenceOfReference.hxx>
26 #include <TColStd_SequenceOfExtendedString.hxx>
27 #include <Storage_OpenMode.hxx>
28 class TCollection_AsciiString;
31 class TCollection_ExtendedString;
32 class Message_Messenger;
33 class Storage_BaseDriver;
36 class PCDM_ReadWriter;
37 DEFINE_STANDARD_HANDLE(PCDM_ReadWriter, Standard_Transient)
40 class PCDM_ReadWriter : public Standard_Transient
46 //! returns PCDM_ReadWriter_1.
47 Standard_EXPORT virtual TCollection_AsciiString Version() const = 0;
49 Standard_EXPORT virtual void WriteReferenceCounter (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument) const = 0;
51 Standard_EXPORT virtual void WriteReferences (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& theReferencerFileName) const = 0;
53 Standard_EXPORT virtual void WriteExtensions (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument) const = 0;
55 Standard_EXPORT virtual void WriteVersion (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument) const = 0;
57 Standard_EXPORT virtual Standard_Integer ReadReferenceCounter (const TCollection_ExtendedString& theFileName, const Handle(Message_Messenger)& theMsgDriver) const = 0;
59 Standard_EXPORT virtual void ReadReferences (const TCollection_ExtendedString& aFileName, PCDM_SequenceOfReference& theReferences, const Handle(Message_Messenger)& theMsgDriver) const = 0;
61 Standard_EXPORT virtual void ReadExtensions (const TCollection_ExtendedString& aFileName, TColStd_SequenceOfExtendedString& theExtensions, const Handle(Message_Messenger)& theMsgDriver) const = 0;
63 Standard_EXPORT virtual Standard_Integer ReadDocumentVersion (const TCollection_ExtendedString& aFileName, const Handle(Message_Messenger)& theMsgDriver) const = 0;
65 Standard_EXPORT static void Open (const Handle(Storage_BaseDriver)& aDriver,
66 const TCollection_ExtendedString& aFileName,
67 const Storage_OpenMode anOpenMode);
69 //! returns the convenient Reader for a File.
70 Standard_EXPORT static Handle(PCDM_ReadWriter) Reader (const TCollection_ExtendedString& aFileName);
72 Standard_EXPORT static Handle(PCDM_ReadWriter) Writer();
74 Standard_EXPORT static void WriteFileFormat (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument);
76 //! tries to get a format in the file. returns an empty
77 //! string if the file could not be read or does not have
78 //! a FileFormat information.
79 Standard_EXPORT static TCollection_ExtendedString FileFormat (const TCollection_ExtendedString& aFileName);
81 //! tries to get a format from the stream. returns an empty
82 //! string if the file could not be read or does not have
83 //! a FileFormat information.
84 Standard_EXPORT static TCollection_ExtendedString FileFormat (Standard_IStream& theIStream, Handle(Storage_Data)& theData);
88 DEFINE_STANDARD_RTTIEXT(PCDM_ReadWriter,Standard_Transient)
108 #endif // _PCDM_ReadWriter_HeaderFile