1 // Created on: 1997-11-03
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_StorageDriver_HeaderFile
18 #define _PCDM_StorageDriver_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TCollection_ExtendedString.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <PCDM_StoreStatus.hxx>
26 #include <PCDM_Writer.hxx>
27 #include <PCDM_SequenceOfDocument.hxx>
28 #include <TColStd_SequenceOfExtendedString.hxx>
29 class Standard_NoSuchObject;
30 class PCDM_DriverError;
33 class TCollection_ExtendedString;
37 class PCDM_StorageDriver;
38 DEFINE_STANDARD_HANDLE(PCDM_StorageDriver, PCDM_Writer)
40 //! persistent implemention of storage.
42 //! The application must redefine one the two Make()
43 //! methods. The first one, if the application wants to
44 //! put only one document in the storage file.
46 //! The second method should be redefined to put
47 //! additional document that could be used by the
48 //! retrieval instead of the principal document, depending
49 //! on the schema used during the retrieval. For example,
50 //! a second document could be a standard
51 //! CDMShape_Document. This means that a client
52 //! application will already be able to extract a CDMShape_Document
53 //! of the file, if the Shape Schema remains unchanged.
54 class PCDM_StorageDriver : public PCDM_Writer
60 //! raises NotImplemented.
61 Standard_EXPORT virtual Handle(PCDM_Document) Make (const Handle(CDM_Document)& aDocument);
63 //! By default, puts in the Sequence the document returns
64 //! by the previous Make method.
65 Standard_EXPORT virtual void Make (const Handle(CDM_Document)& aDocument, PCDM_SequenceOfDocument& Documents);
67 //! Warning! raises DriverError if an error occurs during inside the
69 //! stores the content of the Document into a new file.
71 //! by default Write will use Make method to build a persistent
72 //! document and the Schema method to write the persistent document.
73 Standard_EXPORT virtual void Write (const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aFileName) Standard_OVERRIDE;
75 //! Write <theDocument> to theOStream
76 Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, Standard_OStream& theOStream) Standard_OVERRIDE;
78 Standard_EXPORT void SetFormat (const TCollection_ExtendedString& aformat);
80 Standard_EXPORT TCollection_ExtendedString GetFormat() const;
82 Standard_EXPORT Standard_Boolean IsError() const;
84 Standard_EXPORT void SetIsError (const Standard_Boolean theIsError);
86 Standard_EXPORT PCDM_StoreStatus GetStoreStatus() const;
88 Standard_EXPORT void SetStoreStatus (const PCDM_StoreStatus theStoreStatus);
93 DEFINE_STANDARD_RTTIEXT(PCDM_StorageDriver,PCDM_Writer)
103 TCollection_ExtendedString myFormat;
104 Standard_Boolean myIsError;
105 PCDM_StoreStatus myStoreStatus;
116 #endif // _PCDM_StorageDriver_HeaderFile