Source Code (Use browser search to find items of interest.)
Class Index
ksokoban'Queue (./kdegames/ksokoban/Queue.H:26)
class Queue {
private:
Type *queue_;
int size_, head_, tail_;
public:
void clear () { head_ = tail_ = 0; }
bool empty () { return head_ == tail_; }
bool full () { return (head_-tail_+size_)%size_ == 1; }
Queue (int _capacity) {
queue_ = new Type[size_ = _capacity+1];
clear ();
}
~Queue () { delete [] queue_; }
void enqueue (Type _x) {
assert (!full ());
queue_[tail_++] = _x;
if (tail_ >= size_) tail_ = 0;
}
Type dequeue () {
assert (!empty ());
Type x = queue_[head_++];
if (head_ >= size_) head_ = 0;
return x;
}
};
ksokoban'Queue::dequeue() (./kdegames/ksokoban/Queue.H:48)
Type dequeue () {
assert (!empty ());
Type x = queue_[head_++];
if (head_ >= size_) head_ = 0;
return x;
}
};