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_CONVERT_FROM_TO_HXX
00027 # define MLN_CONVERT_FROM_TO_HXX
00028
00030
00031
00032
00033
00034 # include <mln/core/def/all.hh>
00035 # include <mln/core/grids.hh>
00036 # include <mln/util/couple.hh>
00037
00038
00039 # include <vector>
00040 # include <set>
00041
00042
00043 namespace mln
00044 {
00045
00046
00047
00048
00049 template <typename E> struct Accumulator;
00050 template <typename E> struct Gdpoint;
00051 template <typename E> struct Gpoint;
00052 template <typename E> struct Image;
00053 template <typename E> struct Object;
00054 template <typename E> struct Proxy;
00055 template <typename E> struct Site_Set;
00056 template <typename E> struct Value;
00057 template <typename E> struct Weighted_Window;
00058 template <typename E> struct Window;
00059
00060 template <typename G, typename C> struct dpoint;
00061 template <typename G, typename C> struct point;
00062
00063 template <typename D> class neighb;
00064 template <typename D> class window;
00065 template <typename D, typename W> class w_window;
00066
00067 template <typename T> struct image1d;
00068
00069 namespace algebra {
00070 template <unsigned n, typename T> class vec;
00071 template <unsigned d, typename C> class h_vec;
00072 }
00073
00074 namespace fun {
00075 namespace i2v {
00076 template <typename T> class array;
00077 }
00078 }
00079
00080 namespace histo {
00081 template <typename T> struct array;
00082 }
00083
00084 namespace util {
00085 template <typename T> class array;
00086 }
00087
00088 namespace value {
00089 template <unsigned n> struct rgb;
00090 template <typename H, typename S, typename L> class hsl_;
00091 template <unsigned n> struct int_u;
00092 template <unsigned n> struct label;
00093 }
00094
00095
00096
00097
00098
00099
00100
00101 namespace convert
00102 {
00103
00104 template <typename T, typename O>
00105 T
00106 to(const O& from);
00107
00108 }
00109
00110
00111
00112
00113
00114 namespace convert
00115 {
00116
00117
00118
00119 template <typename F, typename T>
00120 void
00121 from_to(const F& from, T& to);
00122
00123
00124 namespace over_load
00125 {
00126
00127
00128 template <typename F, typename T>
00129 void
00130 from_to_(const Object<F>&, Object<T>&);
00131
00132
00133
00134 template <typename T>
00135 void
00136 from_to_(const Object<T>& from, Object<T>& to);
00137
00138
00139 template <typename T>
00140 void
00141 from_to_(const T& from, T& to);
00142
00143
00144 template <typename G, typename C1, typename C2>
00145 inline
00146 void
00147 from_to_(const point<G,C1>& from, point<G,C2>& to);
00148
00149
00150 template <unsigned n, typename T, typename P>
00151 void
00152 from_to_(const algebra::vec<n,T>& from, Gpoint<P>& to_);
00153
00154
00155 template <typename T, unsigned m>
00156 void
00157 from_to_(const algebra::vec<3,T>& from, value::rgb<m>& to);
00158
00159
00160
00161 template <unsigned m>
00162 void
00163 from_to_(bool from, value::rgb<m>& to);
00164
00165
00166 template <unsigned m>
00167 void from_to_(const value::int_u<m>& from, value::rgb<m>& to);
00168
00169
00170 template <unsigned n>
00171 void from_to_(const value::int_u<n>& from, value::label<n>& to_);
00172
00173 template <unsigned n>
00174 void from_to_(const value::label<n>& from, bool& to_);
00175
00176
00177 template <unsigned n, unsigned m>
00178 void
00179 from_to_(const value::int_u<n>& from, value::label<m>& to_);
00180
00181
00182 template <typename H, typename S, typename L>
00183 void from_to_(const value::hsl_<H,S,L>&, value::rgb<8>& to);
00184
00185
00186 template <typename H, typename S, typename L>
00187 void from_to_(const value::hsl_<H,S,L>&, value::rgb<16>& to);
00188
00189
00190
00191 void
00192 from_to_(const value::rgb<16>& from, value::hsl_<float,float,float>& to);
00193
00194
00195 void
00196 from_to_(const value::rgb<8>& from, value::hsl_<float,float,float>& to);
00197
00198
00199 template <unsigned m>
00200 void from_to_(const value::rgb<m>& from, bool& to);
00201
00202
00203
00204 template <typename V, unsigned S, typename I>
00205 void
00206 from_to_(const V (&values)[S], Image<I>& to);
00207
00208
00209 template <typename V, unsigned S, typename D, typename W>
00210 void
00211 from_to_(const V (&weight)[S], w_window<D,W>& to);
00212
00213
00214
00215 template <unsigned S>
00216 void
00217 from_to_(const bool (&values)[S],
00218 window< dpoint<grid::square, def::coord> >& win);
00219
00220 template <unsigned R, unsigned C>
00221 void
00222 from_to_(const bool (&values)[R][C],
00223 window< dpoint<grid::square, def::coord> >& win);
00224
00225
00226
00227 template <unsigned S>
00228 void
00229 from_to_(const bool (&values)[S],
00230 window< dpoint<grid::cube, def::coord> >& win);
00231
00232
00233
00234 template <unsigned S>
00235 void
00236 from_to_(const bool (&values)[S],
00237 neighb< window< dpoint<grid::square, def::coord> > >& nbh);
00238
00239 template <unsigned R, unsigned C>
00240 void
00241 from_to_(bool const (&values)[R][C],
00242 neighb< window< dpoint<grid::square, def::coord> > >& nbh);
00243
00244
00245
00246 template <unsigned S>
00247 void
00248 from_to_(const bool (&values)[S],
00249 neighb< window< dpoint<grid::cube, def::coord> > >& nbh);
00250
00251
00252
00253
00254 template <typename D>
00255 void
00256 from_to_(const Gdpoint<D>& from, mln_site(D)& to);
00257
00258
00259
00260 template <typename F, typename T>
00261 void
00262 from_to_(const Value<F>& from, Value<T>& to);
00263
00264
00265 template <typename V>
00266 void
00267 from_to_(const double& from, Value<V>& to);
00268
00269
00270 void
00271 from_to_(const double& from, unsigned& to);
00272
00273
00274 void
00275 from_to_(const double& from, int& to);
00276
00277
00278 template <typename V>
00279 void
00280 from_to_(const float& from, Value<V>& to);
00281
00282
00283 void
00284 from_to_(const float& from, unsigned& to);
00285
00286
00287 void
00288 from_to_(const float& from, int& to);
00289
00290
00291 template <typename T>
00292 void
00293 from_to_(const int& from, Value<T>& to);
00294
00295
00296 template <typename P, typename T>
00297 void
00298 from_to_(const Proxy<P>& from, T& to);
00299
00300
00301
00302 template <typename P, unsigned n, typename T>
00303 void
00304 from_to_(const Gpoint<P>& from, algebra::vec<n,T>& to);
00305
00306
00307 template <typename P>
00308 void
00309 from_to_(const Gpoint<P>& from, mln_delta(P)& to);
00310
00311
00312
00313 template <typename I, typename S>
00314 void
00315 from_to_(const Image<I>& from, Site_Set<S>& to);
00316
00317
00318 template <typename I, typename D, typename W>
00319 void
00320 from_to_(const Image<I>& from, w_window<D,W>& to);
00321
00322
00323
00324 template <typename W>
00325 void
00326 from_to_(const mln::neighb<W>& from, W& to);
00327
00328
00329 template <typename W>
00330 void
00331 from_to_(const W& from, mln::neighb<W>& to);
00332
00333
00334
00335 template <typename W, typename I>
00336 void
00337 from_to_(const Window<W>& from, Image<I>& to);
00338
00339
00340
00341 template <typename D, typename W, typename I>
00342 void
00343 from_to_(const w_window<D,W>& from, Image<I>& to);
00344
00345
00346
00347
00348 template <typename T>
00349 void
00350 from_to_(const util::array<T>& from, fun::i2v::array<T>& to);
00351
00352
00353 template <typename T, typename U>
00354 void
00355 from_to_(const util::array<T>& from, fun::i2v::array<U>& to);
00356
00357
00358 template <typename T>
00359 void
00360 from_to_(const std::vector<T>& from, fun::i2v::array<T>& to);
00361
00362
00363 template <typename T, typename U>
00364 void
00365 from_to_(const std::vector<T>& from, fun::i2v::array<U>& to);
00366
00367
00368 template <typename T1, typename T2>
00369 void
00370 from_to_(const util::array<T1>& from, util::array<T2>& to);
00371
00372
00373
00374
00375 template <typename T1, typename T2>
00376 void
00377 from_to_(const util::array<T1>& from, util::array<T2>& to);
00378
00379
00380 template <typename T1, typename T2>
00381 void
00382 from_to_(const fun::i2v::array<T1>& from, util::array<T2>& to);
00383
00384
00385
00386 template <typename A>
00387 void
00388 from_to_(const Accumulator<A>& from, mln_result(A)& to);
00389
00390
00391
00392
00393 template <typename S, typename I>
00394 void
00395 from_to_(const Site_Set<S>& from, Image<I>& to);
00396
00397
00398 template <typename S, typename P, typename C_>
00399 void
00400 from_to_(const Site_Set<S>& from, std::set<P,C_>& to);
00401
00402
00403 template <typename P, typename C_, typename S>
00404 void
00405 from_to_(const std::set<P,C_>& from, Site_Set<S>& to);
00406
00407
00408 template <typename V, typename T>
00409 void
00410 from_to_(const histo::array<V>& from, image1d<T>& to);
00411
00412
00413 template <typename V, typename T>
00414 void
00415 from_to_(const util::array<V>& from, image1d<T>& to);
00416
00417
00418 template <typename T, typename U, typename V, typename W>
00419 void
00420 from_to_(const util::couple<T, U>& from, util::couple<V, W>& to)
00421 {
00422 from_to(from.first(), to.first());
00423 from_to(from.second(), to.second());
00424 }
00425
00426 }
00427
00428 }
00429
00430 }
00431
00432
00433 #endif // ! MLN_CONVERT_FROM_TO_HXX