00001 #ifndef _CTBsimpleList_HXX 00002 #define _CTBsimpleList_HXX 1 00003 00008 /*----------------------------------------------------------------------------*/ 00009 /* C Tool Box: Designed and implemented by: */ 00010 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00011 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00012 /* Email: W.F.J.Mueller@gsi.de */ 00013 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00014 /*------------------------------------------+---------------------------------*/ 00015 00016 template <class TC> 00017 class CTBsimpleListHead; 00018 00019 template <class TC> 00020 class CTBsimpleListLink { 00021 00022 public: 00023 00024 CTBsimpleListLink(); 00025 ~CTBsimpleListLink(); 00026 00027 CTBsimpleListHead<TC>* Head() const; 00028 TC* Prev() const; 00029 TC* Next() const; 00030 00031 void InsertHead(TC* p_this, 00032 CTBsimpleListLink<TC> TC::* o_link, 00033 CTBsimpleListHead<TC>& head); 00034 void InsertTail(TC* p_this, 00035 CTBsimpleListLink<TC> TC::* o_link, 00036 CTBsimpleListHead<TC>& head); 00037 00038 void InsertBefore(TC* p_this, 00039 CTBsimpleListLink<TC> TC::* o_link, 00040 TC& elem); 00041 void InsertAfter(TC* p_this, 00042 CTBsimpleListLink<TC> TC::* o_link, 00043 TC& elem); 00044 00045 void Remove(CTBsimpleListLink<TC> TC::* o_link); 00046 00047 bool operator! () const; 00048 00049 operator bool() const; 00050 00051 private: 00052 00053 CTBsimpleListLink( // copy constructor DUMMY 00054 const CTBsimpleListLink<TC>& rhs); 00055 CTBsimpleListLink<TC>& operator=( // assignment operator DUMMY 00056 const CTBsimpleListLink<TC>& rhs); 00057 00058 private: 00059 00060 CTBsimpleListHead<TC>* mp_head; 00061 TC* mp_prev; 00062 TC* mp_next; 00063 }; 00064 00065 //------------------------------------------+----------------------------------- 00066 template <class TC> 00067 class CTBsimpleListHead { 00068 00069 friend class CTBsimpleListLink<TC>; 00070 00071 public: 00072 00073 CTBsimpleListHead(); 00074 ~CTBsimpleListHead(); 00075 00076 TC* First() const; 00077 TC* Last() const; 00078 00079 bool operator! () const; 00080 00081 operator bool() const; 00082 00083 private: 00084 00085 CTBsimpleListHead( // copy constructor DUMMY 00086 const CTBsimpleListHead<TC>& rhs); 00087 CTBsimpleListHead<TC>& operator=( // assignment operator DUMMY 00088 const CTBsimpleListHead<TC>& rhs); 00089 00090 private: 00091 00092 TC* mp_first; 00093 TC* mp_last; 00094 }; 00095 00096 // implementation is all inline !! 00097 #include "CTBsimpleList.icc" 00098 00099 #endif 00100 00101 00102 00103 00104 00105