b311480e |
1 | -- Created on: 1994-05-27 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1994-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 Transformer from IFSelect inherits TShared |
18 | |
19 | ---Purpose : A Transformer defines the way an InterfaceModel is transformed |
20 | -- (without sending it to a file). |
21 | -- In order to work, each type of Transformer defines it method |
22 | -- Perform, it can be parametred as needed. |
23 | -- |
24 | -- It receives a Model (the data set) as input. It then can : |
25 | -- - edit this Model on the spot (i.e. alter its content : by |
26 | -- editing entities, or adding/replacing some ...) |
27 | -- - produce a copied Model, which detains the needed changes |
28 | -- (typically on the same type, but some or all entities beeing |
29 | -- rebuilt or converted; or converted from a protocol to |
30 | -- another one) |
31 | |
32 | uses AsciiString from TCollection, |
33 | CheckIterator, Graph, Protocol from Interface, InterfaceModel |
34 | |
35 | is |
36 | |
37 | Perform (me : mutable; G : Graph; protocol : Protocol from Interface; |
38 | checks : in out CheckIterator; |
6e33d3ce |
39 | newmod : out InterfaceModel) returns Boolean is deferred; |
7fd59977 |
40 | ---Purpose : Performs a Transformation (defined by each sub-class) : |
41 | -- <G> gives the input data (especially the starting model) and |
42 | -- can be used for queries (by Selections, etc...) |
43 | -- <protocol> allows to work with General Services as necessary |
44 | -- (it applies to input data) |
45 | -- If the change corresponds to a conversion to a new protocol, |
46 | -- see also the method ChangeProtocol |
47 | -- <checks> stores produced checks messages if any |
48 | -- <newmod> gives the result of the transformation : |
49 | -- - if it is Null (i.e. has not been affected), the transformation |
50 | -- has been made on the spot, it is assumed to cause no change |
51 | -- to the graph of dependances |
52 | -- - if it equates the starting Model, it has been transformed on |
53 | -- the spot (possibiliy some entities were replaced inside it) |
54 | -- - if it is new, it corresponds to a new data set which replaces |
55 | -- the starting one |
56 | -- |
57 | -- <me> is mutable to allow results for ChangeProtocol to be |
58 | -- memorized if needed, and to store informations useful for |
59 | -- the method Updated |
60 | -- |
61 | -- Returns True if Done, False if an Error occured : in this case, |
62 | -- if a new data set has been produced, the transformation |
63 | -- is ignored, else data may be corrupted. |
64 | |
65 | ChangeProtocol (me; newproto : in out Protocol from Interface) |
66 | returns Boolean is virtual; |
67 | ---Purpose : This methods allows to declare that the Protocol applied to |
68 | -- the new Model has changed. It applies to the last call to |
69 | -- Perform. |
70 | -- |
71 | -- Returns True if the Protocol has changed, False else. |
72 | -- The provided default keeps the starting Protocol. This method |
73 | -- should be redefined as required by the effect of Perform. |
74 | |
6e33d3ce |
75 | Updated (me; entfrom : Transient; entto : out Transient) |
7fd59977 |
76 | returns Boolean is deferred; |
77 | ---Purpose : This method allows to know what happened to a starting |
78 | -- entity after the last Perform. If <entfrom> (from starting |
79 | -- model) has one and only one known item which corresponds in |
80 | -- the new produced model, this method must return True and |
81 | -- fill the argument <entto>. Else, it returns False. |
82 | |
83 | Label (me) returns AsciiString from TCollection is deferred; |
84 | ---Purpose : Returns a text which defines the way a Transformer works |
85 | -- (to identify the transformation it performs) |
86 | |
87 | end Transformer; |