• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

from_to.hxx

00001 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #ifndef MLN_CONVERT_FROM_TO_HXX
00027 # define MLN_CONVERT_FROM_TO_HXX
00028 
00030 
00031 // All overloaded "convert::from_to" routines have to be declared in
00032 // the present file.  It allows for *deferred* use of these routines.
00033 
00034 # include <mln/core/def/all.hh>
00035 # include <mln/core/grids.hh>
00036 # include <mln/util/couple.hh>
00037 
00038 //FIXME: have a forward declaration.
00039 # include <vector>
00040 # include <set>
00041 
00042 
00043 namespace mln
00044 {
00045 
00046 
00047   // Forward declarations.
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   // end of Forward declarations.
00097 
00098 
00099 
00100   // convert::to
00101 
00102   namespace convert
00103   {
00104 
00105     template <typename T, typename O>
00106     T
00107     to(const O& from);
00108 
00109   } // end of namespace mln::convert
00110 
00111 
00112 
00113   // convert::from_to
00114 
00115   namespace convert
00116   {
00117 
00118     // Facade
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       // Guard.
00129       template <typename F, typename T>
00130       void
00131       from_to_(const Object<F>&, Object<T>&);
00132       // end of Guard.
00133 
00134       // Object -> Object
00135       template <typename T>
00136       void
00137       from_to_(const Object<T>& from, Object<T>& to);
00138 
00139       // Object -> Object
00140       template <typename T>
00141       void
00142       from_to_(const T& from, T& to);
00143 
00144       // point -> point.
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       // algebra::vec -> point
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       // algebra::vec -> point
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       // algebra::vec -> Gpoint.
00161       template <unsigned n, typename T, typename P>
00162       void
00163       from_to_(const algebra::vec<n,T>& from, Gpoint<P>& to_);
00164 
00165       // algebra::vec -> rgb.
00166       template <typename T, unsigned m>
00167       void
00168       from_to_(const algebra::vec<3,T>& from, value::rgb<m>& to);
00169 
00170 
00171       // bool -> rgb.
00172       template <unsigned m>
00173       void
00174       from_to_(bool from, value::rgb<m>& to);
00175 
00176       // rgb32 -> bool
00177       void
00178       from_to_(const value::qt::rgb32& from, bool& to);
00179 
00180       // bool -> rgb32
00181       void
00182       from_to_(const bool& from, value::qt::rgb32& to);
00183 
00184       // int_u -> rgb.
00185       template <unsigned m>
00186       void from_to_(const value::int_u<m>& from, value::rgb<m>& to);
00187 
00188       // int_u -> qt::rgb32.
00189       template <unsigned m>
00190       void from_to_(const value::int_u<m>& from, value::qt::rgb32& to);
00191 
00192       // int_u -> label
00193       template <unsigned n>
00194       void from_to_(const value::int_u<n>& from, value::label<n>& to_);
00195 
00196       // int_u -> unsigned
00197       template <unsigned n>
00198       void from_to_(const value::int_u<n>& from, unsigned& to_);
00199 
00200       // int_u -> bool.
00201       template <unsigned n>
00202       void
00203       from_to_(const value::int_u<n>& from, bool& to_);
00204 
00205       // label -> int_u.
00206       template <unsigned n>
00207       void
00208       from_to_(const value::label<n>& from, value::int_u<n>& to_);
00209 
00210       // label -> bool
00211       template <unsigned n>
00212       void from_to_(const value::label<n>& from, bool& to_);
00213 
00214       // int_u<n> -> label<m> with n < m
00215       template <unsigned n, unsigned m>
00216       void
00217       from_to_(const value::int_u<n>& from, value::label<m>& to_);
00218 
00219       // hsl -> rgb8.
00220       template <typename H, typename S, typename L>
00221       void from_to_(const value::hsl_<H,S,L>&, value::rgb<8>& to);
00222 
00223       // hsl -> rgb16.
00224       template <typename H, typename S, typename L>
00225       void from_to_(const value::hsl_<H,S,L>&, value::rgb<16>& to);
00226 
00227       // hsl -> qt::rgb32.
00228       template <typename H, typename S, typename L>
00229       void from_to_(const value::hsl_<H,S,L>&, value::qt::rgb32& to);
00230 
00231       // rgb to hsl
00232       void
00233       from_to_(const value::rgb<16>& from, value::hsl_<float,float,float>& to);
00234 
00235       // rgb to hsl
00236       void
00237       from_to_(const value::rgb<8>& from, value::hsl_<float,float,float>& to);
00238 
00239       // rgb -> bool.
00240       template <unsigned m>
00241       void from_to_(const value::rgb<m>& from, bool& to);
00242 
00243 
00244       // C-array -> Image.
00245       template <typename V, unsigned S, typename I>
00246       void
00247       from_to_(const V (&values)[S], Image<I>& to);
00248 
00249       // C-array -> w_window
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       // C-array -> window2d
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       // C-array -> window3d
00268       template <unsigned S>
00269       void
00270       from_to_(const bool (&values)[S],
00271                window< dpoint<grid::cube, def::coord> >& win);
00272 
00273 
00274       // C-array -> neighb2d
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       // C-array -> neighb3d
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       // Gdpoint -> point
00295       template <typename D>
00296       void
00297       from_to_(const Gdpoint<D>& from, mln_site(D)& to);
00298 
00299 
00300       // Value -> Value
00301       template <typename F, typename T>
00302       void
00303       from_to_(const Value<F>& from, Value<T>& to);
00304 
00305       // unsigned -> float
00306       void
00307       from_to_(const unsigned& from, float& to);
00308 
00309       // double-> Value
00310       template <typename V>
00311       void
00312       from_to_(const double& from, Value<V>& to);
00313 
00314       // double-> unsigned
00315       void
00316       from_to_(const double& from, unsigned& to);
00317 
00318       // double-> int
00319       void
00320       from_to_(const double& from, int& to);
00321 
00322       // float -> Value
00323       template <typename V>
00324       void
00325       from_to_(const float& from, Value<V>& to);
00326 
00327       // float -> unsigned
00328       void
00329       from_to_(const float& from, unsigned& to);
00330 
00331       // float -> int
00332       void
00333       from_to_(const float& from, int& to);
00334 
00335       // int -> Value
00336       template <typename T>
00337       void
00338       from_to_(const int& from, Value<T>& to);
00339 
00340       // Proxy -> T
00341       template <typename P, typename T>
00342       void
00343       from_to_(const Proxy<P>& from, T& to);
00344 
00345 
00346       // Gpoint -> algebra::vec.
00347       template <typename P, unsigned n, typename T>
00348       void
00349       from_to_(const Gpoint<P>& from, algebra::vec<n,T>& to);
00350 
00351       // Gpoint -> delta-point
00352       template <typename P>
00353       void
00354       from_to_(const Gpoint<P>& from, mln_delta(P)& to);
00355 
00356 
00357       // Image -> Site_Set.
00358       template <typename I, typename S>
00359       void
00360       from_to_(const Image<I>& from, Site_Set<S>& to);
00361 
00362       // Image -> w_window
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       // neighb<W> -> W
00369       template <typename W>
00370       void
00371       from_to_(const mln::neighb<W>& from, W& to);
00372 
00373       // W -> neighb<W>
00374       template <typename W>
00375       void
00376       from_to_(const W& from, mln::neighb<W>& to);
00377 
00378 
00379       // Window -> Image
00380       template <typename W, typename I>
00381       void
00382       from_to_(const Window<W>& from, Image<I>& to);
00383 
00384 
00385       // w_window -> Image
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       // util::array<T> -> fun::i2v::array<T>
00393       template <typename T>
00394       void
00395       from_to_(const util::array<T>& from, fun::i2v::array<T>& to);
00396 
00397       // util::array<T> -> fun::i2v::array<U>
00398       template <typename T, typename U>
00399       void
00400       from_to_(const util::array<T>& from, fun::i2v::array<U>& to);
00401 
00402       // std::vector<T> -> fun::i2v::array<T>
00403       template <typename T>
00404       void
00405       from_to_(const std::vector<T>& from, fun::i2v::array<T>& to);
00406 
00407       // std::vector<T> -> fun::i2v::array<U>
00408       template <typename T, typename U>
00409       void
00410       from_to_(const std::vector<T>& from, fun::i2v::array<U>& to);
00411 
00412       // util::array<T1> -> util::array<T2>
00413       template <typename T1, typename T2>
00414       void
00415       from_to_(const util::array<T1>& from, util::array<T2>& to);
00416 
00417 
00418 
00419       // util::array<T1> -> util::array<T2>
00420       template <typename T1, typename T2>
00421       void
00422       from_to_(const util::array<T1>& from, util::array<T2>& to);
00423 
00424       // fun::i2v::array<T1> -> util::array<T2>
00425       template <typename T1, typename T2>
00426       void
00427       from_to_(const fun::i2v::array<T1>& from, util::array<T2>& to);
00428 
00429 
00430       // Accumulator<A> -> mln_result(A)
00431       template <typename A>
00432       void
00433       from_to_(const Accumulator<A>& from, mln_result(A)& to);
00434 
00435 
00436 
00437       // Site_Set -> Image.
00438       template <typename S, typename I>
00439       void
00440       from_to_(const Site_Set<S>& from, Image<I>& to);
00441 
00442       // Site_Set -> std::set
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       // std::set -> Site_Set
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       // histo::array -> image1d
00453       template <typename V, typename T>
00454       void
00455       from_to_(const histo::array<V>& from, image1d<T>& to);
00456 
00457       // util::array -> image1d
00458       template <typename V, typename T>
00459       void
00460       from_to_(const util::array<V>& from, image1d<T>& to);
00461 
00462       // util::couple<T, U> -> util::couple<V, W>
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     } // end of namespace mln::convert::over_load
00472 
00473   } // end of namespace mln::convert
00474 
00475 } // end of namespace mln
00476 
00477 
00478 #endif // ! MLN_CONVERT_FROM_TO_HXX

Generated on Fri Oct 19 2012 04:15:48 for Milena (Olena) by  doxygen 1.7.1