42cf5bc1 |
1 | // Created on: 1993-01-25 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1993-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 _StepData_ReadWriteModule_HeaderFile |
18 | #define _StepData_ReadWriteModule_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Interface_ReaderModule.hxx> |
24 | #include <Standard_Integer.hxx> |
25 | #include <TColStd_SequenceOfAsciiString.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | class Standard_DomainError; |
28 | class Interface_FileReaderData; |
29 | class TCollection_AsciiString; |
30 | class Interface_Check; |
31 | class Standard_Transient; |
32 | class StepData_StepReaderData; |
33 | class StepData_StepWriter; |
34 | |
35 | |
36 | class StepData_ReadWriteModule; |
37 | DEFINE_STANDARD_HANDLE(StepData_ReadWriteModule, Interface_ReaderModule) |
38 | |
39 | //! Defines basic File Access Module (Recognize, Read, Write) |
40 | //! That is : ReaderModule (Recognize & Read) + Write for |
41 | //! StepWriter (for a more centralized description) |
42 | //! Warning : A sub-class of ReadWriteModule, which belongs to a particular |
43 | //! Protocol, must use the same definition for Case Numbers (give |
44 | //! the same Value for a StepType defined as a String from a File |
45 | //! as the Protocol does for the corresponding Entity) |
46 | class StepData_ReadWriteModule : public Interface_ReaderModule |
47 | { |
48 | |
49 | public: |
50 | |
51 | |
52 | //! Translate the Type of record <num> in <data> to a positive |
53 | //! Case Number, or 0 if failed. |
54 | //! Works with a StepReaderData, in which the Type of an Entity |
55 | //! is defined as a String : Reads the RecordType <num> then calls |
56 | //! CaseNum (this type) |
57 | //! Warning : The methods CaseStep, StepType and Recognize, |
58 | //! must be in phase (triplets CaseNum-StepType-Type of Object) |
79104795 |
59 | Standard_EXPORT Standard_Integer CaseNum (const Handle(Interface_FileReaderData)& data, const Standard_Integer num) const Standard_OVERRIDE; |
42cf5bc1 |
60 | |
61 | //! Defines Case Numbers corresponding to the recognized Types |
62 | //! Called by CaseNum (data,num) above for a Simple Type Entity |
63 | //! Warning : CaseStep must give the same Value as Protocol does for the |
64 | //! Entity type which corresponds to this Type given as a String |
65 | Standard_EXPORT virtual Standard_Integer CaseStep (const TCollection_AsciiString& atype) const = 0; |
66 | |
67 | //! Same a above but for a Complex Type Entity ("Plex") |
68 | //! The provided Default recognizes nothing |
69 | Standard_EXPORT virtual Standard_Integer CaseStep (const TColStd_SequenceOfAsciiString& types) const; |
70 | |
71 | //! Returns True if the Case Number corresponds to a Complex Type |
72 | //! ("Plex"). Remember that all possible combinations must be |
73 | //! aknowledged to be processed |
74 | //! Default is False for all cases. For a Protocol which defines |
75 | //! possible Plexes, this method must be redefined. |
76 | Standard_EXPORT virtual Standard_Boolean IsComplex (const Standard_Integer CN) const; |
77 | |
78 | //! Function specific to STEP, which delivers the StepType as it |
79 | //! is recorded in and read from a File compliant with STEP. |
80 | //! This method is symmetric to the method CaseStep. |
81 | //! StepType can be different from Dynamic Type's name, but |
82 | //! belongs to the same class of Object. |
83 | //! Returns an empty String if <CN> is zero. |
84 | //! Warning : For a Complex Type Entity, returns an Empty String |
85 | //! (Complex Type must be managed by users) |
86 | Standard_EXPORT virtual const TCollection_AsciiString& StepType (const Standard_Integer CN) const = 0; |
87 | |
88 | //! Function specific to STEP. Some STEP Types have a short form |
89 | //! This method can be redefined to fill it |
90 | //! By default, returns an empty string, which is then interpreted |
91 | //! to take normal form from StepType |
92 | Standard_EXPORT virtual TCollection_AsciiString ShortType (const Standard_Integer CN) const; |
93 | |
94 | //! Function specific to STEP, which delivers the list of types |
95 | //! which corresponds to a complex type. If <CN> is not for a |
96 | //! complex type, this method returns False. Else it returns True |
97 | //! and fills the list in alphabetic order. |
98 | //! The default returns False. To be redefined as required. |
99 | Standard_EXPORT virtual Standard_Boolean ComplexType (const Standard_Integer CN, TColStd_SequenceOfAsciiString& types) const; |
100 | |
101 | //! General Read Function, calls ReadStep |
79104795 |
102 | Standard_EXPORT void Read (const Standard_Integer CN, const Handle(Interface_FileReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(Standard_Transient)& ent) const Standard_OVERRIDE; |
42cf5bc1 |
103 | |
104 | //! Specific Read Function. Works with StepReaderData |
105 | Standard_EXPORT virtual void ReadStep (const Standard_Integer CN, const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(Standard_Transient)& ent) const = 0; |
106 | |
107 | //! Write Function, switched by CaseNum |
108 | Standard_EXPORT virtual void WriteStep (const Standard_Integer CN, StepData_StepWriter& SW, const Handle(Standard_Transient)& ent) const = 0; |
109 | |
110 | |
111 | |
112 | |
92efcf78 |
113 | DEFINE_STANDARD_RTTIEXT(StepData_ReadWriteModule,Interface_ReaderModule) |
42cf5bc1 |
114 | |
115 | protected: |
116 | |
117 | |
118 | |
119 | |
120 | private: |
121 | |
122 | |
123 | |
124 | |
125 | }; |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | |
132 | |
133 | #endif // _StepData_ReadWriteModule_HeaderFile |