42cf5bc1 |
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 |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _PCDM_StorageDriver_HeaderFile |
18 | #define _PCDM_StorageDriver_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
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; |
31 | class PCDM_Document; |
32 | class CDM_Document; |
33 | class TCollection_ExtendedString; |
34 | class Storage_Schema; |
35 | |
36 | |
37 | class PCDM_StorageDriver; |
38 | DEFINE_STANDARD_HANDLE(PCDM_StorageDriver, PCDM_Writer) |
39 | |
40 | //! persistent implemention of storage. |
41 | //! |
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. |
45 | //! |
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 |
55 | { |
56 | |
57 | public: |
58 | |
59 | |
60 | //! raises NotImplemented. |
61 | Standard_EXPORT virtual Handle(PCDM_Document) Make (const Handle(CDM_Document)& aDocument); |
62 | |
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); |
66 | |
42cf5bc1 |
67 | //! Warning! raises DriverError if an error occurs during inside the |
68 | //! Make method. |
69 | //! stores the content of the Document into a new file. |
70 | //! |
71 | //! by default Write will use Make method to build a persistent |
72 | //! document and the Schema method to write the persistent document. |
6d8f9f4a |
73 | Standard_EXPORT virtual void Write (const Handle(CDM_Document)& aDocument, |
74 | const TCollection_ExtendedString& aFileName, |
75 | const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE; |
4ff92abe |
76 | |
77 | //! Write <theDocument> to theOStream |
6d8f9f4a |
78 | Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, |
79 | Standard_OStream& theOStream, |
80 | const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE; |
42cf5bc1 |
81 | |
82 | Standard_EXPORT void SetFormat (const TCollection_ExtendedString& aformat); |
83 | |
84 | Standard_EXPORT TCollection_ExtendedString GetFormat() const; |
85 | |
86 | Standard_EXPORT Standard_Boolean IsError() const; |
87 | |
88 | Standard_EXPORT void SetIsError (const Standard_Boolean theIsError); |
89 | |
90 | Standard_EXPORT PCDM_StoreStatus GetStoreStatus() const; |
91 | |
92 | Standard_EXPORT void SetStoreStatus (const PCDM_StoreStatus theStoreStatus); |
93 | |
94 | |
95 | |
96 | |
92efcf78 |
97 | DEFINE_STANDARD_RTTIEXT(PCDM_StorageDriver,PCDM_Writer) |
42cf5bc1 |
98 | |
99 | protected: |
100 | |
101 | |
102 | |
103 | |
104 | private: |
105 | |
106 | |
107 | TCollection_ExtendedString myFormat; |
108 | Standard_Boolean myIsError; |
109 | PCDM_StoreStatus myStoreStatus; |
110 | |
111 | |
112 | }; |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | |
120 | #endif // _PCDM_StorageDriver_HeaderFile |