b311480e |
1 | -- Created on: 1993-02-26 |
2 | -- Created by: Remi LEQUETTE |
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 | |
bd2de396 |
17 | private class SListOfItemLocation from TopLoc |
7fd59977 |
18 | |
bd2de396 |
19 | ---Purpose: An SListOfItemLocation is a LISP like list of Items. |
20 | -- An SListOfItemLocation is : |
7fd59977 |
21 | -- . Empty. |
bd2de396 |
22 | -- . Or it has a Value and a Tail which is an other SListOfItemLocation. |
7fd59977 |
23 | -- |
24 | -- The Tail of an empty list is an empty list. |
bd2de396 |
25 | -- SListOfItemLocation are shared. It means that they can be |
7fd59977 |
26 | -- modified through other lists. |
bd2de396 |
27 | -- SListOfItemLocation may be used as Iterators. They have Next, |
7fd59977 |
28 | -- More, and value methods. To iterate on the content |
29 | -- of the list S just do. |
30 | -- |
bd2de396 |
31 | -- SListOfItemLocation Iterator; |
7fd59977 |
32 | -- for (Iterator = S; Iterator.More(); Iterator.Next()) |
33 | -- X = Iterator.Value(); |
34 | -- |
bd2de396 |
35 | -- Memory usage is automatically managed for SListOfItemLocations |
7fd59977 |
36 | -- (using reference counts). |
37 | ---Example: |
bd2de396 |
38 | -- If S1 and S2 are SListOfItemLocations : |
7fd59977 |
39 | -- if S1.Value() is X. |
40 | -- |
41 | -- And the following is done : |
42 | -- S2 = S1; |
43 | -- S2.SetValue(Y); |
44 | -- |
bd2de396 |
45 | -- S1.Value() becomes also Y. So SListOfItemLocation must be used |
7fd59977 |
46 | -- with care. Mainly the SetValue() method is |
47 | -- dangerous. |
48 | |
bd2de396 |
49 | uses |
50 | SListNodeOfItemLocation from TopLoc, |
51 | ItemLocation from TopLoc |
52 | |
7fd59977 |
53 | raises |
54 | NoSuchObject from Standard |
7fd59977 |
55 | |
56 | is |
bd2de396 |
57 | Create returns SListOfItemLocation from TopLoc; |
7fd59977 |
58 | ---Purpose: Creates an empty List. |
59 | |
bd2de396 |
60 | Create(anItem : ItemLocation from TopLoc; aTail : SListOfItemLocation from TopLoc) |
61 | returns SListOfItemLocation from TopLoc; |
7fd59977 |
62 | ---Purpose: Creates a List with <anItem> as value and <aTail> as tail. |
63 | |
bd2de396 |
64 | Create(Other : SListOfItemLocation from TopLoc) |
65 | returns SListOfItemLocation from TopLoc; |
7fd59977 |
66 | ---Purpose: Creates a list from an other one. The lists are shared. |
67 | |
bd2de396 |
68 | Assign(me : in out; Other : SListOfItemLocation from TopLoc) |
69 | returns SListOfItemLocation from TopLoc |
7fd59977 |
70 | ---Level: Public |
71 | ---Purpose: Sets a list from an other one. The lists are |
72 | -- shared. The list itself is returned. |
73 | ---C++: alias operator = |
74 | ---C++: return & |
75 | is static; |
76 | |
77 | IsEmpty(me) returns Boolean |
78 | ---Level: Public |
79 | ---C++: inline |
80 | is static; |
81 | |
82 | Clear(me : in out) |
83 | ---Level: Public |
84 | ---Purpose: Sets the list to be empty. |
85 | ---C++: alias ~ |
86 | is static; |
87 | |
bd2de396 |
88 | Value(me) returns any ItemLocation from TopLoc |
7fd59977 |
89 | ---Level: Public |
90 | ---Purpose: Returns the current value of the list. An error is |
91 | -- raised if the list is empty. |
92 | ---C++: return const & |
93 | raises |
94 | NoSuchObject from Standard |
95 | is static; |
96 | |
bd2de396 |
97 | ChangeValue(me : in out) returns any ItemLocation from TopLoc |
7fd59977 |
98 | ---Level: Public |
99 | ---Purpose: Returns the current value of the list. An error is |
100 | -- raised if the list is empty. This value may be |
101 | -- modified. A method modifying the value can be |
102 | -- called. The value will be modified in the list. |
103 | ---Example: AList.ChangeValue().Modify() |
104 | ---C++: return & |
105 | raises |
106 | NoSuchObject from Standard |
107 | is static; |
108 | |
bd2de396 |
109 | SetValue(me : in out; anItem : ItemLocation from TopLoc) |
7fd59977 |
110 | ---Level: Public |
111 | ---Purpose: Changes the current value in the list. An error is |
112 | -- raised if the list is empty. |
113 | raises |
114 | NoSuchObject from Standard |
115 | is static; |
116 | |
bd2de396 |
117 | Tail(me) returns SListOfItemLocation from TopLoc |
7fd59977 |
118 | ---Level: Public |
119 | ---Purpose: Returns the current tail of the list. On an empty |
120 | -- list the tail is the list itself. |
121 | ---C++: return const & |
122 | is static; |
123 | |
bd2de396 |
124 | ChangeTail(me : in out) returns SListOfItemLocation from TopLoc |
7fd59977 |
125 | ---Level: Public |
126 | ---Purpose: Returns the current tail of the list. This tail |
127 | -- may be modified. A method modifying the tail can |
128 | -- be called. The tail will be modified in the list. |
129 | ---Example: AList.ChangeTail().Modify() |
130 | ---C++: return & |
131 | is static; |
132 | |
bd2de396 |
133 | SetTail(me : in out; aList : SListOfItemLocation from TopLoc) |
7fd59977 |
134 | ---Level: Public |
135 | ---Purpose: Changes the current tail in the list. On an empty |
136 | -- list SetTail is Assign. |
137 | is static; |
138 | |
bd2de396 |
139 | Construct(me : in out; anItem : ItemLocation from TopLoc) |
7fd59977 |
140 | ---Level: Public |
141 | ---Purpose: Replaces the list by a list with <anItem> as Value |
142 | -- and the list <me> as tail. |
143 | ---C++: inline |
144 | is static; |
145 | |
bd2de396 |
146 | Constructed(me; anItem : ItemLocation from TopLoc) returns SListOfItemLocation from TopLoc |
7fd59977 |
147 | ---Level: Public |
148 | ---Purpose: Returns a new list with <anItem> as Value an the |
149 | -- list <me> as tail. |
150 | ---C++: inline |
151 | is static; |
152 | |
153 | ToTail(me : in out) |
154 | ---Level: Public |
155 | ---Purpose: Replaces the list <me> by its tail. |
156 | ---C++: inline |
157 | is static; |
158 | |
bd2de396 |
159 | Initialize(me : in out; aList : SListOfItemLocation from TopLoc) |
7fd59977 |
160 | ---Level: Public |
161 | ---Purpose: Sets the iterator to iterate on the content of |
162 | -- <aList>. This is Assign(). |
163 | ---C++: inline |
164 | is static; |
165 | |
166 | More(me) returns Boolean |
167 | ---Level: Public |
168 | ---Purpose: Returns True if the iterator has a current value. |
169 | -- This is !IsEmpty() |
170 | ---C++: inline |
171 | is static; |
172 | |
173 | Next(me : in out) |
174 | ---Level: Public |
175 | ---Purpose: Moves the iterator to the next object in the list. |
176 | -- If the iterator is empty it will stay empty. This is ToTail() |
177 | ---C++: inline |
178 | is static; |
179 | |
180 | fields |
bd2de396 |
181 | myNode : SListNodeOfItemLocation from TopLoc; |
7fd59977 |
182 | |
bd2de396 |
183 | end SListOfItemLocation; |