00001 // Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory 00002 // 00003 // This file is part of the Olena Library. This library is free 00004 // software; you can redistribute it and/or modify it under the terms 00005 // of the GNU General Public License version 2 as published by the 00006 // Free Software Foundation. 00007 // 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this library; see the file COPYING. If not, write to 00015 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 // Boston, MA 02110-1301, USA. 00017 // 00018 // As a special exception, you may use this file as part of a free 00019 // software library without restriction. Specifically, if other files 00020 // instantiate templates or use macros or inline functions from this 00021 // file, or you compile this file and link it with other files to 00022 // produce an executable, this file does not by itself cause the 00023 // resulting executable to be covered by the GNU General Public 00024 // License. This exception does not however invalidate any other 00025 // reasons why the executable file might be covered by the GNU General 00026 // Public License. 00027 00028 #ifndef OLENA_CORE_POINT1D_HH 00029 # define OLENA_CORE_POINT1D_HH 00030 00031 # include <oln/config/system.hh> 00032 # include <ntg/core/predecls.hh> 00033 # include <oln/core/coord.hh> 00034 # include <oln/core/abstract/point.hh> 00035 # include <iostream> 00036 00037 namespace oln { 00038 00039 00040 // fwd decl 00041 class dpoint1d; 00042 class point1d; 00043 00044 00050 template<> 00051 struct point_traits<point1d> : public point_traits<abstract::point<point1d> > 00052 { 00053 enum { dim = 1 }; 00054 typedef dpoint1d dpoint_type; 00055 }; 00056 00068 class point1d : public abstract::point<point1d> 00069 { 00070 public: 00071 00072 typedef abstract::point<point1d> super_type; 00073 typedef point_traits<point1d>::dpoint_type dpoint_type; 00074 00075 friend class abstract::point<point1d>; 00076 00077 point1d(); 00078 00080 00081 point1d(coord col); 00082 00084 00085 coord 00086 col() const; 00087 00089 00090 coord& 00091 col(); 00092 00093 static std::string 00094 name() 00095 { 00096 return "point1d"; 00097 } 00098 00099 protected: 00100 00101 00106 point1d 00107 plus_dp(const dpoint1d& dp) const; 00108 00113 point1d 00114 minus_dp(const dpoint1d& dp) const; 00115 00120 point1d& 00121 plus_assign_dp(const dpoint1d& dp); 00122 00127 point1d& 00128 minus_assign_dp(const dpoint1d& dp); 00129 00134 dpoint1d 00135 minus_p(const point1d& p) const; 00136 00141 point1d 00142 minus() const; 00143 00144 }; 00145 00146 namespace internal 00147 { 00148 00154 template<> 00155 struct default_less<point1d> : public default_less<point1d::super_type> 00156 { 00157 }; 00158 } // internal 00159 00160 00161 } // oln 00162 00164 00165 inline std::ostream& 00166 operator<<(std::ostream& o, const oln::point1d& p); 00167 00168 # include <oln/core/point1d.hxx> 00169 00170 #endif // ! OLENA_CORE_POINT1D_HH