//================================================================= #include #include #include #include #include #include //================================================================= //================================================================= // CLASS NODES //================================================================= using namespace std; class Alist { int cname; int debug; //------------------------------------------------ public: Alist *prev, *next, *first, *curr, *last; ~Alist() { if(first->debug) cout << " Destructor !!! name="<debug=level; } void insert(Alist* p) { p->first=first; p->next = next; p->prev = this; if(first->debug) cout <<" insert: "<cname<<" after "<debug) printf(" ins: p=%p \n",p); if (next) next->prev = p; else { if(first->debug) cout<< "*** Error Insert, Append !!! \n"; first->last=p; } next = p; } void append(Alist* p) { p->first=first; p->next = last->next; p->prev = last; if(first->debug) cout <<" append: "<cname<<" after "<cname<<'\n'; if (last->next) { if(first->debug) cout << "*** Error Append, Insert !!! \n"; last->next->prev = p; } last->next = p; last=p; } Alist* GoHome() { first->curr=first; return first; } Alist* GetNext() { if (first->curr) first->curr=curr->next; else first->curr=first->next; // else go home return first->curr; } void remove() { if(first->debug) cout <<"*** Remove node="<prev=prev; else first->last=prev; // last ? prev->next=next; if (first->curr==this) first->curr=prev; delete this; // prev=0; next=0; first=this; last=this; } void print() { cout << " print: Alist Name="<debug) { cout <<"Create new Alist: "<