Home | History | Annotate | Download | only in samples

Lines Matching defs: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 {
76 // Creates an empty queue.
77 Queue() : head_(NULL), last_(NULL), size_(0) {}
79 // D'tor. Clears the queue.
80 ~Queue() { Clear(); }
82 // Clears the queue.
104 // Gets the first element of the queue, or NULL if the queue is empty.
108 // Gets the last element of the queue, or NULL if the queue is empty.
112 // Adds an element to the end of the queue. A copy of the element is
113 // created using the copy constructor, and then stored in the queue.
114 // Changes made to the element in the queue doesn't affect the source
129 // Removes the head of the queue and returns it. Returns NULL if
130 // the queue is empty.
149 // Applies a function/functor on each element of the queue, and
150 // returns the result in a new queue. The original queue is not
153 Queue* Map(F function) const {
154 Queue* new_queue = new Queue();
163 QueueNode<E>* head_; // The first node of the queue.
164 QueueNode<E>* last_; // The last node of the queue.
165 size_t size_; // The number of elements in the queue.
167 // We disallow copying a queue.
168 Queue(const Queue&);
169 const Queue& operator = (const Queue&);