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
00027
00028 #ifndef OLENA_CORE_IMAGE_HH
00029 # define OLENA_CORE_IMAGE_HH
00030
00031 # include <mlc/type.hh>
00032 # include <ntg/basics.hh>
00033 # include <oln/core/abstract/image_with_impl.hh>
00034 # include <oln/core/abstract/iter.hh>
00035
00036 # include <sstream>
00037
00038
00039 namespace oln {
00040
00041 template<unsigned Dim, class T, class Impl, class Exact = mlc::final>
00042 class image;
00043
00050 template<unsigned Dim, class T, class Impl, class Exact>
00051 struct image_id<image<Dim, T, Impl, Exact> >
00052 {
00053 enum{dim = Dim};
00054 typedef T value_type;
00055 typedef Impl impl_type;
00056 typedef typename mlc::exact_vt<image<Dim, T, Impl, Exact>, Exact>::ret exact_type;
00057 };
00058
00065 template<unsigned Dim, class T, class Impl, class Exact>
00066 struct image_traits<image<Dim, T, Impl, Exact> >:
00067 public image_traits<abstract::image_with_impl<typename image_id<image<Dim, T, Impl, Exact> >::impl_type,
00068 typename image_id<image<Dim, T, Impl, Exact> >::exact_type> >
00069 {
00070
00071 };
00072
00073
00074
00075
00082 template<unsigned Dim, class T, class Impl, class Exact>
00083 class image:
00084 public abstract::image_with_impl<typename image_id<image<Dim, T, Impl, Exact> >::impl_type,
00085 typename image_id<image<Dim, T, Impl, Exact> >::exact_type>
00086 {
00087
00088
00089 public:
00090
00091 typedef typename mlc::exact_vt<image<Dim, T, Impl, Exact>, Exact>::ret exact_type;
00092 typedef typename image_traits<exact_type>::point_type point_type;
00098 typedef typename image_traits<exact_type>::dpoint_type dpoint_type;
00104 typedef typename image_traits<exact_type>::iter_type iter_type;
00110 typedef typename image_traits<exact_type>::fwd_iter_type fwd_iter_type;
00112 typedef typename image_traits<exact_type>::bkd_iter_type bkd_iter_type;
00114 typedef typename image_traits<exact_type>::value_type value_type;
00118 typedef typename image_traits<exact_type>::size_type size_type;
00120 typedef typename image_traits<exact_type>::impl_type impl_type;
00123 typedef image<Dim, T, Impl, Exact> self_type;
00124 typedef typename abstract::image_with_impl<Impl,
00125 exact_type> super_type;
00126
00127 image() : super_type()
00128 {
00129 mlc_init_static_hierarchy(Exact);
00130 }
00131
00139 image(self_type& rhs): super_type(rhs)
00140 {
00141 mlc_init_static_hierarchy(Exact);
00142 }
00143
00144 static std::string
00145 name()
00146 {
00147 std::ostringstream s;
00148 s << "image<" << Dim << ", " << ntg_name(T) << ", " << Impl::name()
00149 << ", " << Exact::name() << ">";
00150 return s.str();
00151 }
00152
00154
00155 image(impl_type* i) : super_type(i)
00156 {
00157 mlc_init_static_hierarchy(Exact);
00158 }
00159
00161
00162 image(const size_type& size) :
00163 super_type(new impl_type(size))
00164 {
00165 mlc_init_static_hierarchy(Exact);
00166 }
00167
00168 };
00169
00176 template<class I, class T = typename mlc::exact<I>::ret::value_type>
00177 struct mute
00178 {
00179 typedef typename mlc::exact<I>::ret::template mute<T>::ret ret;
00180 };
00181
00182
00183
00190 template <unsigned Dim, class T, class Exact = mlc::final>
00191 struct dim_traits
00192 {
00193 };
00194 }
00195
00196 #endif // ! OLENA_CORE_IMAGE_HH