00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef MLN_CORE_ALIAS_POINT1D_HH
00027 # define MLN_CORE_ALIAS_POINT1D_HH
00028 
00033 
00034 # include <mln/core/point.hh>
00035 
00036 # include <mln/core/concept/site_proxy.hh>
00037 # include <mln/core/internal/force_exact.hh>
00038 
00039 
00040 namespace mln
00041 {
00042 
00045   typedef point<grid::tick, def::coord> point1d;
00046 
00049   typedef point<grid::tick, def::coordf> point1df;
00050 
00051 
00052   namespace internal
00053   {
00054 
00055     
00056 
00057     template <typename C, typename E>
00058     struct subject_impl< const point<grid::tick, C>, E >
00059     {
00060       typedef C coord;
00061       enum { dim = 1 };
00062 
00063       typedef const C& ind_t;
00064       const C& ind() const;
00065 
00066       const C& operator[](unsigned i) const;
00067       const C& last_coord() const;
00068     private:
00069       const E& exact_() const;
00070     };
00071 
00072 
00073     
00074 
00075     template <typename C, typename E>
00076     struct subject_impl<       point<grid::tick, C>, E > :
00077            subject_impl< const point<grid::tick, C>, E >
00078     {
00079     private:
00080       typedef subject_impl< const point<grid::tick, C>, E > super_;
00081       E& exact_();
00082     public:
00083       using super_::ind;
00084       C& ind();
00085       using super_::operator[];
00086       C& operator[](unsigned i);
00087     };
00088 
00089 
00090 
00091 # ifndef MLN_INCLUDE_ONLY
00092 
00093     
00094 
00095     template <typename C, typename E>
00096     inline
00097     const C&
00098     subject_impl< const point<grid::tick, C>, E >::ind() const
00099     {
00100       return exact_().get_subject().ind();
00101     }
00102 
00103     template <typename C, typename E>
00104     inline
00105     const C&
00106     subject_impl< const point<grid::tick, C>, E >::operator[](unsigned i) const
00107     {
00108       mln_precondition(i == 0);
00109       (void)i;
00110       return exact_().get_subject()[0];
00111     }
00112 
00113     template <typename C, typename E>
00114     inline
00115     const E&
00116     subject_impl< const point<grid::tick, C>, E >::exact_() const
00117     {
00118       return internal::force_exact<const E>(*this);
00119     }
00120 
00121     
00122 
00123     template <typename C, typename E>
00124     inline
00125     C&
00126     subject_impl< point<grid::tick, C>, E >::ind()
00127     {
00128       return exact_().get_subject().ind();
00129     }
00130 
00131     template <typename C, typename E>
00132     inline
00133     C&
00134     subject_impl< point<grid::tick, C>, E >::operator[](unsigned i)
00135     {
00136       mln_precondition(i == 0);
00137       (void)i;
00138       return exact_().get_subject()[0];
00139     }
00140 
00141 # endif // ! MLN_INCLUDE_ONLY
00142 
00143   } 
00144 
00145 } 
00146 
00147 
00148 # include <mln/core/alias/dpoint1d.hh>
00149 
00150 
00151 #endif // ! MLN_CORE_ALIAS_POINT1D_HH