7fd59977 |
1 | -- File: IGESWriter.cdl |
2 | -- Created: Tue Apr 7 14:06:46 1992 |
3 | -- Author: Christian CAILLET |
4 | -- <cky@phobox> |
5 | ---Copyright: Matra Datavision 1992 |
6 | |
7 | |
8 | class IGESWriter from IGESData |
9 | |
10 | ---Purpose : manages atomic file writing, under control of IGESModel : |
11 | -- prepare text to be sent then sends it |
12 | -- takes into account distinction between successive Sections |
13 | |
14 | uses Integer, Real, Character, |
15 | HAsciiString from TCollection, HSequenceOfHAsciiString from TColStd, |
16 | Array1OfInteger from TColStd, |
17 | IGESModel, GlobalSection, IGESEntity, Array1OfDirPart, ReadStage, |
18 | Protocol from IGESData, WriterLib, LineBuffer, FloatWriter, |
19 | XY, XYZ |
20 | |
21 | raises InterfaceMismatch |
22 | |
23 | is |
24 | |
25 | Create (amodel : IGESModel) returns IGESWriter; |
26 | ---Purpose : Creates an IGESWriter, empty ready to work |
27 | -- (see the methods SendModel and Print) |
28 | |
29 | Create returns IGESWriter; |
30 | ---Purpose : Default constructor (not used) to satisfy the compiler |
31 | |
32 | Create (other : IGESWriter) returns IGESWriter; |
33 | ---Purpose : Constructor by copy (not used) to satisfy the compiler |
34 | |
35 | -- Options for Sending Forms -- |
36 | |
37 | FloatWriter (me : in out) returns FloatWriter; |
38 | ---Purpose : Returns the embedded FloatWriter, which controls sending Reals |
39 | -- Use this method to access FloatWriter in order to consult or |
40 | -- change its options (MainFormat, FormatForRange,ZeroSuppress), |
41 | -- because it is returned as the address of its field |
42 | ---C++ : return & |
43 | |
44 | WriteMode (me : in out) returns Integer; |
45 | ---Purpose : Returns the write mode, in order to be read and/or changed |
46 | -- Write Mode controls the way final print works |
47 | -- 0 (D) : Normal IGES, 10 : FNES |
48 | ---C++ : return & |
49 | |
50 | -- -- Management of building file -- -- |
51 | |
52 | SendStartLine (me : in out; startline : CString); |
53 | ---Purpose : Sends an additionnal Starting Line : this is the way used to |
54 | -- send comments in an IGES File (at beginning of the file). |
55 | -- If the line is more than 72 char.s long, it is splited into |
56 | -- as many lines as required to send it completely |
57 | |
58 | SendModel (me : in out; protocol : Protocol from IGESData); |
59 | ---Purpose : Sends the complete IGESModel (Global Section, Entities as |
60 | -- Directory Entries & Parameter Lists, etc...) |
61 | -- i.e. fills a list of texts. Once filled, it can be sent by |
62 | -- method Print |
63 | |
64 | SectionS (me : in out) raises InterfaceMismatch; |
65 | ---Purpose : declares sending of S section (only a declaration) |
66 | -- error if state is not initial |
67 | |
68 | SectionG (me : in out; header : GlobalSection) raises InterfaceMismatch; |
69 | ---Purpose : prepares sending of header, from a GlobalSection (stores it) |
70 | -- error if SectionS was not called just before |
71 | -- takes in account special characters (Separator, EndMark) |
72 | |
73 | SectionsDP (me : in out) raises InterfaceMismatch; |
74 | ---Purpose : prepares sending of list of entities, as Sections D (directory |
75 | -- list) and P (Parameters lists, one per entity) |
76 | -- Entities will be then processed, one after the other |
77 | -- error if SectionG has not be called just before |
78 | |
79 | SectionT (me : in out) raises InterfaceMismatch; |
80 | ---Purpose : declares sending of T section (only a declaration) |
81 | -- error if does not follow Entities sending |
82 | |
83 | DirPart (me : in out; anent : IGESEntity) raises InterfaceMismatch; |
84 | ---Purpose : translates directory part of an Entity into a litteral DirPart |
85 | -- Some infos are computed after sending parameters |
86 | -- Error if not in sections DP or Stage not "Dir" |
87 | |
88 | OwnParams (me : in out; anent : IGESEntity) raises InterfaceMismatch; |
89 | ---Purpose : sends own parameters of the entity, by sending firstly its |
90 | -- type, then calling specific method WriteOwnParams |
91 | -- Error if not in sections DP or Stage not "Own" |
92 | |
93 | Associativities (me : in out; anent : IGESEntity) raises InterfaceMismatch; |
94 | ---Purpose : sends associativity list, as complement of parameters list |
95 | -- error if not in sections DP or Stage not "Associativity" |
96 | |
97 | Properties (me : in out; anent : IGESEntity) raises InterfaceMismatch; |
98 | ---Purpose : sends property list, as complement of parameters list |
99 | -- error if not in sections DP or Stage not "Property" |
100 | |
101 | EndEntity (me : in out) raises InterfaceMismatch; |
102 | ---Purpose : declares end of sending an entity (ends param list by ';') |
103 | |
104 | -- -- Sending parameters (to be used by WriteOwnParams) -- -- |
105 | |
106 | AddString (me : in out; val : HAsciiString from TCollection; |
107 | more : Integer = 0) is private; |
108 | ---Purpose : Basic action of adding a string to current parameter list as a |
109 | -- line; manages size limit (64 or 72 according Sestion G or P) |
110 | -- <more>, if precised, requires that <more> characters will |
111 | -- remain free on the current line once this AddString done |
112 | |
113 | AddString (me : in out; val : CString; lnval : Integer = 0; |
114 | more : Integer = 0) is private; |
115 | ---Purpose : Basic action of adding a string to current parameter list as a |
116 | -- line. Manages size limit (64 or 72 according Sestion G or P) |
117 | -- <val> is the string and <lnval> its length. If <lnval> is not |
118 | -- given, it is computed by strlen(val). |
119 | -- <more>, if precised, requires that <more> characters will |
120 | -- remain free on the current line once this AddString done |
121 | |
122 | AddChar (me : in out; val : Character; more : Integer = 0) is private; |
123 | ---Purpose : Adds a string defined as a single character (for instance, the |
124 | -- parameter separator). Manages size limit |
125 | -- <more>, if precised, requires that <more> characters will |
126 | -- remain free on the current line once this AddString done |
127 | |
128 | |
129 | SendVoid (me : in out); |
130 | ---Purpose : sends a void parameter, that is null text |
131 | |
132 | Send (me : in out; val : Integer); |
133 | ---Purpose : sends an Integer parameter |
134 | |
135 | SendBoolean (me : in out; val : Boolean); |
136 | ---Purpose : sends a Boolean parameter as an Integer value 0(False)/1(True) |
137 | |
138 | Send (me : in out; val : Real); |
139 | ---Purpose : sends a Real parameter. Works with FloatWriter |
140 | |
141 | Send (me : in out; val : HAsciiString from TCollection); |
142 | ---Purpose : sends a Text parameter under Hollerith form |
143 | |
144 | Send (me : in out; val : IGESEntity; negative : Boolean = Standard_False); |
145 | ---Purpose : sends a Reference to an Entity (if its Number is N, its |
146 | -- pointer is 2*N-1) |
147 | -- If <val> is Null, "0" will be sent |
148 | -- If <negative> is True, "Pointer" is sent as negative |
149 | |
150 | SendString (me : in out; val : HAsciiString from TCollection); |
151 | ---Purpose : sends a parameter under its exact form given as a string |
152 | |
153 | Send (me : in out; val : XY); |
154 | ---Purpose : Sends a XY, interpreted as a couple of 2 Reals (X & Y) |
155 | |
156 | Send (me : in out; val : XYZ); |
157 | ---Purpose : Sends a XYZ, interpreted as a couple of 2 Reals (X , Y & Z) |
158 | |
159 | -- -- Conclusion : printing on an output -- -- |
160 | |
161 | SectionStrings (me; numsec : Integer) |
162 | returns HSequenceOfHAsciiString from TColStd; |
163 | ---Purpose : Returns the list of strings for a section given its rank |
164 | -- 1 : Start (if not empty) 2 : Global 3 or 4 : Parameters |
165 | -- RQ: no string list for Directory section |
166 | -- An empty section gives a null handle |
167 | |
168 | Print (me; S : in out OStream) returns Boolean |
169 | ---Purpose : Writes result on an output defined as an OStream |
170 | -- resolves stored infos at this time; in particular, numbers of |
171 | -- lines used to adress P-section from D-section and final totals |
172 | -- Takes WriteMode into account |
173 | raises InterfaceMismatch; |
174 | -- Error if not at Section "T" |
175 | |
176 | fields |
177 | |
178 | themodel : IGESModel; |
179 | thestar : HSequenceOfHAsciiString from TColStd; -- starting lines |
180 | thehead : HSequenceOfHAsciiString from TColStd; -- parameters for header |
181 | |
182 | thesep : Character; -- separator (gotten from GlobalSection) |
183 | theendm : Character; -- end mark ( id ) |
184 | thedirs : Array1OfDirPart; |
185 | thepnum : Array1OfInteger from TColStd; -- rank in P-section for each entity |
186 | thepars : HSequenceOfHAsciiString from TColStd; -- parameters for file |
187 | thesect : Integer; -- section number (initial:0-S-G-DP-T) |
188 | thestep : ReadStage; -- step for each entity |
189 | thecurr : LineBuffer; -- current line (for sections G then P) |
190 | |
191 | themodew : Integer; -- control of writing mode |
192 | thefloatw : FloatWriter; -- control of sending Reals |
193 | |
194 | end IGESWriter; |