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