coordinate_2d.hpp

Go to the documentation of this file.
00001 /*
00002   CLAW - a C++ Library Absolutely Wonderful
00003 
00004   CLAW is a free library without any particular aim but being useful to 
00005   anyone.
00006 
00007   Copyright (C) 2005-2008 Julien Jorge
00008 
00009   This library is free software; you can redistribute it and/or
00010   modify it under the terms of the GNU Lesser General Public
00011   License as published by the Free Software Foundation; either
00012   version 2.1 of the License, or (at your option) any later version.
00013 
00014   This library is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017   Lesser General Public License for more details.
00018 
00019   You should have received a copy of the GNU Lesser General Public
00020   License along with this library; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023   contact: julien_jorge@yahoo.fr
00024 */
00030 #ifndef __CLAW_COORDINATE_2D_HPP__
00031 #define __CLAW_COORDINATE_2D_HPP__
00032 
00033 namespace claw
00034 {
00035   namespace math
00036   {
00041     template<typename T>
00042     class coordinate_2d
00043     {
00044     public:
00046       typedef T value_type;
00047 
00049       typedef coordinate_2d<value_type> self_type;
00050 
00051     public:
00052       coordinate_2d();
00053 
00054       template<typename U>
00055       coordinate_2d( const coordinate_2d<U>& that );
00056 
00057       coordinate_2d( const value_type& _x, const value_type& _y );
00058 
00059       template<typename U>
00060       coordinate_2d<U> cast_value_type_to() const;
00061 
00062       void set(const value_type& _x, const value_type& _y);
00063       value_type distance(const self_type& p) const;
00064 
00065       bool operator==(const self_type& vect) const;
00066       bool operator!=(const self_type& vect) const;
00067       self_type operator+(const self_type& vect) const;
00068       self_type operator-(const self_type& vect) const;
00069       self_type& operator+=(const self_type& vect);
00070       self_type& operator-=(const self_type& vect);
00071 
00072       self_type operator*( const value_type& v ) const;
00073       self_type operator/( const value_type& v ) const;
00074       self_type& operator*=( const value_type& v );
00075       self_type& operator/=( const value_type& v );
00076 
00077     public:
00079       value_type x;
00080 
00082       value_type y;
00083 
00084     }; // class coordinate_2d
00085 
00086     template<typename T>
00087     coordinate_2d<T> operator-( const coordinate_2d<T>& that );
00088 
00089     template<typename T, typename U>
00090     coordinate_2d<T> operator*( U v, const coordinate_2d<T>& self );
00091 
00092   } // namespace math
00093 } // namespace claw
00094 
00095 #include <claw/impl/coordinate_2d.tpp>
00096 
00097 #endif // __CLAW_COORDINATE_2D_HPP__

Generated on Mon Nov 9 05:08:17 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.4.7