0024742: Remove rarely used collection classes
[occt.git] / src / TCollection / TCollection_Queue.cdl
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
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 generic class Queue from TCollection (Item as any)
18
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.
25 raises
26     NoSuchObject from Standard
27
28         class QueueNode from TCollection 
29             inherits MapNode from TCollection
30             uses MapNodePtr from TCollection
31             is
32               Create(I : Item; n : MapNodePtr from TCollection) returns QueueNode from TCollection;
33               ---C++: inline
34       
35               Value(me) returns Item;
36               ---C++: return &
37               ---C++: inline
38
39          fields  
40               myValue : Item;
41          end;
42         
43 is
44     Create returns Queue from TCollection;
45        ---Purpose: Creates an empty Queue.
46
47     Create(Other : Queue from TCollection)
48     returns Queue from TCollection
49         ---Purpose: Constructs an empty queue.
50         -- Use:
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.
54         --   Warning
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 =).
60     is private;
61     
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 &
68     is static;
69     
70     Length(me) returns Integer
71         ---Purpose: Returns the length of the queue.
72         -- Example:          
73         -- before
74         --   me = (A B C) 
75         -- returns 3
76         ---C++: inline
77     is static;
78     
79     IsEmpty(me) returns Boolean
80         ---Purpose: Returns True if  the queue is empty. 
81         -- i.e. Length() == 0.
82         ---C++: inline
83     is static;
84     
85     Front(me) returns any Item 
86         ---Purpose: returns the item at the front of the queue
87         -- Example:
88         -- before
89         --   me = (A B C) 
90         -- after
91         --   me = (A B C)
92         -- returns 
93         --   A
94         -- Trigger: Raises an exception if <me> is Empty
95         ---C++: return const &
96     raises NoSuchObject from Standard
97     is static;
98     
99         
100     Clear(me : in out)
101        ---Purpose: remove all the elements from the queue
102        -- Example:
103        -- before
104        --   me = (A B C) 
105        -- after
106        --   me = ()
107        ---C++: alias ~
108     is static;
109
110     Push(me : in out; T : Item)
111        ---Purpose: Insert an item at the end of the queue.
112        -- Example:
113        -- before
114        --   me = (A B) , T = C
115        -- after
116        --   me = (A B C)
117     is static;
118
119     Pop(me : in out) 
120        ---Purpose: Removes the item at the front of the queue.
121        -- Example:
122        -- before
123        --   me = (A B C)
124        -- after
125        --   me = (B C)
126        -- Trigger: Raises an exception if <me> is empty.
127     raises NoSuchObject from Standard  
128     is static;
129  
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. 
133        -- Example:
134        -- before
135        --   me = (A B C)
136        --   me.ChangeFront() = D
137        -- after
138        --   me = (D B C)
139        -- Trigger: Raises an exception if <me> is empty.
140        ---C++: return &
141     raises NoSuchObject from Standard
142     is static;
143
144 fields
145     myFront  : Address from Standard;
146     myEnd    : Address from Standard;
147     myLength : Integer from Standard;
148
149 end Queue;
150
151