1 /* $XConsortium: IQueue.h /main/1 1996/07/29 16:53:51 cde-hp $ */
2 // Copyright (c) 1994 James Clark
3 // See the file COPYING for copying permission.
5 #ifndef IQueue_INCLUDED
6 #define IQueue_INCLUDED 1
12 namespace SP_NAMESPACE {
17 IQueueBase() : last_(0) { }
19 Boolean empty() const { return last_ == 0; }
21 Link *tem = last_->next_;
25 last_->next_ = tem->next_;
28 void append(Link *p) {
30 p->next_ = last_->next_;
31 last_ = last_->next_ = p;
36 void swap(IQueueBase &with) {
47 class IQueue : private IQueueBase {
50 ~IQueue() { clear(); }
52 T *get() { return (T *)IQueueBase::get(); }
53 void append(T *p) { IQueueBase::append(p); }
54 Boolean empty() const { return IQueueBase::empty(); }
55 void swap(IQueue<T> &to) { IQueueBase::swap(to); }
62 #endif /* not IQueue_INCLUDED */
64 #ifdef SP_DEFINE_TEMPLATES