7fd59977 |
1 | -- File: IFSelect_TransformStandard.cdl |
2 | -- Created: Fri May 27 17:13:48 1994 |
3 | -- Author: Christian CAILLET |
4 | -- <cky@bravox> |
5 | ---Copyright: Matra Datavision 1994 |
6 | |
7 | |
8 | class TransformStandard from IFSelect inherits Transformer |
9 | |
10 | ---Purpose : This class runs transformations made by Modifiers, as |
11 | -- the ModelCopier does when it produces files (the same set |
12 | -- of Modifiers can then be used, as to transform the starting |
13 | -- Model, as at file sending time). |
14 | -- |
15 | -- First, considering the resulting model, two options : |
16 | -- - modifications are made directly on the starting model |
17 | -- (OnTheSpot option), or |
18 | -- - data are copied by the standard service Copy, only the |
19 | -- remaining (not yet sent in a file) entities are copied |
20 | -- (StandardCopy option) |
21 | -- |
22 | -- If a Selection is set, it forces the list of Entities on which |
23 | -- the Modifiers are applied. Else, each Modifier is considered |
24 | -- its Selection. By default, it is for the whole Model |
25 | -- |
26 | -- Then, the Modifiers are sequentially applied |
27 | -- If at least one Modifier "May Change Graph", or if the option |
28 | -- StandardCopy is selected, the graph will be recomputed |
29 | -- (by the WorkSession, see method RunTransformer) |
30 | -- |
31 | -- Remark that a TransformStandard with option StandardCopy |
32 | -- and no Modifier at all has the effect of computing the |
33 | -- remaining data (those not yet sent in any output file). |
34 | -- Moreover, the Protocol is not changed |
35 | |
36 | uses AsciiString from TCollection, |
37 | CheckIterator, Graph, Protocol from Interface, InterfaceModel, |
38 | CopyTool, CopyControl, |
39 | Selection, Modifier, SequenceOfGeneralModifier |
40 | |
41 | |
42 | is |
43 | |
44 | Create returns mutable TransformStandard; |
45 | ---Purpose : Creates a TransformStandard, option StandardCopy, no Modifier |
46 | |
47 | -- Description -- |
48 | |
49 | SetCopyOption (me : mutable; option : Boolean); |
50 | ---Purpose : Sets the Copy option to a new value : |
51 | -- - True for StandardCopy - False for OnTheSpot |
52 | |
53 | CopyOption (me) returns Boolean; |
54 | ---Purpose : Returns the Copy option |
55 | |
56 | SetSelection (me : mutable; sel : Selection); |
57 | ---Purpose : Sets a Selection (or unsets if Null) |
58 | -- This Selection then defines the list of entities on which the |
59 | -- Modifiers will be applied |
60 | -- If it is set, it has priority on Selections of Modifiers |
61 | -- Else, for each Modifier its Selection is evaluated |
62 | -- By default, all the Model is taken |
63 | |
64 | Selection (me) returns Selection; |
65 | ---Purpose : Returns the Selection, Null by default |
66 | |
67 | NbModifiers (me) returns Integer; |
68 | ---Purpose : Returns the count of recorded Modifiers |
69 | |
70 | Modifier (me; num : Integer) returns mutable Modifier; |
71 | ---Purpose : Returns a Modifier given its rank in the list |
72 | |
73 | ModifierRank (me; modif : Modifier) returns Integer; |
74 | ---Purpose : Returns the rank of a Modifier in the list, 0 if unknown |
75 | |
76 | AddModifier (me : mutable; modif : mutable Modifier; atnum : Integer = 0) |
77 | returns Boolean; |
78 | ---Purpose : Adds a Modifier to the list : |
79 | -- - <atnum> = 0 (default) : at the end of the list |
80 | -- - <atnum> > 0 : at rank <atnum> |
81 | -- Returns True if done, False if <atnum> is out of range |
82 | |
83 | RemoveModifier (me : mutable; modif : Modifier) returns Boolean; |
84 | ---Purpose : Removes a Modifier from the list |
85 | -- Returns True if done, False if <modif> not in the list |
86 | |
87 | RemoveModifier (me : mutable; num : Integer) returns Boolean; |
88 | ---Purpose : Removes a Modifier from the list, given its rank |
89 | -- Returns True if done, False if <num> is out of range |
90 | |
91 | -- Action -- |
92 | |
93 | Perform (me : mutable; G : Graph; protocol : Protocol from Interface; |
94 | checks : in out CheckIterator; |
95 | newmod : out mutable InterfaceModel) returns Boolean; |
96 | ---Purpose : Performs the Standard Transformation, by calling Copy then |
97 | -- ApplyModifiers (which can return an error status) |
98 | |
99 | Copy (me; G : Graph; TC : in out CopyTool; |
100 | newmod : out mutable InterfaceModel); |
101 | ---Purpose : This the first operation. It calls StandardCopy or OnTheSpot |
102 | -- according the option |
103 | |
104 | StandardCopy (me; G : Graph; TC : in out CopyTool; |
105 | newmod : out mutable InterfaceModel); |
106 | ---Purpose : This is the standard action of Copy : its takes into account |
107 | -- only the remaining entities (noted by Graph Status positive) |
108 | -- and their proper dependances of course. Produces a new model. |
109 | |
110 | OnTheSpot (me; G : Graph; TC : in out CopyTool; |
111 | newmod : out mutable InterfaceModel); |
112 | ---Purpose : This is the OnTheSpot action : each entity is bound with ... |
113 | -- itself. The produced model is the same as the starting one. |
114 | |
115 | ApplyModifiers (me; G : Graph; protocol : Protocol from Interface; |
116 | TC : in out CopyTool; checks : in out CheckIterator; |
117 | newmod : out mutable InterfaceModel) returns Boolean; |
118 | ---Purpose : Applies the modifiers sequencially. |
119 | -- For each one, prepares required data (if a Selection is |
120 | -- associated as a filter). |
121 | -- For the option OnTheSpot, it determines if the graph may be |
122 | -- changed and updates <newmod> if required |
123 | -- If a Modifier causes an error (check "HasFailed"), |
124 | -- ApplyModifier stops : the following Modifiers are ignored |
125 | |
126 | Updated (me; entfrom : Transient; entto : out mutable Transient) |
127 | returns Boolean; |
128 | ---Purpose : This methods allows to know what happened to a starting |
129 | -- entity after the last Perform. It reads result from the map |
130 | -- which was filled by Perform. |
131 | |
132 | -- Others -- |
133 | |
134 | Label (me) returns AsciiString from TCollection; |
135 | ---Purpose : Returns a text which defines the way a Transformer works : |
136 | -- "On the spot edition" or "Standard Copy" followed by |
137 | -- "<nn> Modifiers" |
138 | |
139 | fields |
140 | |
141 | thecopy : Boolean; |
142 | thesel : Selection; |
143 | themodifs : SequenceOfGeneralModifier; |
144 | themap : CopyControl; |
145 | |
146 | end TransformStandard; |