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 namespace qt { struct rgb32; }
00090 template <unsigned n> struct rgb;
00091 template <typename H, typename S, typename L> class hsl_;
00092 template <unsigned n> struct int_u;
00093 template <unsigned n> struct label;
00094 }
00095
00096
00097
00098
00099
00100
00101
00102 namespace convert
00103 {
00104
00105 template <typename T, typename O>
00106 T
00107 to(const O& from);
00108
00109 }
00110
00111
00112
00113
00114
00115 namespace convert
00116 {
00117
00118
00119
00120 template <typename F, typename T>
00121 void
00122 from_to(const F& from, T& to);
00123
00124
00125 namespace over_load
00126 {
00127
00128
00129 template <typename F, typename T>
00130 void
00131 from_to_(const Object<F>&, Object<T>&);
00132
00133
00134
00135 template <typename T>
00136 void
00137 from_to_(const Object<T>& from, Object<T>& to);
00138
00139
00140 template <typename T>
00141 void
00142 from_to_(const T& from, T& to);
00143
00144
00145 template <typename G, typename C1, typename C2>
00146 inline
00147 void
00148 from_to_(const point<G,C1>& from, point<G,C2>& to);
00149
00150
00151 template <unsigned n, typename C1, typename G, typename C2>
00152 void
00153 from_to_(const algebra::vec<n,C1>& from, point<G,C2>& to);
00154
00155
00156 template <unsigned n, typename C1, typename G>
00157 void
00158 from_to_(const algebra::vec<n,C1>& from, point<G,C1>& to);
00159
00160
00161 template <unsigned n, typename T, typename P>
00162 void
00163 from_to_(const algebra::vec<n,T>& from, Gpoint<P>& to_);
00164
00165
00166 template <typename T, unsigned m>
00167 void
00168 from_to_(const algebra::vec<3,T>& from, value::rgb<m>& to);
00169
00170
00171
00172 template <unsigned m>
00173 void
00174 from_to_(bool from, value::rgb<m>& to);
00175
00176
00177 void
00178 from_to_(const value::qt::rgb32& from, bool& to);
00179
00180
00181 void
00182 from_to_(const bool& from, value::qt::rgb32& to);
00183
00184
00185 template <unsigned m>
00186 void from_to_(const value::int_u<m>& from, value::rgb<m>& to);
00187
00188
00189 template <unsigned m>
00190 void from_to_(const value::int_u<m>& from, value::qt::rgb32& to);
00191
00192
00193 template <unsigned n>
00194 void from_to_(const value::int_u<n>& from, value::label<n>& to_);
00195
00196
00197 template <unsigned n>
00198 void from_to_(const value::int_u<n>& from, unsigned& to_);
00199
00200
00201 template <unsigned n>
00202 void
00203 from_to_(const value::int_u<n>& from, bool& to_);
00204
00205
00206 template <unsigned n>
00207 void
00208 from_to_(const value::label<n>& from, value::int_u<n>& to_);
00209
00210
00211 template <unsigned n>
00212 void from_to_(const value::label<n>& from, bool& to_);
00213
00214
00215 template <unsigned n, unsigned m>
00216 void
00217 from_to_(const value::int_u<n>& from, value::label<m>& to_);
00218
00219
00220 template <typename H, typename S, typename L>
00221 void from_to_(const value::hsl_<H,S,L>&, value::rgb<8>& to);
00222
00223
00224 template <typename H, typename S, typename L>
00225 void from_to_(const value::hsl_<H,S,L>&, value::rgb<16>& to);
00226
00227
00228 template <typename H, typename S, typename L>
00229 void from_to_(const value::hsl_<H,S,L>&, value::qt::rgb32& to);
00230
00231
00232 void
00233 from_to_(const value::rgb<16>& from, value::hsl_<float,float,float>& to);
00234
00235
00236 void
00237 from_to_(const value::rgb<8>& from, value::hsl_<float,float,float>& to);
00238
00239
00240 template <unsigned m>
00241 void from_to_(const value::rgb<m>& from, bool& to);
00242
00243
00244
00245 template <typename V, unsigned S, typename I>
00246 void
00247 from_to_(const V (&values)[S], Image<I>& to);
00248
00249
00250 template <typename V, unsigned S, typename D, typename W>
00251 void
00252 from_to_(const V (&weight)[S], w_window<D,W>& to);
00253
00254
00255
00256 template <unsigned S>
00257 void
00258 from_to_(const bool (&values)[S],
00259 window< dpoint<grid::square, def::coord> >& win);
00260
00261 template <unsigned R, unsigned C>
00262 void
00263 from_to_(const bool (&values)[R][C],
00264 window< dpoint<grid::square, def::coord> >& win);
00265
00266
00267
00268 template <unsigned S>
00269 void
00270 from_to_(const bool (&values)[S],
00271 window< dpoint<grid::cube, def::coord> >& win);
00272
00273
00274
00275 template <unsigned S>
00276 void
00277 from_to_(const bool (&values)[S],
00278 neighb< window< dpoint<grid::square, def::coord> > >& nbh);
00279
00280 template <unsigned R, unsigned C>
00281 void
00282 from_to_(bool const (&values)[R][C],
00283 neighb< window< dpoint<grid::square, def::coord> > >& nbh);
00284
00285
00286
00287 template <unsigned S>
00288 void
00289 from_to_(const bool (&values)[S],
00290 neighb< window< dpoint<grid::cube, def::coord> > >& nbh);
00291
00292
00293
00294
00295 template <typename D>
00296 void
00297 from_to_(const Gdpoint<D>& from, mln_site(D)& to);
00298
00299
00300
00301 template <typename F, typename T>
00302 void
00303 from_to_(const Value<F>& from, Value<T>& to);
00304
00305
00306 void
00307 from_to_(const unsigned& from, float& to);
00308
00309
00310 template <typename V>
00311 void
00312 from_to_(const double& from, Value<V>& to);
00313
00314
00315 void
00316 from_to_(const double& from, unsigned& to);
00317
00318
00319 void
00320 from_to_(const double& from, int& to);
00321
00322
00323 template <typename V>
00324 void
00325 from_to_(const float& from, Value<V>& to);
00326
00327
00328 void
00329 from_to_(const float& from, unsigned& to);
00330
00331
00332 void
00333 from_to_(const float& from, int& to);
00334
00335
00336 template <typename T>
00337 void
00338 from_to_(const int& from, Value<T>& to);
00339
00340
00341 template <typename P, typename T>
00342 void
00343 from_to_(const Proxy<P>& from, T& to);
00344
00345
00346
00347 template <typename P, unsigned n, typename T>
00348 void
00349 from_to_(const Gpoint<P>& from, algebra::vec<n,T>& to);
00350
00351
00352 template <typename P>
00353 void
00354 from_to_(const Gpoint<P>& from, mln_delta(P)& to);
00355
00356
00357
00358 template <typename I, typename S>
00359 void
00360 from_to_(const Image<I>& from, Site_Set<S>& to);
00361
00362
00363 template <typename I, typename D, typename W>
00364 void
00365 from_to_(const Image<I>& from, w_window<D,W>& to);
00366
00367
00368
00369 template <typename W>
00370 void
00371 from_to_(const mln::neighb<W>& from, W& to);
00372
00373
00374 template <typename W>
00375 void
00376 from_to_(const W& from, mln::neighb<W>& to);
00377
00378
00379
00380 template <typename W, typename I>
00381 void
00382 from_to_(const Window<W>& from, Image<I>& to);
00383
00384
00385
00386 template <typename D, typename W, typename I>
00387 void
00388 from_to_(const w_window<D,W>& from, Image<I>& to);
00389
00390
00391
00392
00393 template <typename T>
00394 void
00395 from_to_(const util::array<T>& from, fun::i2v::array<T>& to);
00396
00397
00398 template <typename T, typename U>
00399 void
00400 from_to_(const util::array<T>& from, fun::i2v::array<U>& to);
00401
00402
00403 template <typename T>
00404 void
00405 from_to_(const std::vector<T>& from, fun::i2v::array<T>& to);
00406
00407
00408 template <typename T, typename U>
00409 void
00410 from_to_(const std::vector<T>& from, fun::i2v::array<U>& to);
00411
00412
00413 template <typename T1, typename T2>
00414 void
00415 from_to_(const util::array<T1>& from, util::array<T2>& to);
00416
00417
00418
00419
00420 template <typename T1, typename T2>
00421 void
00422 from_to_(const util::array<T1>& from, util::array<T2>& to);
00423
00424
00425 template <typename T1, typename T2>
00426 void
00427 from_to_(const fun::i2v::array<T1>& from, util::array<T2>& to);
00428
00429
00430
00431 template <typename A>
00432 void
00433 from_to_(const Accumulator<A>& from, mln_result(A)& to);
00434
00435
00436
00437
00438 template <typename S, typename I>
00439 void
00440 from_to_(const Site_Set<S>& from, Image<I>& to);
00441
00442
00443 template <typename S, typename P, typename C_>
00444 void
00445 from_to_(const Site_Set<S>& from, std::set<P,C_>& to);
00446
00447
00448 template <typename P, typename C_, typename S>
00449 void
00450 from_to_(const std::set<P,C_>& from, Site_Set<S>& to);
00451
00452
00453 template <typename V, typename T>
00454 void
00455 from_to_(const histo::array<V>& from, image1d<T>& to);
00456
00457
00458 template <typename V, typename T>
00459 void
00460 from_to_(const util::array<V>& from, image1d<T>& to);
00461
00462
00463 template <typename T, typename U, typename V, typename W>
00464 void
00465 from_to_(const util::couple<T, U>& from, util::couple<V, W>& to)
00466 {
00467 from_to(from.first(), to.first());
00468 from_to(from.second(), to.second());
00469 }
00470
00471 }
00472
00473 }
00474
00475 }
00476
00477
00478 #endif // ! MLN_CONVERT_FROM_TO_HXX