dlist.h

Go to the documentation of this file.
00001 
00045 #ifndef ABA_DLIST_H
00046 #define ABA_DLIST_H
00047 #include <iostream>
00048 using namespace std;
00049 
00050 #include "abacus/abacusroot.h"
00051 #include "abacus/global.h"
00052 #include "abacus/dlistitem.h"
00053 
00054 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX
00055 template<class Type>
00056 class  ABA_DLIST;
00057 
00058 template<class Type>
00059 ostream &operator<< (ostream&, const ABA_DLIST<Type> &list);
00060 #endif
00061 
00062   template<class Type> class  ABA_DLIST :  public ABA_ABACUSROOT  {
00063     public:
00064 
00069       ABA_DLIST(ABA_GLOBAL *glob);
00070 
00073       ~ABA_DLIST();
00074 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX
00075 
00083       friend ostream& operator<< <> (ostream&, const ABA_DLIST<Type> &);
00084 #else
00085 
00093       friend ostream& operator<< (ostream&, const ABA_DLIST<Type> &list);
00094 #endif
00095 
00100       void append(const Type &elem);
00101 
00110       int extractHead(Type &elem);
00111 
00118       int removeHead();
00119 
00122       void remove(const Type &elem);
00123 
00132       void remove(ABA_DLISTITEM<Type> *item);
00133 
00136       ABA_DLISTITEM<Type>* first() const;
00137 
00140       ABA_DLISTITEM<Type>* last() const;
00141 
00145       bool empty() const;
00146 
00155       int firstElem(Type& elem) const;
00156 
00157    private:
00158 
00159 
00162      ABA_GLOBAL    *glob_;
00163 
00166      ABA_DLISTITEM<Type> *first_;
00167 
00170      ABA_DLISTITEM<Type> *last_;
00171 
00172      ABA_DLIST(const ABA_DLIST &rhs);
00173      const ABA_DLIST<Type>& operator=(const ABA_DLIST<Type>& rhs);
00174   };
00175 
00176 #include "abacus/dlist.inc"
00177 
00179 
00192 #define forAllDListElem(L, item, e) \
00193   for((item = (L).first()) ? (e = (item)->elem()) : 0; item !=0; \
00194     (item = (item)->succ()) ? (e = (item)->elem()) : 0)
00195 
00196 #endif  // ABA_DLIST_H
00197 

Generated on Tue Aug 14 18:09:53 2007 for ABACUS by  doxygen 1.5.1