template<class T>
void fifo<T>::insert(const T *d)
{
struct queue *q;
#ifdef CONSIST_CHECK
if (end==NULL)
{
cerr<<"Oops! end of list is NULL\n";
exit(1);
}
#endif
q=new(struct queue);
q->next=start;
q->data=d;
start=q;
if (q->next==NULL)
end=&(q->next);
length++;
}
template<class T>
const T *fifo<T>::dequeue(void)
{
const T *d;
struct queue *q;
#ifdef CONSIST_CHECK
if (end==NULL)
{
cerr<<"Oops! end of list is NULL\n";
exit(1);
}
#endif
template <class T>
void fifo<T>::transfer(fifo<T> *d)
{
#ifdef CONSIST_CHECK
if (end==NULL || d->end==NULL)
{
cerr<<"Oops! end of list is NULL\n";
exit(1);
}
#endif
template<class T>
void fifo<T>::ins_trans(fifo<T> *d)
{
#ifdef CONSIST_CHECK
if (end==NULL || d->end==NULL)
{
cerr<<"Oops! end of list is NULL\n";
exit(1);
}
#endif
if (d==NULL || d->length==0)
return;
*(d->end)=start;
start=d->start;
if (*(d->end)==NULL)
end=d->end;
length+=d->length;
d->length=0;
d->start=NULL;
d->end=&(d->start);
}
template<class T>
void fifo<T>::rev(void)
{
struct queue *p, *n, *hdr, **ep;
#ifdef CONSIST_CHECK
if (end==NULL || d->end==NULL)
{
cerr<<"Oops! end of list is NULL\n";
exit(1);
}
#endif