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_IMAGE1D_HH
00029 # define OLENA_CORE_IMAGE1D_HH
00030
00031 # include <oln/core/point1d.hh>
00032 # include <oln/core/dpoint1d.hh>
00033 # include <oln/core/fwd_iter1d.hh>
00034 # include <oln/core/bkd_iter1d.hh>
00035 # include <oln/core/impl/image_array1d.hh>
00036 # include <oln/core/image.hh>
00037 # include <oln/io/readable.hh>
00038
00039 # include <iostream>
00040 # include <stdlib.h>
00041
00042 namespace oln {
00043
00044 template<class T, class Exact = mlc::final>
00045 class image1d;
00046
00053 template<class T, class Exact>
00054 struct image_id<image1d<T, Exact> >
00055 {
00056 enum{dim = 1};
00057 typedef T value_type;
00058 typedef typename mlc::exact_vt<image1d<T, Exact>, Exact>::ret exact_type;
00059 typedef impl::image_array1d<T> impl_type;
00060 typedef point1d point_type;
00061 typedef image1d_size size_type;
00062 };
00063
00070 template<class T, class Exact>
00071 struct image_traits<image1d<T, Exact> >:
00072 public image_traits<image<image_id<image1d<T, Exact> >::dim,
00073 typename image_id<image1d<T, Exact> >::value_type,
00074 typename image_id<image1d<T, Exact> >::impl_type,
00075 typename image_id<image1d<T, Exact> >::exact_type> >
00076 {
00077
00078 };
00079
00080
00081
00082
00090 template<class T, class Exact>
00091 class image1d:
00092 public image<image_id<image1d<T, Exact> >::dim,
00093 typename image_id<image1d<T, Exact> >::value_type,
00094 typename image_id<image1d<T, Exact> >::impl_type,
00095 typename image_id<image1d<T, Exact> >::exact_type>
00096 {
00097
00098 public:
00099
00100 typedef image1d<T, Exact> self_type;
00101 typedef typename image_id<image1d<T, Exact> >::value_type value_type;
00102 typedef typename image_id<image1d<T, Exact> >::exact_type exact_type;
00103 typedef typename image_id<image1d<T, Exact> >::impl_type impl_type;
00104 typedef image<image_id<image1d<T, Exact> >::dim,
00105 value_type,
00106 impl_type,
00107 exact_type> super_type;
00108
00109 friend class abstract::image<exact_type>;
00110
00111 image1d() :
00112 super_type()
00113 {
00114 mlc_init_static_hierarchy(Exact);
00115 }
00116
00122 image1d(coord ncols, coord border = 2) :
00123 super_type(new impl_type(image1d_size(ncols, border)))
00124 {
00125 mlc_init_static_hierarchy(Exact);
00126 }
00127
00132 image1d(const image1d_size& size) :
00133 super_type(new impl_type(size))
00134 {
00135 mlc_init_static_hierarchy(Exact);
00136 }
00137
00146 image1d(self_type& rhs) :
00147 super_type(rhs)
00148 { mlc_init_static_hierarchy(Exact); }
00149
00157 exact_type&
00158 operator=(self_type rhs)
00159 {
00160 return this->exact().assign(rhs.exact());
00161 }
00162
00163
00164
00172 image1d(const io::internal::anything& r)
00173 : super_type()
00174 {
00175 mlc_init_static_hierarchy(Exact);
00176 r.assign(*this);
00177 }
00178
00186 image1d&
00187 operator=(const io::internal::anything& r)
00188 {
00189 return r.assign(*this);
00190 }
00191
00192 static std::string
00193 name()
00194 {
00195 return
00196 std::string("image1d<")
00197 + ntg_name(T) + ","
00198 + Exact::name() + ">";
00199 }
00200
00202
00203 template<class U>
00204 struct mute
00205 {
00206 typedef image1d<U> ret;
00207 };
00208
00209 image1d(const self_type& rhs);
00210
00211 protected:
00212
00214 exact_type
00215 clone_() const
00216 {
00217 exact_type output(this->ncols(), this->border());
00218 clone_to(output.impl());
00219 return output;
00220 }
00221
00222 };
00223
00229 template <class T, class Exact>
00230 struct dim_traits<1, T, Exact>
00231 {
00232 typedef image1d<T, Exact> img_type;
00233 };
00234 }
00235
00236 #endif // ! OLENA_CORE_IMAGE1D_HH