b311480e |
1 | -- Created on: 1996-01-26 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1996-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 | class ContextWrite from IFSelect |
18 | |
19 | ---Purpose : This class gathers various informations used by File Modifiers |
20 | -- apart from the writer object, which is specific of the norm |
21 | -- and of the physical format |
22 | -- |
23 | -- These informations are controlled by an object AppliedModifiers |
24 | -- (if it is not defined, no modification is allowed on writing) |
25 | -- |
26 | -- Furthermore, in return, ContextModif can record Checks, either |
27 | -- one for all, or one for each Entity. It supports trace too. |
28 | |
29 | uses Transient, CString, AsciiString from TCollection, |
30 | InterfaceModel, EntityIterator, Graph, HGraph, |
31 | Protocol from Interface, Check, CheckIterator, GeneralModifier, |
32 | AppliedModifiers |
33 | |
34 | raises NoSuchObject |
35 | |
36 | is |
37 | |
38 | Create (model : InterfaceModel; proto : Protocol; |
6e33d3ce |
39 | applieds : AppliedModifiers; filename : CString) |
7fd59977 |
40 | returns ContextWrite; |
41 | ---Purpose : Prepares a ContextWrite with these informations : |
42 | -- - the model which is to be written |
43 | -- - the protocol to be used |
44 | -- - the filename |
45 | -- - an object AppliedModifiers to work. It gives a list of |
46 | -- FileModifiers to be ran, and for each one it can give |
47 | -- a restricted list of entities (in the model), else all |
48 | -- the model is considered |
49 | |
50 | Create (hgraph : HGraph; proto : Protocol; |
6e33d3ce |
51 | applieds : AppliedModifiers; filename : CString) |
7fd59977 |
52 | returns ContextWrite; |
53 | ---Purpose : Same as above but with an already computed Graph |
54 | |
55 | Model (me) returns InterfaceModel; |
56 | ---Purpose : Returns the Model |
57 | |
58 | Protocol (me) returns Protocol; |
59 | ---Purpose : Returns the Protocol; |
60 | |
61 | FileName (me) returns CString; |
62 | ---Purpose : Returns the File Name |
63 | |
6e33d3ce |
64 | AppliedModifiers (me) returns AppliedModifiers; |
7fd59977 |
65 | ---Purpose : Returns the object AppliedModifiers |
66 | |
67 | Graph (me : in out) returns Graph; |
68 | ---Purpose : Returns the Graph, either given when created, else created |
69 | -- the first time it is queried |
70 | ---C++ : return const & |
71 | |
72 | |
73 | -- -- Control when running -- -- |
74 | |
75 | NbModifiers (me) returns Integer; |
76 | ---Purpose : Returns the count of recorded File Modifiers |
77 | |
78 | SetModifier (me : in out; numod : Integer) returns Boolean; |
79 | ---Purpose : Sets active the File Modifier n0 <numod> |
80 | -- Then, it prepares the list of entities to consider, if any |
81 | -- Returns False if <numod> out of range |
82 | |
6e33d3ce |
83 | FileModifier (me) returns GeneralModifier; |
7fd59977 |
84 | ---Purpose : Returns the currently active File Modifier. Cast to be done |
85 | -- Null if not properly set : must be test IsNull after casting |
86 | |
87 | IsForNone (me) returns Boolean; |
88 | ---Purpose : Returns True if no modifier is currently set |
89 | |
90 | IsForAll (me) returns Boolean; |
91 | ---Purpose : Returns True if the current modifier is to be applied to |
92 | -- the whole model. Else, a restricted list of selected entities |
93 | -- is defined, it can be exploited by the File Modifier |
94 | |
95 | NbEntities (me) returns Integer; |
96 | ---Purpose : Returns the total count of selected entities |
97 | |
98 | Start (me : in out); |
99 | ---Purpose : Starts an iteration on selected items. It takes into account |
100 | -- IsForAll/IsForNone, by really iterating on all selected items. |
101 | |
102 | More (me) returns Boolean; |
103 | ---Purpose : Returns True until the iteration has finished |
104 | |
105 | Next (me : in out); |
106 | ---Purpose : Advances the iteration |
107 | |
108 | Value (me) returns Transient raises NoSuchObject; |
109 | ---Purpose : Returns the current selected entity in the model |
110 | |
111 | |
112 | -- -- Trace and Check -- -- |
113 | |
114 | AddCheck (me : in out; check : Check) is static; |
115 | ---Purpose : Adds a Check to the CheckList. If it is empty, nothing is done |
116 | -- If it concerns an Entity from the Model (by SetEntity) |
117 | -- to which another Check is attached, it is merged to it. |
118 | -- Else, it is added or merged as to GlobalCheck. |
119 | |
120 | AddWarning (me : in out; start : Transient; mess : CString; orig : CString = ""); |
121 | ---Purpose : Adds a Warning Message for an Entity from the Model |
122 | -- If <start> is not an Entity from the model (e.g. the |
123 | -- model itself) this message is added to Global Check. |
124 | |
125 | AddFail (me : in out; start : Transient; mess : CString; orig : CString = ""); |
126 | ---Purpose : Adds a Fail Message for an Entity from the Model |
127 | -- If <start> is not an Entity from the model (e.g. the |
128 | -- model itself) this message is added to Global Check. |
129 | |
130 | CCheck (me : in out; num : Integer = 0) returns Check; |
131 | ---Purpose : Returns a Check given an Entity number (in the Model) |
132 | -- by default a Global Check. Creates it the first time. |
133 | -- It can then be acknowledged on the spot, in condition that the |
134 | -- caller works by reference ("Interface_Check& check = ...") |
135 | |
136 | CCheck (me : in out; start : Transient) returns Check; |
137 | ---Purpose : Returns a Check attached to an Entity from the Model |
138 | -- It can then be acknowledged on the spot, in condition that the |
139 | -- caller works by reference ("Interface_Check& check = ...") |
140 | |
141 | CheckList (me) returns CheckIterator is static; |
142 | ---Purpose : Returns the complete CheckList |
143 | |
144 | fields |
145 | |
146 | themodel : InterfaceModel; |
147 | theproto : Protocol; |
148 | thefile : AsciiString; |
149 | theapply : AppliedModifiers; |
150 | thehgraf : HGraph; |
151 | thecheck : CheckIterator; |
152 | thenumod : Integer; |
153 | thenbent : Integer; |
154 | thecurr : Integer; |
155 | themodif : GeneralModifier; |
156 | |
157 | end ContextWrite; |