Home | History | Annotate | Download | only in samples

Lines Matching refs:Queue

40 // Queue is a simple queue implemented as a singled-linked list.
44 class Queue;
46 // QueueNode is a node in a Queue, which consists of an element of
50 friend class Queue<E>;
56 // Gets the next node in the queue.
74 class Queue {
77 // Creates an empty queue.
78 Queue() : head_(NULL), last_(NULL), size_(0) {}
80 // D'tor. Clears the queue.
81 ~Queue() { Clear(); }
83 // Clears the queue.
105 // Gets the first element of the queue, or NULL if the queue is empty.
109 // Gets the last element of the queue, or NULL if the queue is empty.
113 // Adds an element to the end of the queue. A copy of the element is
114 // created using the copy constructor, and then stored in the queue.
115 // Changes made to the element in the queue doesn't affect the source
130 // Removes the head of the queue and returns it. Returns NULL if
131 // the queue is empty.
150 // Applies a function/functor on each element of the queue, and
151 // returns the result in a new queue. The original queue is not
154 Queue * Map(F function) const {
155 Queue * new_queue = new Queue();
164 QueueNode<E> * head_; // The first node of the queue.
165 QueueNode<E> * last_; // The last node of the queue.
166 size_t size_; // The number of elements in the queue.
168 // We disallow copying a queue.
169 Queue(const Queue &);
170 const Queue & operator = (const Queue &);