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

CTB2vec.hxx

Go to the documentation of this file.
00001 #ifndef _CTB2vec_HXX
00002 #define _CTB2vec_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 T>
00017 class CTB2vec {
00018   public:
00019                     CTB2vec();
00020     explicit        CTB2vec(T rhs);
00021                     CTB2vec(T x, T y);
00022                     CTB2vec(const CTB2vec<T>& rhs);
00023 
00024     T&              X();
00025     const T&        X() const;
00026 
00027     T&              Y();
00028     const T&        Y() const;
00029 
00030     void            X(T x);
00031     void            Y(T y);
00032 
00033     T               Length() const;
00034     T               Dot(const CTB2vec<T>& rhs) const;
00035 
00036 
00037     CTB2vec<T>      Project(const CTB2vec<T>& x,
00038                             const CTB2vec<T>& y) const;
00039     CTB2vec<T>      UnProject(const CTB2vec<T>& x,
00040                               const CTB2vec<T>& y) const;
00041 
00042     T&              operator[](CTBint i_ind);
00043     const T&        operator[](CTBint i_ind) const;
00044 
00045                     operator T*();
00046                     operator const T*() const;
00047 
00048     CTB2vec<T>      operator-() const;
00049 
00050     CTB2vec<T>&     operator+=(const CTB2vec<T>& rhs);
00051     CTB2vec<T>&     operator-=(const CTB2vec<T>& rhs);
00052     CTB2vec<T>&     operator*=(T rhs);
00053     CTB2vec<T>&     operator/=(T rhs);
00054 
00055     CTB2vec<T>&     operator=(T rhs);
00056     CTB2vec<T>&     operator=(const CTB2vec<T>& rhs);
00057 
00058   protected: 
00059 
00060     T               m_data[2];              
00061 };
00062 
00063 typedef CTB2vec<float>  CTB2vec_f;          
00064 typedef CTB2vec<double> CTB2vec_d;          
00065 
00066 template <class T>
00067     CTB2vec<T>      operator+(const CTB2vec<T>& lhs, const CTB2vec<T>& rhs);
00068 template <class T>
00069     CTB2vec<T>      operator+(const CTB2vec<T>& lhs, T f_rhs);
00070 template <class T>
00071     CTB2vec<T>      operator+(T f_lhs, const CTB2vec<T>& rhs);
00072 
00073 template <class T>
00074     CTB2vec<T>      operator-(const CTB2vec<T>& lhs, const CTB2vec<T>& rhs);
00075 template <class T>
00076     CTB2vec<T>      operator-(const CTB2vec<T>& lhs, T f_rhs);
00077 template <class T>
00078     CTB2vec<T>      operator-(T f_lhs, const CTB2vec<T>& rhs);
00079 
00080 template <class T>
00081     T               operator*(const CTB2vec<T>& lhs, const CTB2vec<T>& rhs);
00082 template <class T>
00083     CTB2vec<T>      operator*(const CTB2vec<T>& lhs, T f_rhs);
00084 template <class T>
00085     CTB2vec<T>      operator*(T f_lhs, const CTB2vec<T>& rhs);
00086 
00087 template <class T>
00088     CTB2vec<T>      operator/(const CTB2vec<T>& lhs, T f_rhs);
00089 
00090 template <class T>
00091     bool            operator==(const CTB2vec<T>& lhs, const CTB2vec<T>& rhs);
00092 template <class T>
00093     bool            operator==(const CTB2vec<T>& lhs, T f_rhs);
00094 template <class T>
00095     bool            operator==(T f_lhs, const CTB2vec<T>& rhs);
00096 
00097 template <class T>
00098     ostream&        operator<<(ostream& os, const CTB2vec<T>& obj);
00099 
00100 template <class T>
00101     T               CTBabs(const CTB2vec<T>& vec);
00102 
00103 // implementation is all inline !!
00104 #include "CTB2vec.icc"
00105 
00106 #endif

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