00001 #ifndef included_CTBstack 00002 #define included_CTBstack 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 #include "CTBgrab.hxx" 00017 #include "CTBvector.hxx" 00018 00019 template <class T> 00020 class CTBstack : public CTBvector<T> { 00021 00022 public: 00023 00024 CTBstack(); 00025 explicit CTBstack(CTBint i_capacity); 00026 CTBstack(const CTBstack<T>& rhs); 00027 CTBstack(CTBstack<T>& rhs, bool b_grab); 00028 00029 T& At (CTBint i_ind); 00030 const T& At (CTBint i_ind) const; 00031 00032 void Resize(CTBint i_size); 00033 void Resize(CTBint i_size, const T& def); 00034 00035 void Insert(CTBint i_ind, const T& rhs); 00036 void Remove(CTBint i_ind, T& rhs); 00037 00038 void Delete(CTBint i_ind); 00039 00040 void InsertHead(const T& rhs); 00041 bool RemoveHead(T& rhs); 00042 void InsertTail(const T& rhs); 00043 bool RemoveTail(T& rhs); 00044 00045 void Push(const T& rhs); 00046 bool Pop(T& rhs); 00047 00048 void Grab(CTBstack<T>& rhs); 00049 00050 T& operator[](CTBint i_ind); 00051 const T& operator[](CTBint i_ind) const; 00052 00053 CTBstack<T>& operator=(const T& rhs); 00054 CTBstack<T>& operator=(const CTBstack<T>& rhs); 00055 00056 CTBstack<T>& operator<<(const T& rhs); 00057 CTBstack<T>& operator>>(T& rhs); 00058 }; 00059 00060 template <class T> 00061 class CTBgrab<CTBstack<T> > : public CTBgrabable<CTBstack<T> > {}; 00062 00063 // Notes: 00064 00065 // implementation is all inline 00066 #include "CTBstack.icc" 00067 00068 #endif