Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBvector.hxx

Go to the documentation of this file.
00001 #ifndef included_CTBvector
00002 #define included_CTBvector 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 "CTBrawBuffer.hxx"
00018 #include "CTBrange.hxx"
00019 #include "CTBvectorDsc.hxx"
00020 #include "CTBretObj.hxx"
00021 
00022 template <class T>
00023 class CTBvector {
00024 
00025   public: 
00026 
00027     typedef T Elem_t;                       
00028     typedef CTBretObj<CTBvector<T> > RetObj;
00029 
00030 
00031                     CTBvector();
00032     explicit        CTBvector(CTBint i_size);
00033                     CTBvector(CTBint i_size, const T& def);
00034                     CTBvector(const CTBvector<T>& rhs);
00035                     CTBvector(CTBvector<T>& rhs, bool b_grab);
00036                     CTBvector(CTBvector<T>::RetObj& rhs);
00037 
00038     virtual         ~CTBvector();
00039 
00040     CTBint          Size() const;
00041     CTBint          Capacity() const;
00042 
00043     CTBvectorDsc<T>  Reverse();
00044     CTBvectorCDsc<T> Reverse() const;
00045 
00046     T&              At (CTBint i_ind);
00047     const T&        At (CTBint i_ind) const;
00048   
00049     void            Resize(CTBint i_size);
00050     void            Resize(CTBint i_size, const T& def);
00051 
00052     void            Insert(CTBint i_ind, const T& rhs);
00053     void            Remove(CTBint i_ind, T& rhs);
00054 
00055     void            Delete(CTBint i_ind);
00056 
00057     void            InsertHead(const T& rhs);
00058     bool            RemoveHead(T& rhs);
00059     void            InsertTail(const T& rhs);
00060     bool            RemoveTail(T& rhs);
00061 
00062     void            EnsureCapacity(CTBint i_cap);
00063     void            IncreaseCapacity(CTBint i_cap);
00064     void            TrimCapacity();
00065 
00066     void            Grab(CTBvector<T>& rhs);
00067 
00068     const T*        Data() const;
00069     CTBint          Stride() const;
00070 
00071     void            Dump(int i_indent=0, ostream& os=cout,
00072                          const char* p_text=0) const;
00073 
00074     T&              operator[](CTBint i_ind);
00075     const T&        operator[](CTBint i_ind) const;
00076 
00077     T&              operator()(CTBint i_ind);
00078     const T&        operator()(CTBint i_ind) const;
00079 
00080     CTBvectorDsc<T>  operator()(const CTBrange& ran);
00081     CTBvectorCDsc<T> operator()(const CTBrange& ran) const;
00082 
00083     bool            operator!() const;
00084 
00085                     operator T*();
00086                     operator const T*() const;
00087 
00088                     operator CTBvectorDsc<T>();
00089                     operator CTBvectorCDsc<T>() const;
00090 
00091     CTBvector<T>&   operator=(const T& rhs);
00092     CTBvector<T>&   operator=(const CTBvector<T>& rhs);
00093     CTBvector<T>&   operator=(const CTBvectorCDsc<T>& rhs);
00094     CTBvector<T>&   operator=(CTBvector<T>::RetObj& rhs);
00095 
00096     CTBvector<T>&   operator<<(const T& rhs);
00097     CTBvector<T>&   operator>>(T& rhs);
00098 
00099   private: 
00100 
00101     void            ChangeCapacity(CTBint i_cap);
00102 
00103   private: 
00104 
00105     CTBrawBuffer<T>  m_rbuf;                
00106     CTBint           mi_nuse;               
00107 
00108 };
00109 
00110 template <class T>
00111 ostream& operator<<(ostream& os, const CTBvector<T>& obj);
00112 
00113 template <class T>
00114 class CTBgrab<CTBvector<T> > : public CTBgrabable<CTBvector<T> > {};
00115 
00116 // Notes:
00117 //  -- proofed: 14-mar-1999(2)
00118 
00119 #if !(defined(CTB__NoInline) || defined(CTBvector__NoInline))
00120 #include "CTBvector.icc"
00121 #endif
00122 
00123 #endif

Generated at Fri Oct 24 18:11:30 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001