42cf5bc1 |
1 | // Created on: 1991-02-26 |
2 | // Created by: Isabelle GRIGNON |
3 | // Copyright (c) 1991-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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 |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Extrema_SeqPOnCOfCCLocFOfLocECC2d_HeaderFile |
18 | #define _Extrema_SeqPOnCOfCCLocFOfLocECC2d_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TCollection_BaseSequence.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | class Standard_NoSuchObject; |
27 | class Standard_OutOfRange; |
28 | class Extrema_POnCurv2d; |
29 | class Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d; |
30 | |
31 | |
32 | |
33 | class Extrema_SeqPOnCOfCCLocFOfLocECC2d : public TCollection_BaseSequence |
34 | { |
35 | public: |
36 | |
37 | DEFINE_STANDARD_ALLOC |
38 | |
39 | |
36b9ff75 |
40 | //! Constructs an empty sequence. |
41 | //! Use: |
42 | //! - the function Append or Prepend to add an item or |
43 | //! a collection of items at the end, or at the beginning of the sequence, |
44 | //! - the function InsertAfter or InsertBefore to add an |
45 | //! item or a collection of items at any position in the sequence, |
46 | //! - operator() or the function SetValue to assign a |
47 | //! new value to an item of the sequence, |
48 | //! - operator() to read an item of the sequence, |
49 | //! - the function Remove to remove an item at any |
50 | //! position in the sequence. |
51 | //! Warning |
52 | //! To copy a sequence, you must explicitly call the |
53 | //! assignment operator (operator=). |
42cf5bc1 |
54 | Extrema_SeqPOnCOfCCLocFOfLocECC2d(); |
55 | |
36b9ff75 |
56 | //! Creation by copy of existing Sequence. |
42cf5bc1 |
57 | Standard_EXPORT Extrema_SeqPOnCOfCCLocFOfLocECC2d(const Extrema_SeqPOnCOfCCLocFOfLocECC2d& Other); |
58 | |
36b9ff75 |
59 | //! Removes all element(s) of the sequence <me> |
60 | //! Example: |
61 | //! before |
62 | //! me = (A B C) |
63 | //! after |
64 | //! me = () |
42cf5bc1 |
65 | Standard_EXPORT void Clear(); |
66 | ~Extrema_SeqPOnCOfCCLocFOfLocECC2d() |
67 | { |
68 | Clear(); |
69 | } |
70 | |
36b9ff75 |
71 | //! Copies the contents of the sequence Other into this sequence. |
72 | //! If this sequence is not empty, it is automatically cleared before the copy. |
42cf5bc1 |
73 | Standard_EXPORT const Extrema_SeqPOnCOfCCLocFOfLocECC2d& Assign (const Extrema_SeqPOnCOfCCLocFOfLocECC2d& Other); |
74 | const Extrema_SeqPOnCOfCCLocFOfLocECC2d& operator = (const Extrema_SeqPOnCOfCCLocFOfLocECC2d& Other) |
75 | { |
76 | return Assign(Other); |
77 | } |
78 | |
36b9ff75 |
79 | //! Appends <T> at the end of <me>. |
80 | //! Example: |
81 | //! before |
82 | //! me = (A B C) |
83 | //! after |
84 | //! me = (A B C T) |
42cf5bc1 |
85 | Standard_EXPORT void Append (const Extrema_POnCurv2d& T); |
86 | |
36b9ff75 |
87 | //! Concatenates <S> at the end of <me>. |
88 | //! <S> is cleared. |
89 | //! Example: |
90 | //! before |
91 | //! me = (A B C) |
92 | //! S = (D E F) |
93 | //! after |
94 | //! me = (A B C D E F) |
95 | //! S = () |
42cf5bc1 |
96 | void Append (Extrema_SeqPOnCOfCCLocFOfLocECC2d& S); |
97 | |
36b9ff75 |
98 | //! Add <T> at the beginning of <me>. |
99 | //! Example: |
100 | //! before |
101 | //! me = (A B C) |
102 | //! after |
103 | //! me = (T A B C ) |
42cf5bc1 |
104 | Standard_EXPORT void Prepend (const Extrema_POnCurv2d& T); |
105 | |
36b9ff75 |
106 | //! Concatenates <S> at the beginning of <me>. |
107 | //! <S> is cleared. |
108 | //! Example: |
109 | //! before |
110 | //! me = (A B C) S = (D E F) |
111 | //! after me = (D E F A B C) |
112 | //! S = () |
42cf5bc1 |
113 | void Prepend (Extrema_SeqPOnCOfCCLocFOfLocECC2d& S); |
114 | |
36b9ff75 |
115 | //! Inserts <T> in <me> before the position <Index>. |
116 | //! Raises an exception if the index is out of bounds. |
117 | //! Example: |
118 | //! before |
119 | //! me = (A B D), Index = 3, T = C |
120 | //! after |
121 | //! me = (A B C D ) |
42cf5bc1 |
122 | void InsertBefore (const Standard_Integer Index, const Extrema_POnCurv2d& T); |
123 | |
36b9ff75 |
124 | //! Inserts the sequence <S> in <me> before |
125 | //! the position <Index>. <S> is cleared. |
126 | //! Raises an exception if the index is out of bounds |
127 | //! Example: |
128 | //! before |
129 | //! me = (A B F), Index = 3, S = (C D E) |
130 | //! after |
131 | //! me = (A B C D E F) |
132 | //! S = () |
42cf5bc1 |
133 | void InsertBefore (const Standard_Integer Index, Extrema_SeqPOnCOfCCLocFOfLocECC2d& S); |
134 | |
36b9ff75 |
135 | //! Inserts <T> in <me> after the position <Index>. |
136 | //! Raises an exception if the index is out of bound |
137 | //! Example: |
138 | //! before |
139 | //! me = (A B C), Index = 3, T = D |
140 | //! after |
141 | //! me = (A B C D) |
42cf5bc1 |
142 | Standard_EXPORT void InsertAfter (const Standard_Integer Index, const Extrema_POnCurv2d& T); |
143 | |
36b9ff75 |
144 | //! Inserts the sequence <S> in <me> after the |
145 | //! position <Index>. <S> is cleared. |
146 | //! Raises an exception if the index is out of bound. |
147 | //! Example: |
148 | //! before |
149 | //! me = (A B C), Index = 3, S = (D E F) |
150 | //! after |
151 | //! me = (A B C D E F) |
152 | //! S = () |
42cf5bc1 |
153 | void InsertAfter (const Standard_Integer Index, Extrema_SeqPOnCOfCCLocFOfLocECC2d& S); |
154 | |
36b9ff75 |
155 | //! Returns the first element of the sequence <me> |
156 | //! Raises an exception if the sequence is empty. |
157 | //! Example: |
158 | //! before |
159 | //! me = (A B C) |
160 | //! after |
161 | //! me = (A B C) |
162 | //! returns A |
42cf5bc1 |
163 | Standard_EXPORT const Extrema_POnCurv2d& First() const; |
164 | |
36b9ff75 |
165 | //! Returns the last element of the sequence <me> |
166 | //! Raises an exception if the sequence is empty. |
167 | //! Example: |
168 | //! before |
169 | //! me = (A B C) |
170 | //! after |
171 | //! me = (A B C) |
172 | //! returns C |
42cf5bc1 |
173 | Standard_EXPORT const Extrema_POnCurv2d& Last() const; |
174 | |
36b9ff75 |
175 | //! Keeps in <me> the items 1 to <Index>-1 and |
176 | //! puts in <Sub> the items <Index> to the end. |
177 | //! Example: |
178 | //! before |
179 | //! me = (A B C D) ,Index = 3 |
180 | //! after |
181 | //! me = (A B) |
182 | //! Sub = (C D) |
42cf5bc1 |
183 | void Split (const Standard_Integer Index, Extrema_SeqPOnCOfCCLocFOfLocECC2d& Sub); |
184 | |
36b9ff75 |
185 | //! Returns the Item at position <Index> in <me>. |
186 | //! Raises an exception if the index is out of bound |
187 | //! Example: |
188 | //! before |
189 | //! me = (A B C), Index = 1 |
190 | //! after |
191 | //! me = (A B C) |
192 | //! returns |
193 | //! A |
42cf5bc1 |
194 | Standard_EXPORT const Extrema_POnCurv2d& Value (const Standard_Integer Index) const; |
195 | const Extrema_POnCurv2d& operator() (const Standard_Integer Index) const |
196 | { |
197 | return Value(Index); |
198 | } |
199 | |
36b9ff75 |
200 | //! Changes the item at position <Index> |
201 | //! Raises an exception if the index is out of bound |
202 | //! Example: |
203 | //! before |
204 | //! me = (A B C), Index = 1, Item = D |
205 | //! after |
206 | //! me = (D B C) |
42cf5bc1 |
207 | Standard_EXPORT void SetValue (const Standard_Integer Index, const Extrema_POnCurv2d& I); |
208 | |
36b9ff75 |
209 | //! Returns the Item at position <Index> in |
210 | //! <me>. This method may be used to modify |
211 | //! <me> : S.Value(Index) = Item. |
212 | //! Raises an exception if the index is out of bound |
213 | //! Example: |
214 | //! before |
215 | //! me = (A B C), Index = 1 |
216 | //! after |
217 | //! me = (A B C) |
218 | //! returns |
219 | //! A |
42cf5bc1 |
220 | Standard_EXPORT Extrema_POnCurv2d& ChangeValue (const Standard_Integer Index); |
221 | Extrema_POnCurv2d& operator() (const Standard_Integer Index) |
222 | { |
223 | return ChangeValue(Index); |
224 | } |
225 | |
36b9ff75 |
226 | //! Removes from <me> the item at position <Index>. |
227 | //! Raises an exception if the index is out of bounds |
228 | //! Example: |
229 | //! before |
230 | //! me = (A B C), Index = 3 |
231 | //! after |
232 | //! me = (A B) |
42cf5bc1 |
233 | Standard_EXPORT void Remove (const Standard_Integer Index); |
234 | |
36b9ff75 |
235 | //! Removes from <me> all the items of |
236 | //! positions between <FromIndex> and <ToIndex>. |
237 | //! Raises an exception if the indices are out of bounds. |
238 | //! Example: |
239 | //! before |
240 | //! me = (A B C D E F), FromIndex = 1 ToIndex = 3 |
241 | //! after |
242 | //! me = (D E F) |
42cf5bc1 |
243 | Standard_EXPORT void Remove (const Standard_Integer FromIndex, const Standard_Integer ToIndex); |
244 | |
245 | |
246 | |
247 | |
248 | protected: |
249 | |
250 | |
251 | |
252 | |
253 | |
254 | private: |
255 | |
256 | |
257 | |
258 | |
259 | |
260 | }; |
261 | |
262 | #define SeqItem Extrema_POnCurv2d |
263 | #define SeqItem_hxx <Extrema_POnCurv2d.hxx> |
264 | #define TCollection_SequenceNode Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d |
265 | #define TCollection_SequenceNode_hxx <Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d.hxx> |
266 | #define Handle_TCollection_SequenceNode Handle(Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d) |
267 | #define TCollection_Sequence Extrema_SeqPOnCOfCCLocFOfLocECC2d |
268 | #define TCollection_Sequence_hxx <Extrema_SeqPOnCOfCCLocFOfLocECC2d.hxx> |
269 | |
270 | #include <TCollection_Sequence.lxx> |
271 | |
272 | #undef SeqItem |
273 | #undef SeqItem_hxx |
274 | #undef TCollection_SequenceNode |
275 | #undef TCollection_SequenceNode_hxx |
276 | #undef Handle_TCollection_SequenceNode |
277 | #undef TCollection_Sequence |
278 | #undef TCollection_Sequence_hxx |
279 | |
280 | |
281 | |
282 | |
283 | #endif // _Extrema_SeqPOnCOfCCLocFOfLocECC2d_HeaderFile |