1 -- Created on: 1993-01-18
2 -- Created by: Remi LEQUETTE
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 generic class Queue from TCollection (Item as any)
19 ---Purpose: A queue is a structure where Items are added at
20 -- the end and removed from the front. The first
21 -- entered Item will be the first removed. This is
22 -- called a FIFO (First In First Out).
23 -- Queue is a generic class, which depends on Item, the
24 -- type of element in the structure.
26 NoSuchObject from Standard
28 class QueueNode from TCollection
29 inherits MapNode from TCollection
30 uses MapNodePtr from TCollection
32 Create(I : Item; n : MapNodePtr from TCollection) returns QueueNode from TCollection;
35 Value(me) returns Item;
44 Create returns Queue from TCollection;
45 ---Purpose: Creates an empty Queue.
47 Create(Other : Queue from TCollection)
48 returns Queue from TCollection
49 ---Purpose: Constructs an empty queue.
51 -- - the function Push to insert an item at the end of the queue,
52 -- - the function Front to read the item at the front of the queue,
53 -- - the function Pop to remove the item at the front of the queue.
55 -- To copy a queue, you must explicitly call the assignment
56 -- operator (operator=). A copy operation is an expensive operation it is
57 -- incorrect to do it implicitly. This constructor is private and
58 -- will raise a warning if the Queue is not empty.
59 -- To copy the content of a Queue use the Assign method (operator =).
62 Assign(me : in out; Other : Queue from TCollection)
63 returns Queue from TCollection
64 ---Purpose: Copies in this Queue the content of <Other>.
65 -- If this queue is not empty, it is automatically cleared before the copy
66 ---C++: alias operator =
67 ---C++: return const &
70 Length(me) returns Integer
71 ---Purpose: Returns the length of the queue.
79 IsEmpty(me) returns Boolean
80 ---Purpose: Returns True if the queue is empty.
81 -- i.e. Length() == 0.
85 Front(me) returns any Item
86 ---Purpose: returns the item at the front of the queue
94 -- Trigger: Raises an exception if <me> is Empty
95 ---C++: return const &
96 raises NoSuchObject from Standard
101 ---Purpose: remove all the elements from the queue
110 Push(me : in out; T : Item)
111 ---Purpose: Insert an item at the end of the queue.
114 -- me = (A B) , T = C
120 ---Purpose: Removes the item at the front of the queue.
126 -- Trigger: Raises an exception if <me> is empty.
127 raises NoSuchObject from Standard
130 ChangeFront(me: in out) returns any Item
131 ---Purpose: Returns a modifiable reference on the front of the queue.
132 -- The purpose of this syntax is to modify the item at the front of this queue.
136 -- me.ChangeFront() = D
139 -- Trigger: Raises an exception if <me> is empty.
141 raises NoSuchObject from Standard
145 myFront : Address from Standard;
146 myEnd : Address from Standard;
147 myLength : Integer from Standard;