• 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     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   // end of Forward declarations.
00096 
00097 
00098 
00099   // convert::to
00100 
00101   namespace convert
00102   {
00103 
00104     template <typename T, typename O>
00105     T
00106     to(const O& from);
00107 
00108   } // end of namespace mln::convert
00109 
00110 
00111 
00112   // convert::from_to
00113 
00114   namespace convert
00115   {
00116 
00117     // Facade
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       // Guard.
00128       template <typename F, typename T>
00129       void
00130       from_to_(const Object<F>&, Object<T>&);
00131       // end of Guard.
00132 
00133       // Object -> Object
00134       template <typename T>
00135       void
00136       from_to_(const Object<T>& from, Object<T>& to);
00137 
00138       // Object -> Object
00139       template <typename T>
00140       void
00141       from_to_(const T& from, T& to);
00142 
00143       // point -> point.
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       // algebra::vec -> Gpoint.
00150       template <unsigned n, typename T, typename P>
00151       void
00152       from_to_(const algebra::vec<n,T>& from, Gpoint<P>& to_);
00153 
00154       // algebra::vec -> rgb.
00155       template <typename T, unsigned m>
00156       void
00157       from_to_(const algebra::vec<3,T>& from, value::rgb<m>& to);
00158 
00159 
00160       // bool -> rgb.
00161       template <unsigned m>
00162       void
00163       from_to_(bool from, value::rgb<m>& to);
00164 
00165       // int_u -> rgb.
00166       template <unsigned m>
00167       void from_to_(const value::int_u<m>& from, value::rgb<m>& to);
00168 
00169       // int_u -> label
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       // int_u<n> -> label<m> with n < m
00177       template <unsigned n, unsigned m>
00178       void
00179       from_to_(const value::int_u<n>& from, value::label<m>& to_);
00180 
00181       // hsl -> rgb8.
00182       template <typename H, typename S, typename L>
00183       void from_to_(const value::hsl_<H,S,L>&, value::rgb<8>& to);
00184 
00185       // hsl -> rgb16.
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       // rgb to hsl
00191       void
00192       from_to_(const value::rgb<16>& from, value::hsl_<float,float,float>& to);
00193 
00194       // rgb to hsl
00195       void
00196       from_to_(const value::rgb<8>& from, value::hsl_<float,float,float>& to);
00197 
00198       // rgb -> bool.
00199       template <unsigned m>
00200       void from_to_(const value::rgb<m>& from, bool& to);
00201 
00202 
00203       // C-array -> Image.
00204       template <typename V, unsigned S, typename I>
00205       void
00206       from_to_(const V (&values)[S], Image<I>& to);
00207 
00208       // C-array -> w_window
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       // C-array -> window2d
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       // C-array -> window3d
00227       template <unsigned S>
00228       void
00229       from_to_(const bool (&values)[S],
00230                window< dpoint<grid::cube, def::coord> >& win);
00231 
00232 
00233       // C-array -> neighb2d
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       // C-array -> neighb3d
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       // Gdpoint -> point
00254       template <typename D>
00255       void
00256       from_to_(const Gdpoint<D>& from, mln_site(D)& to);
00257 
00258 
00259       // Value -> Value
00260       template <typename F, typename T>
00261       void
00262       from_to_(const Value<F>& from, Value<T>& to);
00263 
00264       // double-> Value
00265       template <typename V>
00266       void
00267       from_to_(const double& from, Value<V>& to);
00268 
00269       // double-> unsigned
00270       void
00271       from_to_(const double& from, unsigned& to);
00272 
00273       // double-> int
00274       void
00275       from_to_(const double& from, int& to);
00276 
00277       // float -> Value
00278       template <typename V>
00279       void
00280       from_to_(const float& from, Value<V>& to);
00281 
00282       // float -> unsigned
00283       void
00284       from_to_(const float& from, unsigned& to);
00285 
00286       // float -> int
00287       void
00288       from_to_(const float& from, int& to);
00289 
00290       // int -> Value
00291       template <typename T>
00292       void
00293       from_to_(const int& from, Value<T>& to);
00294 
00295       // Proxy -> T
00296       template <typename P, typename T>
00297       void
00298       from_to_(const Proxy<P>& from, T& to);
00299 
00300 
00301       // Gpoint -> algebra::vec.
00302       template <typename P, unsigned n, typename T>
00303       void
00304       from_to_(const Gpoint<P>& from, algebra::vec<n,T>& to);
00305 
00306       // Gpoint -> delta-point
00307       template <typename P>
00308       void
00309       from_to_(const Gpoint<P>& from, mln_delta(P)& to);
00310 
00311 
00312       // Image -> Site_Set.
00313       template <typename I, typename S>
00314       void
00315       from_to_(const Image<I>& from, Site_Set<S>& to);
00316 
00317       // Image -> w_window
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       // neighb<W> -> W
00324       template <typename W>
00325       void
00326       from_to_(const mln::neighb<W>& from, W& to);
00327 
00328       // W -> neighb<W>
00329       template <typename W>
00330       void
00331       from_to_(const W& from, mln::neighb<W>& to);
00332 
00333 
00334       // Window -> Image
00335       template <typename W, typename I>
00336       void
00337       from_to_(const Window<W>& from, Image<I>& to);
00338 
00339 
00340       // w_window -> Image
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       // util::array<T> -> fun::i2v::array<T>
00348       template <typename T>
00349       void
00350       from_to_(const util::array<T>& from, fun::i2v::array<T>& to);
00351 
00352       // util::array<T> -> fun::i2v::array<U>
00353       template <typename T, typename U>
00354       void
00355       from_to_(const util::array<T>& from, fun::i2v::array<U>& to);
00356 
00357       // std::vector<T> -> fun::i2v::array<T>
00358       template <typename T>
00359       void
00360       from_to_(const std::vector<T>& from, fun::i2v::array<T>& to);
00361 
00362       // std::vector<T> -> fun::i2v::array<U>
00363       template <typename T, typename U>
00364       void
00365       from_to_(const std::vector<T>& from, fun::i2v::array<U>& to);
00366 
00367       // util::array<T1> -> util::array<T2>
00368       template <typename T1, typename T2>
00369       void
00370       from_to_(const util::array<T1>& from, util::array<T2>& to);
00371 
00372 
00373 
00374       // util::array<T1> -> util::array<T2>
00375       template <typename T1, typename T2>
00376       void
00377       from_to_(const util::array<T1>& from, util::array<T2>& to);
00378 
00379 
00380 
00381       // Accumulator<A> -> mln_result(A)
00382       template <typename A>
00383       void
00384       from_to_(const Accumulator<A>& from, mln_result(A)& to);
00385 
00386 
00387 
00388       // Site_Set -> Image.
00389       template <typename S, typename I>
00390       void
00391       from_to_(const Site_Set<S>& from, Image<I>& to);
00392 
00393       // Site_Set -> std::set
00394       template <typename S, typename P, typename C_>
00395       void
00396       from_to_(const Site_Set<S>& from, std::set<P,C_>& to);
00397 
00398       // std::set -> Site_Set
00399       template <typename P, typename C_, typename S>
00400       void
00401       from_to_(const std::set<P,C_>& from, Site_Set<S>& to);
00402 
00403       // histo::array -> image1d
00404       template <typename V, typename T>
00405       void
00406       from_to_(const histo::array<V>& from, image1d<T>& to);
00407 
00408       // util::array -> image1d
00409       template <typename V, typename T>
00410       void
00411       from_to_(const util::array<V>& from, image1d<T>& to);
00412 
00413       // util::couple<T, U> -> util::couple<V, W>
00414       template <typename T, typename U, typename V, typename W>
00415       void
00416       from_to_(const util::couple<T, U>& from, util::couple<V, W>& to)
00417       {
00418         from_to(from.first(), to.first());
00419         from_to(from.second(), to.second());
00420       }
00421 
00422     } // end of namespace mln::convert::over_load
00423 
00424   } // end of namespace mln::convert
00425 
00426 } // end of namespace mln
00427 
00428 
00429 #endif // ! MLN_CONVERT_FROM_TO_HXX

Generated on Thu Sep 8 2011 18:31:51 for Milena (Olena) by  doxygen 1.7.1