b311480e |
1 | -- Created on: 1993-01-08 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | deferred class WorkLibrary from IFSelect inherits Transient |
24 | |
25 | ---Purpose : This class defines the (empty) frame which can be used to |
26 | -- enrich a XSTEP set with new capabilities |
27 | -- In particular, a specific WorkLibrary must give the way for |
28 | -- Reading a File into a Model, and Writing a Model to a File |
29 | -- Thus, it is possible to define several Work Libraries for each |
30 | -- norm, but recommanded to define one general class for each one : |
31 | -- this general class will define the Read and Write methods. |
32 | -- |
33 | -- Also a Dump service is provided, it can produce, according the |
34 | -- norm, either a parcel of a file for an entity, or any other |
35 | -- kind of informations relevant for the norm, |
36 | |
37 | uses CString, |
38 | Messenger from Message, |
39 | HArray1OfHAsciiString from Interface, |
40 | CheckIterator, InterfaceModel, Protocol from Interface, |
41 | EntityIterator, CopyTool, |
42 | AppliedModifiers, ContextWrite |
43 | |
44 | is |
45 | |
46 | Initialize; |
47 | ---Purpose : Required to initialise fields |
48 | |
49 | ReadFile (me; name : CString; |
50 | model : out mutable InterfaceModel; |
51 | protocol : Protocol from Interface) |
52 | returns Integer is deferred; |
53 | ---Purpose : Gives the way to Read a File and transfer it to a Model |
54 | -- <mod> is the resulting Model, which has to be created by this |
55 | -- method. In case of error, <mod> must be returned Null |
56 | -- Return value is a status with free values. |
57 | -- Simply, 0 is for "Execution OK" |
58 | -- The Protocol can be used to work (e.g. create the Model, read |
59 | -- and recognize the Entities) |
60 | |
61 | WriteFile (me; ctx : in out ContextWrite) |
62 | returns Boolean is deferred; |
63 | ---Purpose : Gives the way to Write a File from a Model. |
64 | -- <ctx> contains all necessary informations : the model, the |
65 | -- protocol, the file name, and the list of File Modifiers to be |
66 | -- applied, also with restricted list of selected entities for |
67 | -- each one, if required. |
68 | -- In return, it brings the produced check-list |
69 | -- |
70 | -- The WorkLibrary has to query <applied> to get then run the |
71 | -- ContextWrite by looping like this (example) : |
72 | -- for (numap = 1; numap <= ctx.NbModifiers(); numap ++) { |
73 | -- ctx.SetModifier (numap); |
74 | -- cast ctx.FileModifier() to specific type -> variable filemod |
75 | -- if (!filemod.IsNull()) filemod->Perform (ctx,writer); |
76 | -- filemod then works with ctx. It can, either act on the |
77 | -- model itself (for instance on its header), or iterate |
78 | -- on selected entities (Start/Next/More/Value) |
79 | -- it can call AddFail or AddWarning, as necessary |
80 | -- } |
81 | |
82 | CopyModel (me; |
83 | original : InterfaceModel; |
84 | newmodel : mutable InterfaceModel; |
85 | list : EntityIterator; |
86 | TC : in out CopyTool) |
87 | returns Boolean is virtual; |
88 | ---Purpose : Performs the copy of entities from an original model to a new |
89 | -- one. It must also copy headers if any. Returns True when done. |
90 | -- The provided default works by copying the individual entities |
91 | -- designated in the list, by using the general service class |
92 | -- CopyTool. |
93 | -- It can be redefined for a norm which, either implements Copy |
94 | -- by another way (do not forget to Bind each copied result with |
95 | -- its original entity in TC) and returns True, or does not know |
96 | -- how to copy and returns False |
97 | |
98 | |
99 | DumpEntity (me; |
100 | model : InterfaceModel; |
101 | protocol : Protocol from Interface; |
102 | entity : Transient; |
103 | S : Messenger from Message; |
104 | level : Integer) |
105 | is deferred; |
106 | ---Purpose : Gives the way of dumping an entity under a form comprehensive |
107 | -- for each norm. <model> helps to identify, number ... entities. |
108 | -- <level> is to be interpreted for each norm (because of the |
109 | -- formats which can be very different) |
110 | |
111 | DumpEntity (me; |
112 | model : InterfaceModel; |
113 | protocol : Protocol from Interface; |
114 | entity : Transient; |
115 | S : Messenger from Message); |
116 | ---Purpose : Calls deferred DumpEntity with the recorded default level |
117 | |
118 | SetDumpLevels (me : mutable; def, max : Integer); |
119 | ---Purpose : Records a default level and a maximum value for level |
120 | -- level for DumpEntity can go between 0 and <max> |
121 | -- default value will be <def> |
122 | |
123 | DumpLevels (me; def, max : out Integer); |
124 | ---Purpose : Returns the recorded default and maximum dump levels |
125 | -- If none was recorded, max is returned negative, def as zero |
126 | |
127 | SetDumpHelp (me : mutable; level : Integer; help : CString); |
128 | ---Purpose : Records a short line of help for a level (0 - max) |
129 | |
130 | DumpHelp (me; level : Integer) returns CString; |
131 | ---Purpose : Returns the help line recorded for <level>, or an empty string |
132 | |
133 | fields |
134 | |
135 | thelevdef : Integer; |
136 | thelevhlp : HArray1OfHAsciiString from Interface; |
137 | |
138 | end WorkLibrary; |