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_POINT3D_HH
00027 # define MLN_CORE_ALIAS_POINT3D_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 namespace mln
00040 {
00041
00044 typedef point<grid::cube, def::coord> point3d;
00045
00048 typedef point<grid::cube, def::coordf> point3df;
00049
00050 namespace internal
00051 {
00052
00053
00054
00055 template <typename C, typename E>
00056 struct subject_impl< const point<grid::cube, C>, E >
00057 : subject_point_impl< point<grid::cube, C>, E >
00058 {
00059 typedef C coord;
00060 enum { dim = 3 };
00061
00062 typedef const C& row_t;
00063 const C& row() const;
00064
00065 typedef const C& col_t;
00066 const C& col() const;
00067
00068 typedef const C& sli_t;
00069 const C& sli() const;
00070
00071 const C& operator[](unsigned i) const;
00072 const C& last_coord() const;
00073 private:
00074 const E& exact_() const;
00075 };
00076
00077
00078
00079
00080 template <typename C, typename E>
00081 struct subject_impl< point<grid::cube, C>, E > :
00082 subject_impl< const point<grid::cube, C>, E >
00083 {
00084 private:
00085 typedef subject_impl< const point<grid::cube, C>, E > super_;
00086 E& exact_();
00087 public:
00088
00089 using super_::row;
00090 C& row();
00091
00092 using super_::col;
00093 C& col();
00094
00095 using super_::sli;
00096 C& sli();
00097
00098 using super_::operator[];
00099 C& operator[](unsigned i);
00100 };
00101
00102
00103
00104 # ifndef MLN_INCLUDE_ONLY
00105
00106
00107
00108 template <typename C, typename E>
00109 inline
00110 const C&
00111 subject_impl< const point<grid::cube, C>, E >::row() const
00112 {
00113 return exact_().get_subject().row();
00114 }
00115
00116 template <typename C, typename E>
00117 inline
00118 const C&
00119 subject_impl< const point<grid::cube, C>, E >::col() const
00120 {
00121 return exact_().get_subject().col();
00122 }
00123
00124 template <typename C, typename E>
00125 inline
00126 const C&
00127 subject_impl< const point<grid::cube, C>, E >::sli() const
00128 {
00129 return exact_().get_subject().sli();
00130 }
00131
00132 template <typename C, typename E>
00133 inline
00134 const C&
00135 subject_impl< const point<grid::cube, C>, E >::operator[](unsigned i) const
00136 {
00137 mln_precondition(i < 3);
00138 return exact_().get_subject()[i];
00139 }
00140
00141 template <typename C, typename E>
00142 inline
00143 const C&
00144 subject_impl< const point<grid::cube, C>, E >::last_coord() const
00145 {
00146 return this->col();
00147 }
00148
00149 template <typename C, typename E>
00150 inline
00151 const E&
00152 subject_impl< const point<grid::cube, C>, E >::exact_() const
00153 {
00154 return internal::force_exact<const E>(*this);
00155 }
00156
00157
00158
00159 template <typename C, typename E>
00160 inline
00161 C&
00162 subject_impl< point<grid::cube, C>, E >::row()
00163 {
00164 return exact_().get_subject().row();
00165 }
00166
00167 template <typename C, typename E>
00168 inline
00169 C&
00170 subject_impl< point<grid::cube, C>, E >::col()
00171 {
00172 return exact_().get_subject().col();
00173 }
00174
00175 template <typename C, typename E>
00176 inline
00177 C&
00178 subject_impl< point<grid::cube, C>, E >::sli()
00179 {
00180 return exact_().get_subject().sli();
00181 }
00182
00183 template <typename C, typename E>
00184 inline
00185 C&
00186 subject_impl< point<grid::cube, C>, E >::operator[](unsigned i)
00187 {
00188 mln_precondition(i < 3);
00189 return exact_().get_subject()[i];
00190 }
00191
00192 template <typename C, typename E>
00193 inline
00194 E&
00195 subject_impl< point<grid::cube, C>, E >::exact_()
00196 {
00197 return internal::force_exact<E>(*this);
00198 }
00199
00200 # endif // ! MLN_INCLUDE_ONLY
00201
00202 }
00203
00204
00205 }
00206
00207
00208 # include <mln/core/alias/dpoint3d.hh>
00209
00210
00211 #endif // ! MLN_CORE_ALIAS_POINT3D_HH