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