00001 00006 /*----------------------------------------------------------------------------*/ 00007 /* C Tool Box: Designed and implemented by: */ 00008 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00009 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00010 /* Email: W.F.J.Mueller@gsi.de */ 00011 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00012 /*------------------------------------------+---------------------------------*/ 00013 00024 //------------------------------------------+----------------------------------- 00026 00027 template <class T> 00028 inline CTBstack<T>::CTBstack() 00029 : CTBvector<T>() 00030 {} 00031 00032 //------------------------------------------+----------------------------------- 00034 00035 template <class T> 00036 inline CTBstack<T>::CTBstack(CTBint i_capacity) 00037 : CTBvector<T>() 00038 { 00039 EnsureCapacity(i_capacity); 00040 } 00041 00042 //------------------------------------------+----------------------------------- 00044 00045 template <class T> 00046 inline CTBstack<T>::CTBstack(const CTBstack<T>& rhs) 00047 : CTBvector<T>(rhs) 00048 {} 00049 00050 //------------------------------------------+----------------------------------- 00052 00053 template <class T> 00054 inline CTBstack<T>::CTBstack(CTBstack<T>& rhs, bool b_grab) 00055 : CTBvector<T>(rhs,b_grab) 00056 {} 00057 00058 //------------------------------------------+----------------------------------- 00060 00064 template <class T> 00065 inline T& CTBstack<T>::At(CTBint i_ind) 00066 { 00067 return CTBvector<T>::At(Size()-1-i_ind); 00068 } 00069 00070 //------------------------------------------+----------------------------------- 00072 00076 template <class T> 00077 inline const T& CTBstack<T>::At(CTBint i_ind) const 00078 { 00079 return CTBvector<T>::At(Size()-1-i_ind); 00080 } 00081 00082 //------------------------------------------+----------------------------------- 00084 00090 template <class T> 00091 inline void CTBstack<T>::Resize(CTBint i_size) 00092 { 00093 CTBvector<T>::Resize(i_size); 00094 return; 00095 } 00096 00097 //------------------------------------------+----------------------------------- 00099 00105 template <class T> 00106 inline void CTBstack<T>::Resize(CTBint i_size, const T& def) 00107 { 00108 CTBvector<T>::Resize(i_size, def); 00109 return; 00110 } 00111 00112 //------------------------------------------+----------------------------------- 00114 00115 template <class T> 00116 inline void CTBstack<T>::Insert(CTBint i_ind, const T& rhs) 00117 { 00118 CTBvector<T>::Insert(Size()-1-i_ind,rhs); 00119 return; 00120 } 00121 00122 //------------------------------------------+----------------------------------- 00124 00125 template <class T> 00126 inline void CTBstack<T>::Remove(CTBint i_ind, T& rhs) 00127 { 00128 CTBvector<T>::Remove(Size()-1-i_ind,rhs); 00129 return; 00130 } 00131 00132 //------------------------------------------+----------------------------------- 00134 00135 template <class T> 00136 inline void CTBstack<T>::Delete(CTBint i_ind) 00137 { 00138 CTBvector<T>::Delete(Size()-1-i_ind); 00139 return; 00140 } 00141 00142 //------------------------------------------+----------------------------------- 00144 00145 template <class T> 00146 inline void CTBstack<T>::InsertHead(const T& rhs) 00147 { 00148 CTBvector<T>::InsertTail(rhs); 00149 return; 00150 } 00151 00152 //------------------------------------------+----------------------------------- 00154 00160 template <class T> 00161 inline bool CTBstack<T>::RemoveHead(T& rhs) 00162 { 00163 return CTBvector<T>::RemoveTail(rhs); 00164 } 00165 00166 //------------------------------------------+----------------------------------- 00168 00169 template <class T> 00170 inline void CTBstack<T>::InsertTail(const T& rhs) 00171 { 00172 CTBvector<T>::InsertHead(rhs); 00173 return; 00174 } 00175 00176 //------------------------------------------+----------------------------------- 00178 00184 template <class T> 00185 inline bool CTBstack<T>::RemoveTail(T& rhs) 00186 { 00187 return CTBvector<T>::RemoveHead(rhs); 00188 } 00189 00190 //------------------------------------------+----------------------------------- 00192 00193 template <class T> 00194 inline void CTBstack<T>::Push(const T& rhs) 00195 { 00196 InsertHead(rhs); 00197 return; 00198 } 00199 00200 //------------------------------------------+----------------------------------- 00202 00203 template <class T> 00204 inline bool CTBstack<T>::Pop(T& rhs) 00205 { 00206 return RemoveHead(rhs); 00207 } 00208 00209 //------------------------------------------+----------------------------------- 00211 00215 template <class T> 00216 inline void CTBstack<T>::Grab(CTBstack<T>& rhs) 00217 { 00218 CTBvector<T>::Grab(rhs); 00219 return; 00220 } 00221 00222 //------------------------------------------+----------------------------------- 00224 00225 template <class T> 00226 inline T& CTBstack<T>::operator[](CTBint i_ind) 00227 { 00228 return CTBvector<T>::operator[](Size()-1-i_ind); 00229 } 00230 00231 //------------------------------------------+----------------------------------- 00233 00234 template <class T> 00235 inline const T& CTBstack<T>::operator[](CTBint i_ind) const 00236 { 00237 return CTBvector<T>::operator[](Size()-1-i_ind); 00238 } 00239 00240 //------------------------------------------+----------------------------------- 00242 00243 template <class T> 00244 inline CTBstack<T>& CTBstack<T>::operator<<(const T& rhs) 00245 { 00246 Push(rhs); 00247 return *this; 00248 } 00249 00250 //------------------------------------------+----------------------------------- 00252 00253 template <class T> 00254 inline CTBstack<T>& CTBstack<T>::operator>>(T& rhs) 00255 { 00256 Pop(rhs); 00257 return *this; 00258 }
1.2.9-20010812 written by Dimitri van Heesch,
© 1997-2001