LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
List overview
Download
Olena-patches
November 2010
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
olena-patches@lrde.epita.fr
7 participants
370 discussions
Start a n
N
ew thread
last-svn-commit-645-gbd9472a mln/fun/v2v/rgb8_to_rgbn.hh: Import rgb8 to rgbn conversion function from Yann's sandbox.
by Guillaume Lazzara
--- .../green => milena}/mln/fun/v2v/rgb8_to_rgbn.hh | 82 +++++++++----------- scribo/ChangeLog | 6 ++ 2 files changed, 42 insertions(+), 46 deletions(-) copy {scribo/sandbox/green => milena}/mln/fun/v2v/rgb8_to_rgbn.hh (61%) diff --git a/scribo/sandbox/green/mln/fun/v2v/rgb8_to_rgbn.hh b/milena/mln/fun/v2v/rgb8_to_rgbn.hh similarity index 61% copy from scribo/sandbox/green/mln/fun/v2v/rgb8_to_rgbn.hh copy to milena/mln/fun/v2v/rgb8_to_rgbn.hh index acf1b5e..f1f3611 100644 --- a/scribo/sandbox/green/mln/fun/v2v/rgb8_to_rgbn.hh +++ b/milena/mln/fun/v2v/rgb8_to_rgbn.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008, 2009, 2010 EPITA LRDE +// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -23,9 +23,10 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_FUN_V2V_RGB8_TO_RGBN_HH +#ifndef MLN_FUN_V2V_RGB8_TO_RGBN_HH # define MLN_FUN_V2V_RGB8_TO_RGBN_HH +# include <mln/core/concept/function.hh> # include <mln/value/rgb8.hh> # include <mln/value/rgb.hh> # include <mln/core/contract.hh> @@ -33,36 +34,6 @@ /// \file /// /// \brief Convert rgb8 value to rgbn, n < 8. -/// -/// The source implements the reduction of quantification for any size less 8. -/// -/// The following sample is a typical use of the histogram. -/// -/// #include <mln/accu/stat/histo3d_rgb.hh> -/// #include <mln/core/image/image2d.hh> -/// #include <mln/core/image/image3d.hh> -/// #include <mln/data/compute.hh> -/// #include <mln/data/transform.hh> -/// #include <mln/fun/v2v/rgb8_to_rgbn.hh> -/// #include <mln/img_path.hh> -/// #include <mln/io/ppm/load.hh> -/// #include <mln/value/rgb.hh> -/// #include <mln/value/rgb8.hh> -/// -/// int main() -/// { -/// typedef mln::value::rgb8 t_rgb8; -/// typedef mln::value::rgb<7> t_rgb7; -/// mln::image2d<t_rgb8> img_rgb8; -/// mln::image2d<t_rgb7> img_rgb7; -/// mln::image3d<unsigned> histo; -/// -/// mln::io::ppm::load(img_rgb8, OLENA_IMG_PATH"/lena.ppm"); -/// img_rgb7 =mln::data::transform(img_rgb8,mln::fun::v2v::rgb8_to_rgbn<7>()); -/// histo = mln::data::compute(mln::accu::meta::stat::histo3d_rgb(),img_rgb7); -/// -/// return 0; -/// } namespace mln @@ -74,11 +45,13 @@ namespace mln namespace v2v { + /// \brief Convert a rgb8 value to a rgn, n < 8. /// - /// Param n defines the output quantification used for the transformation. + /// \param n defines the output quantification used for the transformation. /// /// \ingroup modfunv2v + // template <unsigned n> struct rgb8_to_rgbn : Function_v2v< rgb8_to_rgbn<n> > { @@ -91,29 +64,46 @@ namespace mln /// /// Conversion is done by computing the size by which we /// divide each rgb component. + // + result operator()(const argument& c) const; + + }; + - result operator()(const argument& c) const - { - mln_precondition(8 > n); +# ifndef MLN_INCLUDE_ONLY - unsigned size = pow(2,(8-n)); - /* + /// \brief Convert a rgb8 value to a rgn, n < 8. + /// + /// \param n defines the output quantification used for the transformation. + /// + /// \ingroup modfunv2v + // + template <unsigned n> + typename rgb8_to_rgbn<n>::result + rgb8_to_rgbn<n>::operator()(const argument& c) const + { + mln_precondition(8 > n); + + unsigned size = pow(2,(8-n)); + /* std::cout << "c : " << c << std::endl; std::cout << "red : " << c.red() << std::endl; std::cout << "size : " << size << std::endl; std::cout << "res : " << (c.red() / size) << std::endl; std::cout << "max : " << (mln_max(mln::value::int_u<n>))<< std::endl; - */ - result res(c.red() / size, c.green() / size, c.blue() / size); + */ + result res(c.red() / size, c.green() / size, c.blue() / size); + + return res; + } + +# endif // ! MLN_INCLUDE_ONLY - return res; - } - }; - } + } // end of namespace mln::fun::v2v - } + } // end of namespace mln::fun -} +} // end of namespace mln #endif // ! MLN_FUN_V2V_RGB8_TO_RGBN_HH diff --git a/scribo/ChangeLog b/scribo/ChangeLog index e0d155a..cd8db5d 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,11 @@ 2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + Import rgb8 to rgbn conversion function from Yann's sandbox. + + * mln/fun/v2v/rgb8_to_rgbn.hh: New. + +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * scribo/core/macros.hh: Remove deprecated macro. 2010-09-02 Guillaume Lazzara <z(a)lrde.epita.fr> -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-646-gdc8a597 mln/fun/v2v/rgb8_to_rgbn.hh: Import rgb8 to rgbn conversion function from Yann's sandbox.
by Guillaume Lazzara
--- .../green => milena}/mln/fun/v2v/rgb8_to_rgbn.hh | 82 +++++++++----------- scribo/ChangeLog | 6 ++ 2 files changed, 42 insertions(+), 46 deletions(-) copy {scribo/sandbox/green => milena}/mln/fun/v2v/rgb8_to_rgbn.hh (61%) diff --git a/scribo/sandbox/green/mln/fun/v2v/rgb8_to_rgbn.hh b/milena/mln/fun/v2v/rgb8_to_rgbn.hh similarity index 61% copy from scribo/sandbox/green/mln/fun/v2v/rgb8_to_rgbn.hh copy to milena/mln/fun/v2v/rgb8_to_rgbn.hh index acf1b5e..f1f3611 100644 --- a/scribo/sandbox/green/mln/fun/v2v/rgb8_to_rgbn.hh +++ b/milena/mln/fun/v2v/rgb8_to_rgbn.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008, 2009, 2010 EPITA LRDE +// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -23,9 +23,10 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_FUN_V2V_RGB8_TO_RGBN_HH +#ifndef MLN_FUN_V2V_RGB8_TO_RGBN_HH # define MLN_FUN_V2V_RGB8_TO_RGBN_HH +# include <mln/core/concept/function.hh> # include <mln/value/rgb8.hh> # include <mln/value/rgb.hh> # include <mln/core/contract.hh> @@ -33,36 +34,6 @@ /// \file /// /// \brief Convert rgb8 value to rgbn, n < 8. -/// -/// The source implements the reduction of quantification for any size less 8. -/// -/// The following sample is a typical use of the histogram. -/// -/// #include <mln/accu/stat/histo3d_rgb.hh> -/// #include <mln/core/image/image2d.hh> -/// #include <mln/core/image/image3d.hh> -/// #include <mln/data/compute.hh> -/// #include <mln/data/transform.hh> -/// #include <mln/fun/v2v/rgb8_to_rgbn.hh> -/// #include <mln/img_path.hh> -/// #include <mln/io/ppm/load.hh> -/// #include <mln/value/rgb.hh> -/// #include <mln/value/rgb8.hh> -/// -/// int main() -/// { -/// typedef mln::value::rgb8 t_rgb8; -/// typedef mln::value::rgb<7> t_rgb7; -/// mln::image2d<t_rgb8> img_rgb8; -/// mln::image2d<t_rgb7> img_rgb7; -/// mln::image3d<unsigned> histo; -/// -/// mln::io::ppm::load(img_rgb8, OLENA_IMG_PATH"/lena.ppm"); -/// img_rgb7 =mln::data::transform(img_rgb8,mln::fun::v2v::rgb8_to_rgbn<7>()); -/// histo = mln::data::compute(mln::accu::meta::stat::histo3d_rgb(),img_rgb7); -/// -/// return 0; -/// } namespace mln @@ -74,11 +45,13 @@ namespace mln namespace v2v { + /// \brief Convert a rgb8 value to a rgn, n < 8. /// - /// Param n defines the output quantification used for the transformation. + /// \param n defines the output quantification used for the transformation. /// /// \ingroup modfunv2v + // template <unsigned n> struct rgb8_to_rgbn : Function_v2v< rgb8_to_rgbn<n> > { @@ -91,29 +64,46 @@ namespace mln /// /// Conversion is done by computing the size by which we /// divide each rgb component. + // + result operator()(const argument& c) const; + + }; + - result operator()(const argument& c) const - { - mln_precondition(8 > n); +# ifndef MLN_INCLUDE_ONLY - unsigned size = pow(2,(8-n)); - /* + /// \brief Convert a rgb8 value to a rgn, n < 8. + /// + /// \param n defines the output quantification used for the transformation. + /// + /// \ingroup modfunv2v + // + template <unsigned n> + typename rgb8_to_rgbn<n>::result + rgb8_to_rgbn<n>::operator()(const argument& c) const + { + mln_precondition(8 > n); + + unsigned size = pow(2,(8-n)); + /* std::cout << "c : " << c << std::endl; std::cout << "red : " << c.red() << std::endl; std::cout << "size : " << size << std::endl; std::cout << "res : " << (c.red() / size) << std::endl; std::cout << "max : " << (mln_max(mln::value::int_u<n>))<< std::endl; - */ - result res(c.red() / size, c.green() / size, c.blue() / size); + */ + result res(c.red() / size, c.green() / size, c.blue() / size); + + return res; + } + +# endif // ! MLN_INCLUDE_ONLY - return res; - } - }; - } + } // end of namespace mln::fun::v2v - } + } // end of namespace mln::fun -} +} // end of namespace mln #endif // ! MLN_FUN_V2V_RGB8_TO_RGBN_HH diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 95fcab4..dd11567 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,11 @@ 2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + Import rgb8 to rgbn conversion function from Yann's sandbox. + + * mln/fun/v2v/rgb8_to_rgbn.hh: New. + +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * scribo/core/macros.hh: Remove deprecated macro. 2010-09-02 Guillaume Lazzara <z(a)lrde.epita.fr> -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-655-g52af6ec scribo/core/component_set.hh: Combine separator images.
by Guillaume Lazzara
--- scribo/scribo/core/component_set.hh | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/scribo/scribo/core/component_set.hh b/scribo/scribo/core/component_set.hh index 77cbaa5..103826f 100644 --- a/scribo/scribo/core/component_set.hh +++ b/scribo/scribo/core/component_set.hh @@ -46,6 +46,8 @@ # include <mln/labeling/compute.hh> # include <mln/labeling/relabel.hh> +# include <mln/logical/or.hh> + # include <mln/convert/from_to.hh> # include <mln/core/image/dmorph/image_if.hh> @@ -541,7 +543,10 @@ namespace scribo void component_set<L>::add_separators(const mln_ch_value(L, bool)& ima) { - this->data_->separators_ = ima; + if (! has_separators()) + this->data_->separators_ = ima; + else + mln::logical::or_inplace(this->data_->separators_, ima); } -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-656-gb7fe0b0 scribo/core/component_set.hh: Combine separator images.
by Guillaume Lazzara
--- scribo/scribo/core/component_set.hh | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/scribo/scribo/core/component_set.hh b/scribo/scribo/core/component_set.hh index 77cbaa5..103826f 100644 --- a/scribo/scribo/core/component_set.hh +++ b/scribo/scribo/core/component_set.hh @@ -46,6 +46,8 @@ # include <mln/labeling/compute.hh> # include <mln/labeling/relabel.hh> +# include <mln/logical/or.hh> + # include <mln/convert/from_to.hh> # include <mln/core/image/dmorph/image_if.hh> @@ -541,7 +543,10 @@ namespace scribo void component_set<L>::add_separators(const mln_ch_value(L, bool)& ima) { - this->data_->separators_ = ima; + if (! has_separators()) + this->data_->separators_ = ima; + else + mln::logical::or_inplace(this->data_->separators_, ima); } -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-644-g33f5637 scribo/core/macros.hh: Remove deprecated macro.
by Guillaume Lazzara
--- scribo/ChangeLog | 4 ++++ scribo/scribo/core/macros.hh | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 9d47519..e0d155a 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,7 @@ +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + + * scribo/core/macros.hh: Remove deprecated macro. + 2010-09-02 Guillaume Lazzara <z(a)lrde.epita.fr> * scribo/core/document.hh: Introduce new document structure. diff --git a/scribo/scribo/core/macros.hh b/scribo/scribo/core/macros.hh index 07a101a..f7de5b6 100644 --- a/scribo/scribo/core/macros.hh +++ b/scribo/scribo/core/macros.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -29,9 +30,6 @@ # define for_all_ncomponents(C, NCOMP) \ for (unsigned C = 1; C <= NCOMP; ++C) -// # define for_all_components(C, S) -// for (unsigned C = 1; C <= S.nelements(); ++C) - # define for_all_elements(E, S) \ for (unsigned E = 0; E < S.nelements(); ++E) -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-645-ga6d10b9 scribo/core/macros.hh: Remove deprecated macro.
by Guillaume Lazzara
--- scribo/ChangeLog | 4 ++++ scribo/scribo/core/macros.hh | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 3c66038..95fcab4 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,7 @@ +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + + * scribo/core/macros.hh: Remove deprecated macro. + 2010-09-02 Guillaume Lazzara <z(a)lrde.epita.fr> * scribo/core/document.hh: Introduce new document structure. diff --git a/scribo/scribo/core/macros.hh b/scribo/scribo/core/macros.hh index 07a101a..f7de5b6 100644 --- a/scribo/scribo/core/macros.hh +++ b/scribo/scribo/core/macros.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -29,9 +30,6 @@ # define for_all_ncomponents(C, NCOMP) \ for (unsigned C = 1; C <= NCOMP; ++C) -// # define for_all_components(C, S) -// for (unsigned C = 1; C <= S.nelements(); ++C) - # define for_all_elements(E, S) \ for (unsigned E = 0; E < S.nelements(); ++E) -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-592-g38f31bc Add conversions from int_u to float and double.
by Guillaume Lazzara
* mln/convert/from_to.hxx, * mln/value/int_u.hh: Here. --- milena/ChangeLog | 7 +++++++ milena/mln/convert/from_to.hxx | 11 ++++++++++- milena/mln/value/int_u.hh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 9cbc2db..d33bcc4 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,12 @@ 2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + Add conversions from int_u to float and double. + + * mln/convert/from_to.hxx, + * mln/value/int_u.hh: Here. + +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * mln/convert/from_to.hh: Make use of value::cast for conversions between built-in types. diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx index f4f690d..24f974a 100644 --- a/milena/mln/convert/from_to.hxx +++ b/milena/mln/convert/from_to.hxx @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -202,6 +203,14 @@ namespace mln void from_to_(const value::int_u<n>& from, bool& to_); + // int_u -> float + template <unsigned n> + void from_to_(const value::int_u<n>& from, float& to_); + + // int_u -> double + template <unsigned n> + void from_to_(const value::int_u<n>& from, double& to_); + // label -> int_u. template <unsigned n> void diff --git a/milena/mln/value/int_u.hh b/milena/mln/value/int_u.hh index 9bf40ff..f3786f9 100644 --- a/milena/mln/value/int_u.hh +++ b/milena/mln/value/int_u.hh @@ -128,6 +128,18 @@ namespace mln from_to_(const value::int_u<n>& from, bool& to_); + // int_u -> float. + template <unsigned n> + void + from_to_(const value::int_u<n>& from, float& to_); + + + // int_u -> double. + template <unsigned n> + void + from_to_(const value::int_u<n>& from, double& to_); + + } // end of namespace mln::convert::over_load } // end of namespace mln::convert @@ -232,6 +244,24 @@ namespace mln to_ = (from != 0u); } + // int_u -> float. + template <unsigned n> + inline + void + from_to_(const value::int_u<n>& from, float& to_) + { + to_ = static_cast<float>(from); + } + + // int_u -> double. + template <unsigned n> + inline + void + from_to_(const value::int_u<n>& from, double& to_) + { + to_ = static_cast<double>(from); + } + } // end of namespace mln::convert::over_load -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-593-g05e90bb Add conversions from int_u to float and double.
by Guillaume Lazzara
* mln/convert/from_to.hxx, * mln/value/int_u.hh: Here. --- milena/ChangeLog | 7 +++++++ milena/mln/convert/from_to.hxx | 11 ++++++++++- milena/mln/value/int_u.hh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 9cbc2db..d33bcc4 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,12 @@ 2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + Add conversions from int_u to float and double. + + * mln/convert/from_to.hxx, + * mln/value/int_u.hh: Here. + +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * mln/convert/from_to.hh: Make use of value::cast for conversions between built-in types. diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx index f4f690d..24f974a 100644 --- a/milena/mln/convert/from_to.hxx +++ b/milena/mln/convert/from_to.hxx @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -202,6 +203,14 @@ namespace mln void from_to_(const value::int_u<n>& from, bool& to_); + // int_u -> float + template <unsigned n> + void from_to_(const value::int_u<n>& from, float& to_); + + // int_u -> double + template <unsigned n> + void from_to_(const value::int_u<n>& from, double& to_); + // label -> int_u. template <unsigned n> void diff --git a/milena/mln/value/int_u.hh b/milena/mln/value/int_u.hh index 9bf40ff..f3786f9 100644 --- a/milena/mln/value/int_u.hh +++ b/milena/mln/value/int_u.hh @@ -128,6 +128,18 @@ namespace mln from_to_(const value::int_u<n>& from, bool& to_); + // int_u -> float. + template <unsigned n> + void + from_to_(const value::int_u<n>& from, float& to_); + + + // int_u -> double. + template <unsigned n> + void + from_to_(const value::int_u<n>& from, double& to_); + + } // end of namespace mln::convert::over_load } // end of namespace mln::convert @@ -232,6 +244,24 @@ namespace mln to_ = (from != 0u); } + // int_u -> float. + template <unsigned n> + inline + void + from_to_(const value::int_u<n>& from, float& to_) + { + to_ = static_cast<float>(from); + } + + // int_u -> double. + template <unsigned n> + inline + void + from_to_(const value::int_u<n>& from, double& to_) + { + to_ = static_cast<double>(from); + } + } // end of namespace mln::convert::over_load -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-591-g85d4bb7 mln/convert/from_to.hh: Make use of value::cast for conversions between built-in types.
by Guillaume Lazzara
--- milena/ChangeLog | 5 +++++ milena/mln/convert/from_to.hh | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 77ad3a4..9cbc2db 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,10 @@ 2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * mln/convert/from_to.hh: Make use of value::cast for conversions + between built-in types. + +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * mln/data/paste_without_localization.hh: Add a missing dispatch overload. diff --git a/milena/mln/convert/from_to.hh b/milena/mln/convert/from_to.hh index 692d88f..fa57ac3 100644 --- a/milena/mln/convert/from_to.hh +++ b/milena/mln/convert/from_to.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -44,6 +45,7 @@ # include <mln/metal/is.hh> # include <mln/metal/is_a.hh> +# include <mln/value/cast.hh> namespace mln { @@ -156,7 +158,12 @@ namespace mln from_to_dispatch(metal::false_, const F& from, metal::false_, T& to) { - over_load::from_to_(from, to); + to = mln::value::cast<T>(from); + + // We prefer using value::cast instead of a from_to_ overload. + // We don't want to write explicitly every from_to_ overload + // for all built-in types. + // over_load::from_to_(from, to); } -- 1.5.6.5
14 years, 1 month
1
0
0
0
last-svn-commit-592-gae08c96 mln/convert/from_to.hh: Make use of value::cast for conversions between built-in types.
by Guillaume Lazzara
--- milena/ChangeLog | 5 +++++ milena/mln/convert/from_to.hh | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 77ad3a4..9cbc2db 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,10 @@ 2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * mln/convert/from_to.hh: Make use of value::cast for conversions + between built-in types. + +2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr> + * mln/data/paste_without_localization.hh: Add a missing dispatch overload. diff --git a/milena/mln/convert/from_to.hh b/milena/mln/convert/from_to.hh index 692d88f..fa57ac3 100644 --- a/milena/mln/convert/from_to.hh +++ b/milena/mln/convert/from_to.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -44,6 +45,7 @@ # include <mln/metal/is.hh> # include <mln/metal/is_a.hh> +# include <mln/value/cast.hh> namespace mln { @@ -156,7 +158,12 @@ namespace mln from_to_dispatch(metal::false_, const F& from, metal::false_, T& to) { - over_load::from_to_(from, to); + to = mln::value::cast<T>(from); + + // We prefer using value::cast instead of a from_to_ overload. + // We don't want to write explicitly every from_to_ overload + // for all built-in types. + // over_load::from_to_(from, to); } -- 1.5.6.5
14 years, 1 month
1
0
0
0
← Newer
1
...
27
28
29
30
31
32
33
...
37
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Results per page:
10
25
50
100
200