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
2025
January
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
----- 2025 -----
January 2025
----- 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
9625 discussions
Start a n
N
ew thread
olena-2.0-81-g5d7fb44 Fix the generation of code excerpts for the documentation.
by Roland Levillain
* doc/tools/split_sample.sh: Use $(...) instead of `...` so that backslashes are interpreted uniformly. Pass option `-h' to grep to prevent file names from being printed on OS X. Remove useless option `-R' passed to grep. --- milena/ChangeLog | 10 ++++++++++ milena/doc/tools/split_sample.sh | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 7d7f92a..8bb7b90 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,15 @@ 2013-02-07 Roland Levillain <roland(a)lrde.epita.fr> + Fix the generation of code excerpts for the documentation. + + * doc/tools/split_sample.sh: Use $(...) instead of `...` so that + backslashes are interpreted uniformly. + Pass option `-h' to grep to prevent file names from being printed + on OS X. + Remove useless option `-R' passed to grep. + +2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + Address warnings reported by clang++ in Milena. * mln/canvas/browsing/diagonal2d.hh (diagonal2d_t::operator()) diff --git a/milena/doc/tools/split_sample.sh b/milena/doc/tools/split_sample.sh index b9027bd..d85d626 100755 --- a/milena/doc/tools/split_sample.sh +++ b/milena/doc/tools/split_sample.sh @@ -1,6 +1,6 @@ # /bin/sh -# Copyright (C) 2008, 2009, 2010 EPITA Research and Development +# Copyright (C) 2008, 2009, 2010, 2013 EPITA Research and Development # Laboratory (LRDE). # # This file is part of Olena. @@ -22,8 +22,8 @@ if ! [ $# -eq 4 ]; then exit 1; fi -begins=`grep -n -R '//[[:space:]]*\\\{' $1 | cut -d ':' -f 1` -ends=`grep -n -R '//[[:space:]]*\\\}' $1 | cut -d ':' -f 1` +begins=$(grep -n -h '//[[:space:]]*\\{' $1 | cut -d ':' -f 1) +ends=$(grep -n -h '//[[:space:]]*\\}' $1 | cut -d ':' -f 1) if ! [ -z "$3" ]; then suffix=".$3" -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-78-g6a5f908 Address remaining errors reported by clang++ in Scribo.
by Roland Levillain
* scribo/debug/alignment_decision_image.hh (alignment_decision_image) * scribo/debug/bboxes_enlarged_image.hh (bboxes_enlarged_image) * scribo/debug/decision_image.hh (decision_image) * scribo/debug/links_decision_image.hh (links_decision_image) * scribo/debug/links_image.hh (links_image) * scribo/debug/looks_like_a_text_line_image.hh (looks_like_a_text_line_image): Fix the type of the value to be returned by theses functions. --- scribo/ChangeLog | 14 ++++++++++++++ scribo/scribo/debug/alignment_decision_image.hh | 4 ++-- scribo/scribo/debug/bboxes_enlarged_image.hh | 4 ++-- scribo/scribo/debug/decision_image.hh | 6 +++--- scribo/scribo/debug/links_decision_image.hh | 4 ++-- scribo/scribo/debug/links_image.hh | 4 ++-- .../scribo/debug/looks_like_a_text_line_image.hh | 4 ++-- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 1d0c69d..054429c 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,19 @@ 2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + Address remaining errors reported by clang++ in Scribo. + + * scribo/debug/alignment_decision_image.hh + (alignment_decision_image) + * scribo/debug/bboxes_enlarged_image.hh (bboxes_enlarged_image) + * scribo/debug/decision_image.hh (decision_image) + * scribo/debug/links_decision_image.hh (links_decision_image) + * scribo/debug/links_image.hh (links_image) + * scribo/debug/looks_like_a_text_line_image.hh + (looks_like_a_text_line_image): + Fix the type of the value to be returned by theses functions. + +2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + Address errors reported by clang++ in Scribo. * scribo/io/text_boxes/save.hh, diff --git a/scribo/scribo/debug/alignment_decision_image.hh b/scribo/scribo/debug/alignment_decision_image.hh index 450091d..2e6f06a 100644 --- a/scribo/scribo/debug/alignment_decision_image.hh +++ b/scribo/scribo/debug/alignment_decision_image.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2011, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -91,7 +91,7 @@ namespace scribo mln_precondition(filtered_links.is_valid()); /// Fixme: check that components has been computed from input. - image2d<value::rgb8> + mln_ch_value(I,value::rgb8) decision_image = data::convert(value::rgb8(), input); for_all_comps(i, components) diff --git a/scribo/scribo/debug/bboxes_enlarged_image.hh b/scribo/scribo/debug/bboxes_enlarged_image.hh index 24fea2f..102f458 100644 --- a/scribo/scribo/debug/bboxes_enlarged_image.hh +++ b/scribo/scribo/debug/bboxes_enlarged_image.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -100,7 +100,7 @@ namespace scribo trace::entering("scribo::debug::bboxes_enlarged_image"); mln_precondition(exact(input).is_valid()); - image2d<value::rgb8> output = data::convert(value::rgb8(), input); + mln_ch_value(I,value::rgb8) output = data::convert(value::rgb8(), input); for_all_lines(l, lines) if (! lines(l).is_hidden()) diff --git a/scribo/scribo/debug/decision_image.hh b/scribo/scribo/debug/decision_image.hh index ff298e6..f32e168 100644 --- a/scribo/scribo/debug/decision_image.hh +++ b/scribo/scribo/debug/decision_image.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -111,7 +111,7 @@ namespace scribo mln_precondition(filtered_groups.is_valid()); /// Fixme: check that components has been computed from input. - image2d<value::rgb8> + mln_ch_value(I,value::rgb8) decision_image = data::convert(value::rgb8(), input); for (unsigned i = 1; i < groups.size(); ++i) @@ -144,7 +144,7 @@ namespace scribo mln_precondition(filtered_links.is_valid()); /// Fixme: check that components has been computed from input. - image2d<value::rgb8> + mln_ch_value(I,value::rgb8) decision_image = data::convert(value::rgb8(), input); for_all_comps(i, comps) diff --git a/scribo/scribo/debug/links_decision_image.hh b/scribo/scribo/debug/links_decision_image.hh index 387cd7f..5c5a759 100644 --- a/scribo/scribo/debug/links_decision_image.hh +++ b/scribo/scribo/debug/links_decision_image.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2010, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -76,7 +76,7 @@ namespace scribo mln_precondition(links.size() == filtered_links.size()); /// Fixme: check that objects has been computed from input. - image2d<value::rgb8> + mln_ch_value(I,value::rgb8) links_decision_image = data::convert(value::rgb8(), input); for_all_comps(i, comps) diff --git a/scribo/scribo/debug/links_image.hh b/scribo/scribo/debug/links_image.hh index 47394be..0c8b23a 100644 --- a/scribo/scribo/debug/links_image.hh +++ b/scribo/scribo/debug/links_image.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -77,7 +77,7 @@ namespace scribo const component_set<L>& comps = links.components(); - image2d<value::rgb8> + mln_ch_value(I,value::rgb8) links_image = data::convert(value::rgb8(), input); if (draw_bboxes) diff --git a/scribo/scribo/debug/looks_like_a_text_line_image.hh b/scribo/scribo/debug/looks_like_a_text_line_image.hh index 376baae..e4407e2 100644 --- a/scribo/scribo/debug/looks_like_a_text_line_image.hh +++ b/scribo/scribo/debug/looks_like_a_text_line_image.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -94,7 +94,7 @@ namespace scribo trace::entering("scribo::debug::looks_like_a_text_line_image"); mln_precondition(exact(input).is_valid()); - image2d<value::rgb8> output = data::convert(value::rgb8(), input); + mln_ch_value(I,value::rgb8) output = data::convert(value::rgb8(), input); for_all_lines(l, lines) if (! lines(l).is_hidden()) -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-77-g8ae6c4c Address warnings reported by clang++ in Milena.
by Roland Levillain
* mln/canvas/browsing/diagonal2d.hh (diagonal2d_t::operator()) * mln/clustering/kmean_rgb.hh (internal::kmean_rgb_dispatch) * mln/labeling/value_and_compute.hh (internal::value_and_compute_tests) (impl::process__) * mln/metal/math/root.hh (impl::root<n, x, lo, hi>::value): Add an explicit type conversion of operator<'s the right-hand side operand. * mln/morpho/watershed/topological.hh (topological) * mln/world/rgb/invert.hh (internal::invert_dispatch): Remove unused variables. Do not name unused arguments. * mln/util/object_id.hh (operator==(const object_id<Tag,V>&, const Value<V2>&)): Add an explicit type conversion of the right-hand side operand. * mln/world/rgb/invert.hh, * tests/core/alias/point1d.cc, * tests/make/p_edges_with_mass_centers.cc, * tests/make/p_vertices_with_mass_centers.cc, * tests/value/int_s16.cc, * tests/value/int_u8.cc: Shush the compiler about unused variables. * tests/trait/op/plus.cc (mln::my_image2d<T>): Complete this type to have it comply with the mln::Image concept. (mln::dummy_t): New (dummy) type. (dummy): New (dummy) value. (main): Do not use uninitialized pointers. --- milena/ChangeLog | 32 ++++++++++++++++ milena/mln/canvas/browsing/diagonal2d.hh | 6 +-- milena/mln/clustering/kmean_rgb.hh | 18 +++++----- milena/mln/labeling/value_and_compute.hh | 14 +++---- milena/mln/metal/math/root.hh | 5 ++- milena/mln/morpho/watershed/topological.hh | 4 +- milena/mln/util/object_id.hh | 4 +- milena/mln/world/rgb/invert.hh | 6 ++-- milena/tests/algebra/h_vec.cc | 7 +++- milena/tests/core/alias/point1d.cc | 10 +++--- milena/tests/make/p_edges_with_mass_centers.cc | 3 +- milena/tests/make/p_vertices_with_mass_centers.cc | 3 +- milena/tests/trait/op/plus.cc | 41 ++++++++++++++++++++- milena/tests/value/int_s16.cc | 5 ++- milena/tests/value/int_u8.cc | 5 ++- 15 files changed, 116 insertions(+), 47 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 63ecfc1..7d7f92a 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,35 @@ +2013-02-07 Roland Levillain <roland(a)lrde.epita.fr> + + Address warnings reported by clang++ in Milena. + + * mln/canvas/browsing/diagonal2d.hh (diagonal2d_t::operator()) + * mln/clustering/kmean_rgb.hh (internal::kmean_rgb_dispatch) + * mln/labeling/value_and_compute.hh + (internal::value_and_compute_tests) + (impl::process__) + * mln/metal/math/root.hh (impl::root<n, x, lo, hi>::value): Add an + explicit type conversion of operator<'s the right-hand side + operand. + * mln/morpho/watershed/topological.hh (topological) + * mln/world/rgb/invert.hh (internal::invert_dispatch): + Remove unused variables. + Do not name unused arguments. + * mln/util/object_id.hh + (operator==(const object_id<Tag,V>&, const Value<V2>&)): + Add an explicit type conversion of the right-hand side operand. + * mln/world/rgb/invert.hh, + * tests/core/alias/point1d.cc, + * tests/make/p_edges_with_mass_centers.cc, + * tests/make/p_vertices_with_mass_centers.cc, + * tests/value/int_s16.cc, + * tests/value/int_u8.cc: + Shush the compiler about unused variables. + * tests/trait/op/plus.cc (mln::my_image2d<T>): Complete this type + to have it comply with the mln::Image concept. + (mln::dummy_t): New (dummy) type. + (dummy): New (dummy) value. + (main): Do not use uninitialized pointers. + 2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> Disambiguate operator- overload resolution with a pow_int_ operand. diff --git a/milena/mln/canvas/browsing/diagonal2d.hh b/milena/mln/canvas/browsing/diagonal2d.hh index 0dc2cf7..f4ec023 100644 --- a/milena/mln/canvas/browsing/diagonal2d.hh +++ b/milena/mln/canvas/browsing/diagonal2d.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development +// Copyright (C) 2007, 2008, 2009, 2010, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -123,9 +123,7 @@ namespace mln mln_deduce(I, psite, delta) diag; - psite - pmin = f.input.domain().pmin(), - pmax = f.input.domain().pmax(); + psite pmin = f.input.domain().pmin(); f.p = pmin; diff --git a/milena/mln/clustering/kmean_rgb.hh b/milena/mln/clustering/kmean_rgb.hh index daf6499..99baa6c 100644 --- a/milena/mln/clustering/kmean_rgb.hh +++ b/milena/mln/clustering/kmean_rgb.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -966,8 +966,8 @@ namespace mln const unsigned k_center, const unsigned watch_dog, const unsigned n_times, - const value::rgb<n>&, - const point2d&) + const value::rgb<n>& /* v */, + const point2d& /* p */) { return impl::kmean_image2d_rgb<T,n>(img, k_center, watch_dog, n_times); } @@ -975,12 +975,12 @@ namespace mln template <typename T, unsigned n, typename I, typename V, typename P> inline mln_ch_value(I,value::label_8) - kmean_rgb_dispatch(const Image<I>& img, - const unsigned k_center, - const unsigned watch_dog, - const unsigned n_times, - const V&, - const P&) + kmean_rgb_dispatch(const Image<I>& /* img */, + const unsigned /* k_center */, + const unsigned /* watch_dog */, + const unsigned /* n_times */, + const V& /* v */, + const P& /* p */) { // No kmean implementation found. mlc_abort(I)::check(); diff --git a/milena/mln/labeling/value_and_compute.hh b/milena/mln/labeling/value_and_compute.hh index d93fce9..3993cd3 100644 --- a/milena/mln/labeling/value_and_compute.hh +++ b/milena/mln/labeling/value_and_compute.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -71,18 +71,16 @@ namespace mln template <typename I, typename N, typename L, typename A> void - value_and_compute_tests(const Image<I>& input, const mln_value(I)& val, - const Neighborhood<N>& nbh, L& nlabels, - const Accumulator<A>& accu) + value_and_compute_tests(const Image<I>& input, + const mln_value(I)& /* val */, + const Neighborhood<N>& nbh, L& /* nlabels */, + const Accumulator<A>& /* accu */) { mln_precondition(exact(input).is_valid()); mln_precondition(exact(nbh).is_valid()); - (void) accu; (void) input; - (void) val; (void) nbh; - (void) nlabels; } } // end of namespace mln::labeling::internal @@ -190,7 +188,7 @@ namespace mln template <typename V> inline - void process__(const V&, const mln_site(I)&, const L& l) + void process__(const V&, const mln_site(I)&, const L& /* l */) { mlc_abort(V)::check(); } diff --git a/milena/mln/metal/math/root.hh b/milena/mln/metal/math/root.hh index 6667edd..3b34658 100644 --- a/milena/mln/metal/math/root.hh +++ b/milena/mln/metal/math/root.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -60,7 +61,7 @@ namespace mln val_lo = root<n, x, lo, mid-1>::value, val_hi = root<n, x, mid, hi>::value }; - enum { value = x < mlc_pow_int(mid, n) ? val_lo : val_hi }; + enum { value = x < unsigned(mlc_pow_int(mid, n)) ? val_lo : val_hi }; }; template<unsigned n, unsigned x, unsigned m> diff --git a/milena/mln/morpho/watershed/topological.hh b/milena/mln/morpho/watershed/topological.hh index b06e6ab..d17ece1 100644 --- a/milena/mln/morpho/watershed/topological.hh +++ b/milena/mln/morpho/watershed/topological.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -692,7 +693,6 @@ namespace mln p_priority< mln_value(I), p_queue_fast<mln_site(I)> > l; // p_queue < site > m; std::queue<mln_site(I)> m; - mln_value(I) min = mln_min(mln_value(I)); std::cout << "Init" << std::endl; diff --git a/milena/mln/util/object_id.hh b/milena/mln/util/object_id.hh index 525ff15..54c12ff 100644 --- a/milena/mln/util/object_id.hh +++ b/milena/mln/util/object_id.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2011, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -209,7 +209,7 @@ namespace mln bool operator==(const object_id<Tag,V>& lhs, const Value<V2>& rhs) { - return lhs.value() == exact(rhs).to_equiv(); + return lhs.value() == static_cast<V>(exact(rhs).to_equiv()); } template <typename Tag, typename V> diff --git a/milena/mln/world/rgb/invert.hh b/milena/mln/world/rgb/invert.hh index 62ee5bf..3c7b0d9 100644 --- a/milena/mln/world/rgb/invert.hh +++ b/milena/mln/world/rgb/invert.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -130,9 +130,9 @@ namespace mln inline void invert_dispatch(trait::image::speed::any, const mln_value(I)&, - const I& input, O& output) + const I& /* input*/ , O& /* output */) { - // No implementation found. May be input is not a RGB image? + // No implementation found. Maybe `input' is not an RGB image? mlc_abort(I)::check(); } diff --git a/milena/tests/algebra/h_vec.cc b/milena/tests/algebra/h_vec.cc index 8b833c5..4319068 100644 --- a/milena/tests/algebra/h_vec.cc +++ b/milena/tests/algebra/h_vec.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -28,6 +29,8 @@ using namespace mln; +/* FIXME: Complete or at least describe the purpose of these empty + functions. */ void run_in_3d(const algebra::vec<3, float>&) { @@ -45,9 +48,9 @@ void foo(const mln::algebra::h_vec<3,float>&) int main() { - algebra::vec<3, def::coord> x; algebra::h_vec<3, def::coord> w = x.to_h_vec(); + (void) w; typedef algebra::h_vec<3, def::coord> p3d; p3d p; diff --git a/milena/tests/core/alias/point1d.cc b/milena/tests/core/alias/point1d.cc index 1326ddd..15373fd 100644 --- a/milena/tests/core/alias/point1d.cc +++ b/milena/tests/core/alias/point1d.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -25,6 +26,7 @@ #include <mln/core/alias/point1d.hh> +#include <mln/math/abs.hh> int main() @@ -33,19 +35,17 @@ int main() point1d p, q; - // assignment - p[0] = 4; algebra::vec<1,float> v = p; + mln_assertion(v[0] == 4); p.ind() += 1; mln_assertion(p.ind() == 5 && p[0] == 5); - // construction q.ind() = 5; mln_assertion(p == q); q.set_all(0); - for (unsigned i = 0; i < p.dim; ++i) + for (unsigned i = 0; i < q.dim; ++i) mln_assertion(q[i] == 0); } diff --git a/milena/tests/make/p_edges_with_mass_centers.cc b/milena/tests/make/p_edges_with_mass_centers.cc index 4bc5b35..afb34e7 100644 --- a/milena/tests/make/p_edges_with_mass_centers.cc +++ b/milena/tests/make/p_edges_with_mass_centers.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -59,7 +59,6 @@ int main() g.add_edge(4,3); g.add_edge(4,2); - L nbasins = 4; typedef p_edges<G,fun::i2v::array<util::site_pair<point2d> > > pe_t; pe_t pe = make::p_edges_with_mass_centers(wst, g); diff --git a/milena/tests/make/p_vertices_with_mass_centers.cc b/milena/tests/make/p_vertices_with_mass_centers.cc index 58dfd5a..cb30707 100644 --- a/milena/tests/make/p_vertices_with_mass_centers.cc +++ b/milena/tests/make/p_vertices_with_mass_centers.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -57,7 +57,6 @@ int main() g.add_edge(4,3); g.add_edge(4,2); - L nbasins = 4; typedef p_vertices<G,fun::i2v::array<point2d> > pv_t; pv_t pv = make::p_vertices_with_mass_centers(wst, g); diff --git a/milena/tests/trait/op/plus.cc b/milena/tests/trait/op/plus.cc index df7877f..6639a43 100644 --- a/milena/tests/trait/op/plus.cc +++ b/milena/tests/trait/op/plus.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -32,11 +33,46 @@ namespace mln { + struct dummy_t {}; + dummy_t dummy; template <typename T> struct my_image2d : Image< my_image2d<T> > { void m() {} + + + // Dummy typedefs and methods added to comply with interface + // requirements of concept Image. + + typedef dummy_t domain_t; + typedef dummy_t site; + typedef dummy_t psite; + typedef dummy_t piter; + typedef dummy_t fwd_piter; + typedef dummy_t bkd_piter; + + bool has(const psite& /* p */) const { return false; } + bool is_valid() const { return true; } + + typedef dummy_t t_eligible_values_set; + const t_eligible_values_set& values_eligible() const { return dummy; } + + typedef dummy_t t_values_space; + const t_values_space& values_space() const { return dummy; } + + typedef dummy_t value; + typedef dummy_t rvalue; + typedef dummy_t lvalue; + + rvalue operator()(const psite& /* p */) const { return dummy; } + lvalue operator()(const psite& /* p */) { return dummy; } + + const domain_t& domain() const { return dummy; } + + typedef dummy_t skeleton; + + void init_(const dummy_t&) {}; }; @@ -82,7 +118,8 @@ int main() tmp = 5.1f; } { - my_image2d<float>* ptr; + my_image2d<float> ima; + my_image2d<float>* ptr = &ima; mln_trait_op_plus_(my_image2d<int>, my_image2d<float>) tmp = *ptr; tmp.m(); } diff --git a/milena/tests/value/int_s16.cc b/milena/tests/value/int_s16.cc index a6ee332..d2fbba6 100644 --- a/milena/tests/value/int_s16.cc +++ b/milena/tests/value/int_s16.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -192,7 +193,7 @@ int main() mln_assertion(c == 100); int_s16 d = 2; - c /= 2; + c /= d; mln_assertion(c == 50); } diff --git a/milena/tests/value/int_u8.cc b/milena/tests/value/int_u8.cc index 7993679..fe606aa 100644 --- a/milena/tests/value/int_u8.cc +++ b/milena/tests/value/int_u8.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -176,7 +177,7 @@ int main() sym_compare_assert(c, ==, 100.f); int_u8 d = 2; - c /= 2; + c /= d; sym_compare_assert(c, ==, 50.f); // FIXME: Triggers a warning about signed vs unsigned comparison. -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-76-gf2b50a1 Disambiguate operator- overload resolution with a pow_int_ operand.
by Roland Levillain
* mln/metal/math/pow.hh (mln::metal::math::impl::pow_int_): Use static const integers instead of enums. --- milena/ChangeLog | 7 +++++++ milena/mln/metal/math/pow.hh | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 111f0d7..63ecfc1 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,12 @@ 2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + Disambiguate operator- overload resolution with a pow_int_ operand. + + * mln/metal/math/pow.hh (mln::metal::math::impl::pow_int_): + Use static const integers instead of enums. + +2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + Revive tests/value/graylevel.cc. * mln/value/graylevel.hh: Aesthetic changes in comments. diff --git a/milena/mln/metal/math/pow.hh b/milena/mln/metal/math/pow.hh index eb70852..4f54e10 100644 --- a/milena/mln/metal/math/pow.hh +++ b/milena/mln/metal/math/pow.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -57,13 +58,13 @@ namespace mln template <int x, int n> struct pow_int_ { - enum res_ { value = x * pow_int_<x, n-1>::value }; + static const int value = x * pow_int_<x, n-1>::value; }; template <int x> struct pow_int_< x, 0 > { - enum res_ { value = 1 }; + static const int value = 1; }; template <> -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-75-gd4f02ab Revive tests/value/graylevel.cc.
by Roland Levillain
* mln/value/graylevel.hh: Aesthetic changes in comments. * tests/value/graylevel.cc (test_conversion): Turn this macro into a function template. (main): Ensure all valid comparisons listed in mln/value/graylevel.hh work. Remove dead code. Address warnings. * tests/value/Makefile.am (check_PROGRAMS): Re-enable graylevel. (graylevel_SOURCES): Re-enable. --- milena/ChangeLog | 14 +++++++ milena/mln/value/graylevel.hh | 23 ++++++------ milena/tests/value/Makefile.am | 6 ++-- milena/tests/value/graylevel.cc | 74 +++++++++++++++++---------------------- 4 files changed, 61 insertions(+), 56 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 2a289ad..111f0d7 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,19 @@ 2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + Revive tests/value/graylevel.cc. + + * mln/value/graylevel.hh: Aesthetic changes in comments. + * tests/value/graylevel.cc (test_conversion): Turn this macro into + a function template. + (main): Ensure all valid comparisons listed in + mln/value/graylevel.hh work. + Remove dead code. + Address warnings. + * tests/value/Makefile.am (check_PROGRAMS): Re-enable graylevel. + (graylevel_SOURCES): Re-enable. + +2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + Fix mutual dependencies between floating-point gray-level values. * mln/value/graylevel_f.hh, diff --git a/milena/mln/value/graylevel.hh b/milena/mln/value/graylevel.hh index fc68391..7181678 100644 --- a/milena/mln/value/graylevel.hh +++ b/milena/mln/value/graylevel.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2006, 2007, 2008, 2009, 2013 EPITA Research and +// Development Laboratory (LRDE) // // This file is part of Olena. // @@ -238,19 +239,19 @@ namespace mln // Valid Conversions are : -// gray_f -> gray_<n> -// gray_f -> graylevel<n> -// gray_f -> graylevel_f + // gray_f -> gray_<n> + // gray_f -> graylevel<n> + // gray_f -> graylevel_f -// gray_<n> -> gray_f -// gray_<n> -> graylevel<n> -// gray_<n> -> graylevel_f + // gray_<n> -> gray_f + // gray_<n> -> graylevel<n> + // gray_<n> -> graylevel_f -// graylevel_f -> gray_f -// graylevel_f -> graylevel<n> + // graylevel_f -> gray_f + // graylevel_f -> graylevel<n> -// graylevel_<n> -> gray_<n> -// graylevel_<n> -> graylevel_f<n> + // graylevel<n> -> gray_<n> + // graylevel<n> -> graylevel_f template <unsigned n> diff --git a/milena/tests/value/Makefile.am b/milena/tests/value/Makefile.am index a8e43a4..f5d4505 100644 --- a/milena/tests/value/Makefile.am +++ b/milena/tests/value/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2008, 2009, 2012 EPITA Research and Development +# Copyright (C) 2007, 2008, 2009, 2012, 2013 EPITA Research and Development # Laboratory (LRDE). # # This file is part of Olena. @@ -25,6 +25,7 @@ SUBDIRS = \ check_PROGRAMS = \ bool \ equiv \ + graylevel \ int_s \ int_s16 \ int_u8 \ @@ -38,7 +39,6 @@ check_PROGRAMS = \ # float01 # float01_bis # float01_f -# graylevel # graylevel_f bool_SOURCES = bool.cc @@ -46,7 +46,7 @@ equiv_SOURCES = equiv.cc #float01_SOURCES = float01.cc #float01_bis_SOURCES = float01_bis.cc #float01_f_SOURCES = float01_f.cc -#graylevel_SOURCES = graylevel.cc +graylevel_SOURCES = graylevel.cc #graylevel_f_SOURCES = graylevel_f.cc int_s_SOURCES = int_s.cc int_s16_SOURCES = int_s16.cc diff --git a/milena/tests/value/graylevel.cc b/milena/tests/value/graylevel.cc index 21faab4..13c2d4c 100644 --- a/milena/tests/value/graylevel.cc +++ b/milena/tests/value/graylevel.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -32,29 +33,20 @@ #include <mln/value/float01_f.hh> #include <mln/value/float01_.hh> - #include <mln/literal/black.hh> #include <mln/literal/white.hh> - -// FIXME: Give a more explicit error message. -// template <typename T> -// void foo() -// { -// typedef mln::value::gl8 g; -// // mln_trait_op_times(int, mln::value::Integer<g>) tmp; -// mln_trait_op_times(int, mln::value::Integer<g>) tmp; -// } - - -#define test_conversion(T1, T2, VAL) \ -{ \ - (T1)(T2)(VAL); \ - T1 test = (T2)(VAL); \ - test = (T2)(VAL); \ +template<typename From, typename To, typename T> +void +test_conversion (const T& val) +{ + (void)(To)(From) val; + To test = (From)(val); + test = (From)(val); } + int main() { using namespace mln::value; @@ -64,8 +56,6 @@ int main() using mln::literal::black; - // FIXME: Make all the test pass. - gl8 a(white); gl8 b(white); @@ -77,6 +67,7 @@ int main() gl8 b(10); gl8 c = a + b; + (void) c; } { @@ -139,34 +130,33 @@ int main() // Conversions. typedef mln::value::internal::gray_<8> i_gray_8; - test_conversion(gl8, i_gray_8, 255); - test_conversion(gl8, gray_f, 0.4); - test_conversion(gl8, glf, 0.4); + // gray_<n> -> graylevel<n> + test_conversion<i_gray_8, gl8>(255); - test_conversion(glf, i_gray_8, 255); - test_conversion(glf, gray_f, 0.4); - test_conversion(glf, gl8, 142); + // gray_f -> graylevel<n> + test_conversion<gray_f, gl8>(0.4); + // graylevel_f -> graylevel<n> + test_conversion<glf, gl8>(0.4); - test_conversion(gray_f, i_gray_8, 4); - test_conversion(glf, gray_f, 0.4); - } + // gray_<n> -> graylevel_f + test_conversion<i_gray_8, glf>(255); + // gray_f -> graylevel_f + test_conversion<gray_f, glf>(0.4); + // graylevel<n> -> graylevel_f + test_conversion<gl8, glf>(142); -// { -// // FIXME: comparison with literals doesn't work -// c = a; -// mln_assertion(c == white); + // gray_<n> -> gray_f + test_conversion<i_gray_8, gray_f>(4); -// c = (a * 2) / 2; -// mln_assertion(c == white); -// c = c / 6; -// } + // gray_f -> gray_<n> + test_conversion<gray_f, i_gray_8>(0.4); -// { -// gl8 c = white; -// mln_assertion(c == white); -// mln_assertion(c.value() == float(255)); -// } + // graylevel_f -> gray_f + test_conversion<glf, gray_f>(0.4); + // graylevel<n> -> gray_<n> + test_conversion<gl8, i_gray_8>(142); + } } -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-74-g85c24de Fix mutual dependencies between floating-point gray-level values.
by Roland Levillain
* mln/value/graylevel_f.hh, * mln/value/internal/gray_f.hh: Move definitions... * mln/value/graylevel_f.hxx, * mln/value/internal/gray_f.hxx: ...here (new files). * headers.mk (nobase_include_HEADERS): Regen. --- milena/ChangeLog | 12 ++ milena/headers.mk | 2 + milena/mln/value/graylevel_f.hh | 255 +++++++++++---------------- milena/mln/value/graylevel_f.hxx | 319 +++++++++++++++++++++++++++++++++ milena/mln/value/internal/gray_f.hh | 320 +++------------------------------- milena/mln/value/internal/gray_f.hxx | 160 +++++++++++++++++ 6 files changed, 622 insertions(+), 446 deletions(-) create mode 100644 milena/mln/value/graylevel_f.hxx create mode 100644 milena/mln/value/internal/gray_f.hxx diff --git a/milena/ChangeLog b/milena/ChangeLog index e294ca0..2a289ad 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,15 @@ +2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + + Fix mutual dependencies between floating-point gray-level values. + + * mln/value/graylevel_f.hh, + * mln/value/internal/gray_f.hh: + Move definitions... + * mln/value/graylevel_f.hxx, + * mln/value/internal/gray_f.hxx: + ...here (new files). + * headers.mk (nobase_include_HEADERS): Regen. + 2013-02-05 Roland Levillain <roland(a)lrde.epita.fr> Address more remaining clang++ errors in Milena. diff --git a/milena/headers.mk b/milena/headers.mk index dbd26e9..8997e6b 100644 --- a/milena/headers.mk +++ b/milena/headers.mk @@ -1225,6 +1225,7 @@ mln/value/gl8.hh \ mln/value/glf.hh \ mln/value/graylevel.hh \ mln/value/graylevel_f.hh \ +mln/value/graylevel_f.hxx \ mln/value/hsl.hh \ mln/value/int_s.hh \ mln/value/int_s16.hh \ @@ -1244,6 +1245,7 @@ mln/value/internal/encoding.hh \ mln/value/internal/essential.hh \ mln/value/internal/gray_.hh \ mln/value/internal/gray_f.hh \ +mln/value/internal/gray_f.hxx \ mln/value/internal/integer.hh \ mln/value/internal/iterable_set.hh \ mln/value/internal/limits.hh \ diff --git a/milena/mln/value/graylevel_f.hh b/milena/mln/value/graylevel_f.hh index 4194b25..1d6d217 100644 --- a/milena/mln/value/graylevel_f.hh +++ b/milena/mln/value/graylevel_f.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2006, 2007, 2008, 2009, 2011 EPITA Research and +// Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013 EPITA Research and // Development Laboratory (LRDE) // // This file is part of Olena. @@ -29,7 +29,7 @@ /// \file /// -/// Definition of the mln::value::graylevel_f class. +/// Declaration of the mln::value::graylevel_f class. # include <iostream> @@ -43,22 +43,43 @@ # include <mln/value/float01_f.hh> # include <mln/trait/value_.hh> +/* Because of mutual dependencies between the implementations of + mln::value::graylevel_f and mln::value::internal::gray_f, we have + to ensure that only the interfaces of the required classes are + included here. Implementations are included later, at the bottom of + this file. */ + +# ifdef MLN_INCLUDE_ONLY +# include <mln/value/internal/gray_f.hh> +# else +# define MLN_INCLUDE_ONLY +# include <mln/value/internal/gray_f.hh> +# undef MLN_INCLUDE_ONLY +# endif + namespace mln { namespace literal { - /// \{ Forward declarations. + /// Forward declarations. + /// \{ struct black_t; struct medium_gray_t; struct white_t; /// \} } + namespace value { - /// \{ Forward declarations. - namespace internal { struct gray_f; } + /// Forward declarations. + /// \{ + namespace internal + { + struct gray_f; + } + struct graylevel_f; template <unsigned n> struct graylevel; struct float01_f; @@ -248,227 +269,159 @@ namespace mln /// Op<<. std::ostream& operator<<(std::ostream& ostr, const graylevel_f& g); + + // Integer<I> == graylevel_f. + template <typename I> + bool + operator==(const Integer<I>& lhs, const graylevel_f& rhs); + + // graylevel_f == graylevel_f. + // Op glf == glf + bool + operator==(const graylevel_f& lhs, const graylevel_f& rhs); + + // graylevel_f + graylevel_f. mln_trait_op_plus_(graylevel_f, graylevel_f) - operator+(const graylevel_f& lhs, const graylevel_f& rhs); - + operator+(const graylevel_f& lhs, const graylevel_f& rhs); // graylevel_f + graylevel<n>. template <unsigned n> mln_trait_op_plus(graylevel_f, graylevel<n>) - operator+(const graylevel_f& lhs, const graylevel<n>& rhs); + operator+(const graylevel_f& lhs, const graylevel<n>& rhs); // graylevel<n> + graylevel_f. template <unsigned n> mln_trait_op_plus(graylevel_f, graylevel<n>) - operator+(const graylevel<n>& lhs, const graylevel_f& rhs); + operator+(const graylevel<n>& lhs, const graylevel_f& rhs); + + // graylevel_f + another type + template <typename I> + void + operator+(const graylevel_f& lhs, const I& i); + // another type + graylevel_f + template <typename I> + void + operator+(const I& i, const graylevel_f& rhs); + // graylevel_f - graylevel_f. mln_trait_op_minus_(graylevel_f, graylevel_f) - operator-(const graylevel_f& lhs, const graylevel_f& rhs); + operator-(const graylevel_f& lhs, const graylevel_f& rhs); + + // graylevel_f - another type + template <typename I> + void + operator-(const graylevel_f& lhs, const I& i); + // another type - graylevel_f + template <typename I> + void + operator-(const I& i, const graylevel_f& rhs); + // graylevel_f * graylevel_f. mln_trait_op_times_(graylevel_f, graylevel_f) - operator*(const graylevel_f& lhs, const graylevel_f& rhs); + operator*(const graylevel_f& lhs, const graylevel_f& rhs); + /* FIXME: These operators are apparently implemented nowhere. + Implement them or remove these declarations. */ +#if 0 // With Builtins. // graylevel_f * T. template <unsigned n, typename T> mln_trait_op_times(graylevel_f, T) - operator*(const graylevel_f& lhs, const T& rhs); + operator*(const graylevel_f& lhs, const T& rhs); // T * graylevel_f. template <unsigned n, typename T> mln_trait_op_times(graylevel_f, T) - operator*(const T& lhs, const graylevel_f& rhs); + operator*(const T& lhs, const graylevel_f& rhs); // graylevel_f / T. template <unsigned n, typename T> internal::gray_f - operator/(const graylevel_f& lhs, const T& rhs); + operator/(const graylevel_f& lhs, const T& rhs); +#endif + // With Integer. // graylevel_f * Integer<I>. template <typename I> mln_trait_op_times(graylevel_f, I) - operator*(const graylevel_f& lhs, const Integer<I>& rhs); + operator*(const graylevel_f& lhs, const Integer<I>& rhs); // Integer<I> * graylevel_f. template <typename I> mln_trait_op_times(I, graylevel_f) - operator*(const Integer<I>& lhs, const graylevel_f& rhs); + operator*(const Integer<I>& lhs, const graylevel_f& rhs); + + /* FIXME: These operators are apparently implemented nowhere. + Implement them or remove these declarations. */ +#if 0 // graylevel_f / Integer<I>. template <typename I> mln_trait_op_div(graylevel_f, I) - operator/(const graylevel_f& lhs, const Integer<I>& rhs); + operator/(const graylevel_f& lhs, const Integer<I>& rhs); // Integer<I> / graylevel_f. template <typename I> mln_trait_op_div(I, graylevel_f) - operator/(const Integer<I>& lhs, const graylevel_f& rhs); + operator/(const Integer<I>& lhs, const graylevel_f& rhs); +#endif + // With Floating. // graylevel_f * Floating<F>. template <typename F> mln_trait_op_times(graylevel_f, F) - operator*(const graylevel_f& lhs, const Floating<F>& rhs); + operator*(const graylevel_f& lhs, const Floating<F>& rhs); - // Floating<F>, graylevel_f. + // Floating<F> * graylevel_f. template <typename F> mln_trait_op_times(F, graylevel_f) - operator*(const Floating<F>& lhs, const graylevel_f& rhs); + operator*(const Floating<F>& lhs, const graylevel_f& rhs); + /* FIXME: These operators are apparently implemented nowhere. + Implement them or remove these declarations. */ +#if 0 // graylevel_f / Floating<F>. template <typename F> mln_trait_op_div(graylevel_f, F) - operator/(const graylevel_f& lhs, const Floating<F>& rhs); + operator/(const graylevel_f& lhs, const Floating<F>& rhs); // Floating<F> / graylevel_f. template <typename F> mln_trait_op_div(F, graylevel_f) - operator/(const Floating<F>& lhs, const graylevel_f& rhs); - - -# ifndef MLN_INCLUDE_ONLY - - // graylevel_f. - - inline - graylevel_f::graylevel_f() - { - } - - - inline - graylevel_f::graylevel_f(float val) - { - mln_precondition(val >= 0); - mln_precondition(val <= 1); - this->v_ = val; - } - - inline - graylevel_f& - graylevel_f::operator=(float val) - { - mln_precondition(val >= 0); - mln_precondition(val <= 1); - this->v_ = val; - return *this; - } - - template <unsigned n> - graylevel_f::graylevel_f(const graylevel<n>& rhs) - { - mln_precondition(rhs.to_float() >= 0); - mln_precondition(rhs.to_float() <= 1); - this->v_ = rhs.to_float(); - } + operator/(const Floating<F>& lhs, const graylevel_f& rhs); +#endif - template <unsigned n> - graylevel_f& - graylevel_f::operator=(const graylevel<n>& rhs) - { - mln_precondition(rhs.to_float() >= 0); - mln_precondition(rhs.to_float() <= 1); - this->v_ = rhs.to_float(); - return *this; - } - inline - graylevel_f::graylevel_f(const graylevel_f& rhs) - : Floating<graylevel_f>() - { - this->v_ = rhs.v_; - } + // With scalar_. - inline - graylevel_f& - graylevel_f::operator=(const graylevel_f& rhs) - { - mln_precondition(rhs.v_ >= 0); - mln_precondition(rhs.v_ <= 1); - this->v_ = rhs.v_; - return *this; - } + // graylevel * scalar_<S> + template <typename S> + mln_trait_op_times(graylevel_f, S) + operator*(const graylevel_f& lhs, const scalar_<S>& rhs); - inline - graylevel_f::graylevel_f(const mln::literal::black_t&) - { - this->v_ = 0.0f; - } - - inline - graylevel_f& - graylevel_f::operator=(const mln::literal::black_t&) - { - this->v_ = 0.0f; - return *this; - } - - inline - graylevel_f::graylevel_f(const mln::literal::medium_gray_t&) - { - this->v_ = 0.5f; - } - - inline - graylevel_f& - graylevel_f::operator=(const mln::literal::medium_gray_t&) - { - this->v_ = 0.5f; - return *this; - } - - inline - graylevel_f::graylevel_f(const mln::literal::white_t&) - { - this->v_ = 1.0f; - } - - inline - graylevel_f& - graylevel_f::operator=(const mln::literal::white_t&) - { - this->v_ = 1.0f; - return *this; - } - - template <unsigned n> - inline - graylevel_f::operator graylevel<n>() const - { - return graylevel<n>(internal::gray_f(*this)); - } - - inline - float - graylevel_f::value() const - { - return this->v_; - } - - // Operators. - - inline - std::ostream& operator<<(std::ostream& ostr, const graylevel_f& g) - { - return ostr << g.value() << "/gl_f"; // FIXME: Be more explicit!. - } - -# endif // ! MLN_INCLUDE_ONLY + // graylevel / scalar_<S> + template <typename S> + mln_trait_op_div(graylevel_f, S) + operator/(const graylevel_f& lhs, const scalar_<S>& rhs); } // end of namespace mln::value } // end of namespace mln -//# include <mln/value/internal/gray_f.hh> -///# include <mln/value/internal/gray_.hh> +# ifndef MLN_INCLUDE_ONLY +# include <mln/value/graylevel_f.hxx> +# include <mln/value/internal/gray_f.hxx> +# endif // ! MLN_INCLUDE_ONLY + #endif // ! MLN_VALUE_GRAYLEVEL_F_HH diff --git a/milena/mln/value/graylevel_f.hxx b/milena/mln/value/graylevel_f.hxx new file mode 100644 index 0000000..db40cc5 --- /dev/null +++ b/milena/mln/value/graylevel_f.hxx @@ -0,0 +1,319 @@ +// Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013 EPITA Research and +// Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <
http://www.gnu.org/licenses/
>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_VALUE_GRAYLEVEL_F_HXX +# define MLN_VALUE_GRAYLEVEL_F_HXX + +/// \file +/// +/// Definition of the mln::value::graylevel_f class. + +# include <mln/value/graylevel_f.hh> + + +namespace mln +{ + + namespace value + { + + // graylevel_f. + + inline + graylevel_f::graylevel_f() + { + } + + + inline + graylevel_f::graylevel_f(float val) + { + mln_precondition(val >= 0); + mln_precondition(val <= 1); + this->v_ = val; + } + + inline + graylevel_f& + graylevel_f::operator=(float val) + { + mln_precondition(val >= 0); + mln_precondition(val <= 1); + this->v_ = val; + return *this; + } + + template <unsigned n> + graylevel_f::graylevel_f(const graylevel<n>& rhs) + { + mln_precondition(rhs.to_float() >= 0); + mln_precondition(rhs.to_float() <= 1); + this->v_ = rhs.to_float(); + } + + template <unsigned n> + graylevel_f& + graylevel_f::operator=(const graylevel<n>& rhs) + { + mln_precondition(rhs.to_float() >= 0); + mln_precondition(rhs.to_float() <= 1); + this->v_ = rhs.to_float(); + return *this; + } + + inline + graylevel_f::graylevel_f(const graylevel_f& rhs) + : Floating<graylevel_f>() + { + this->v_ = rhs.v_; + } + + inline + graylevel_f& + graylevel_f::operator=(const graylevel_f& rhs) + { + mln_precondition(rhs.v_ >= 0); + mln_precondition(rhs.v_ <= 1); + this->v_ = rhs.v_; + return *this; + } + + inline + graylevel_f::graylevel_f(const mln::literal::black_t&) + { + this->v_ = 0.0f; + } + + inline + graylevel_f& + graylevel_f::operator=(const mln::literal::black_t&) + { + this->v_ = 0.0f; + return *this; + } + + inline + graylevel_f::graylevel_f(const mln::literal::medium_gray_t&) + { + this->v_ = 0.5f; + } + + inline + graylevel_f& + graylevel_f::operator=(const mln::literal::medium_gray_t&) + { + this->v_ = 0.5f; + return *this; + } + + inline + graylevel_f::graylevel_f(const mln::literal::white_t&) + { + this->v_ = 1.0f; + } + + inline + graylevel_f& + graylevel_f::operator=(const mln::literal::white_t&) + { + this->v_ = 1.0f; + return *this; + } + + template <unsigned n> + inline + graylevel_f::operator graylevel<n>() const + { + return graylevel<n>(internal::gray_f(*this)); + } + + inline + float + graylevel_f::value() const + { + return this->v_; + } + + + // Operators. + + inline + std::ostream& operator<<(std::ostream& ostr, const graylevel_f& g) + { + return ostr << g.value() << "/gl_f"; // FIXME: Be more explicit!. + } + + + template <typename I> + inline + bool + operator==(const Integer<I>& lhs, const graylevel_f& rhs) + { + return rhs.value() == exact(lhs); + } + + inline + bool + operator==(const graylevel_f& lhs, const graylevel_f& rhs) + { + return rhs.value() == lhs.value(); + } + + + inline + mln_trait_op_plus_(graylevel_f, graylevel_f) + operator+(const graylevel_f& lhs, const graylevel_f& rhs) + { + return lhs.value() + rhs.value(); + } + + + template <unsigned n> + inline + mln_trait_op_plus(graylevel_f, graylevel<n>) + operator+(const graylevel_f& lhs, const graylevel<n>& rhs) + { + return lhs.value() + graylevel_f(rhs).value(); + } + + template <unsigned n> + inline + mln_trait_op_plus(graylevel_f, graylevel<n>) + operator+(const graylevel<n>& lhs, const graylevel_f& rhs) + { + return rhs.value() + graylevel_f(lhs).value(); + } + + template <typename I> + inline + void + operator+(const graylevel_f& lhs, const I& i) + { + (void) lhs; + (void) i; + typename + Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; + } + + template <typename I> + inline + void + operator+(const I& i, const graylevel_f& rhs) + { + (void) i; + (void) rhs; + typename + Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; + } + + + inline + mln_trait_op_minus_(graylevel_f, graylevel_f) + operator-(const graylevel_f& lhs, const graylevel_f& rhs) + { + return lhs.value() - rhs.value(); + } + + template <typename I> + inline + void + operator-(const graylevel_f& lhs, const I& i) + { + (void) lhs; + (void) i; + typename + Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; + } + + template <typename I> + inline + void + operator-(const I& i, const graylevel_f& rhs) + { + (void) i; + (void) rhs; + typename + Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; + } + + + inline + mln_trait_op_times_(graylevel_f, graylevel_f) + operator*(const graylevel_f& lhs, const graylevel_f& rhs) + { + return lhs.value() * rhs.value(); + } + + + + template <typename I> + inline + mln_trait_op_times(graylevel_f, I) + operator*(const graylevel_f& lhs, const Integer<I>& rhs) + { + return lhs.value() * int(exact(rhs)); + } + + template <typename F> + inline + mln_trait_op_times(graylevel_f, F) + operator*(const graylevel_f& lhs, const Floating<F>& rhs) + { + return lhs.value() * exact(rhs); + } + + template <typename F> + inline + mln_trait_op_times(F, graylevel_f) + operator*(const Floating<F>& lhs, const graylevel_f& rhs) + { + return rhs.value() * exact(lhs); + } + + + template <typename S> + inline + mln_trait_op_times(graylevel_f, S) + operator*(const graylevel_f& lhs, const scalar_<S>& rhs) + { + return lhs.value() * rhs.to_equiv(); + } + + template <typename S> + inline + mln_trait_op_div(graylevel_f, S) + operator/(const graylevel_f& lhs, const scalar_<S>& rhs) + { + mln_precondition(rhs.to_equiv() != S(0)); + return lhs.value() / rhs.to_equiv(); + } + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_GRAYLEVEL_F_HXX diff --git a/milena/mln/value/internal/gray_f.hh b/milena/mln/value/internal/gray_f.hh index 79a443c..a24c2b5 100644 --- a/milena/mln/value/internal/gray_f.hh +++ b/milena/mln/value/internal/gray_f.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2006, 2007, 2008, 2009, 2011 EPITA Research and +// Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013 EPITA Research and // Development Laboratory (LRDE) // // This file is part of Olena. @@ -29,8 +29,7 @@ /// \file /// -/// Definition of the mln::value::gray_f class. - +/// Declarations of the mln::value::internal::gray_f class. # include <iostream> @@ -44,14 +43,28 @@ # include <mln/value/float01_f.hh> # include <mln/trait/value_.hh> -# include <mln/value/graylevel_f.hh> +/* Because of mutual dependencies between the implementations of + mln::value::graylevel_f and mln::value::internal::gray_f, we have + to ensure that only the interfaces of the required classes are + included here. Implementations are included later, at the bottom of + this file. */ + +# ifdef MLN_INCLUDE_ONLY +# include <mln/value/graylevel_f.hh> +# else +# define MLN_INCLUDE_ONLY +# include <mln/value/graylevel_f.hh> +# undef MLN_INCLUDE_ONLY +# endif + namespace mln { namespace literal { - /// \{ Forward declarations. + /// Forward declarations. + /// \{ struct black_t; struct medium_gray_t; struct white_t; @@ -59,13 +72,16 @@ namespace mln } namespace value { - /// \{ Forward declarations. + /// Forward declarations. + /// \{ namespace internal { template <unsigned n> class gray_; struct gray_f; } + template <unsigned n> struct graylevel; + struct graylevel_f; struct float01_f; /// \} } @@ -94,6 +110,7 @@ namespace mln typedef bool ret; }; + /* FIXME: Dead code? */ // Necessary?? // template <typename F> // struct set_binary_< op::eq, @@ -204,297 +221,10 @@ namespace mln } // end of namespace mln -# include <mln/value/internal/gray_.hh> - - -namespace mln -{ - - namespace value - { - - namespace internal - { - # ifndef MLN_INCLUDE_ONLY - - // gray_f. - - inline - gray_f::gray_f() - { - } - - inline - gray_f::gray_f(const gray_f& g) - : Floating<gray_f>() - { - this->v_ = g.v_; - } - - inline - gray_f& - gray_f::operator=(const gray_f& g) - { - this->v_ = g.v_; - return *this; - } - - template <unsigned n> - gray_f::gray_f(const gray_<n>& rhs) - { - static const float denom = float(metal::math::pow_int<2, n>::value) - 1.f; - this->v_ = float(rhs.value()) / denom; - } - - template <unsigned n> - gray_f& - gray_f::operator=(const gray_<n>& rhs) - { - static const float denom = float(metal::math::pow_int<2, n>::value) - 1.f; - this->v_ = float(rhs.value()) / denom; - return *this; - } - - inline - gray_f::gray_f(float val) - { - this->v_ = val; - } - - inline - gray_f& - gray_f::operator=(float val) - { - this->v_ = val; - return *this; - } - - inline - gray_f::gray_f(const graylevel_f& rhs) - { - this->v_ = rhs.value(); - } - - inline - gray_f& - gray_f::operator=(const graylevel_f& rhs) - { - this->v_ = rhs.value(); - return *this; - } - - template <unsigned m> - inline - gray_f::operator graylevel<m>() const - { - return graylevel<m>(int(round(this->v_ * (mlc_pow_int(2, m) - 1)))); - } - - - template <unsigned m> - inline - gray_f::operator gray_<m>() const - { - return gray_<m>(int(round(this->v_ * (mlc_pow_int(2, m) - 1)))); - } - - inline - gray_f::operator graylevel_f() const - { - return graylevel_f(this->v_); - } - - inline - float - gray_f::value() const - { - return this->v_; - } - - // Operators. - - inline - std::ostream& operator<<(std::ostream& ostr, const gray_f& g) - { - return ostr << g.value() << "/gl_f"; // FIXME: Be more explicit! - } - +# include <mln/value/internal/gray_f.hxx> +# include <mln/value/graylevel_f.hxx> # endif // ! MLN_INCLUDE_ONLY - } // end of namespace mln::value::internal - - - // Graylevel_F operators. - - // Op glf == Int - - template <typename I> - inline - bool - operator==(const Integer<I>& lhs, const graylevel_f& rhs) - { - return rhs.value() == exact(lhs); - } - - // Op glf == glf - inline - bool - operator==(const graylevel_f& lhs, const graylevel_f& rhs) - { - return rhs.value() == lhs.value(); - } - - // Op glf + glf - inline - mln_trait_op_plus_(graylevel_f, graylevel_f) - operator+(const graylevel_f& lhs, const graylevel_f& rhs) - { - return lhs.value() + rhs.value(); - } - - // Op glf + gl<n> - template <unsigned n> - inline - mln_trait_op_plus(graylevel_f, graylevel<n>) - operator+(const graylevel_f& lhs, const graylevel<n>& rhs) - { - return lhs.value() + graylevel_f(rhs).value(); - } - - // Op gl<n> + glf - template <unsigned n> - inline - mln_trait_op_plus(graylevel_f, graylevel<n>) - operator+(const graylevel<n>& lhs, const graylevel_f& rhs) - { - return rhs.value() + graylevel_f(lhs).value(); - } - - - // Op glf + Another type - template <typename I> - inline - void - operator+(const graylevel_f& lhs, const I& i) - { - (void) lhs; - (void) i; - typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; - } - - - // Op Another type + glf - template <typename I> - inline - void - operator+(const I& i, const graylevel_f& rhs) - { - (void) i; - (void) rhs; - typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; - } - - - // Op glf - Another type - template <typename I> - inline - void - operator-(const graylevel_f& lhs, const I& i) - { - (void) lhs; - (void) i; - typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; - } - - - // Op Another type - glf - template <typename I> - inline - void - operator-(const I& i, const graylevel_f& rhs) - { - (void) i; - (void) rhs; - typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a; - } - - // Op glf - glf - - inline - mln_trait_op_minus_(graylevel_f, graylevel_f) - operator-(const graylevel_f& lhs, const graylevel_f& rhs) - { - return lhs.value() - rhs.value(); - } - - // Op glf * glf - inline - mln_trait_op_times_(graylevel_f, graylevel_f) - operator*(const graylevel_f& lhs, const graylevel_f& rhs) - { - return lhs.value() * rhs.value(); - } - - // Op symm glf * Int - - template <typename I> - inline - mln_trait_op_times(graylevel_f, I) - operator*(const graylevel_f& lhs, const Integer<I>& rhs) - { - return lhs.value() * int(exact(rhs)); - } - - template <typename I> - inline - mln_trait_op_times(I, graylevel_f) - operator*(const Integer<I>& lhs, const graylevel_f& rhs) - { - return rhs.value() * int(exact(lhs)); - } - - // Op symm glf * Float - - template <typename F> - inline - mln_trait_op_times(graylevel_f, F) - operator*(const graylevel_f& lhs, const Floating<F>& rhs) - { - return lhs.value() * exact(rhs); - } - - template <typename F> - inline - mln_trait_op_times(F, graylevel_f) - operator*(const Floating<F>& lhs, const graylevel_f& rhs) - { - return rhs.value() * exact(lhs); - } - - - - // Op * scalar - template <typename S> - inline - mln_trait_op_times(graylevel_f, S) - operator*(const graylevel_f& lhs, const scalar_<S>& rhs) - { - return lhs.value() * rhs.to_equiv(); - } - - // Op / scalar - template <typename S> - inline - mln_trait_op_div(graylevel_f, S) - operator/(const graylevel_f& lhs, const scalar_<S>& rhs) - { - mln_precondition(rhs.to_equiv() != S(0)); - return lhs.value() / rhs.to_equiv(); - } - - } // end of namespace mln::value - -} // end of namespace mln #endif // ! MLN_VALUE_INTERNAL_GRAY_F_HH diff --git a/milena/mln/value/internal/gray_f.hxx b/milena/mln/value/internal/gray_f.hxx new file mode 100644 index 0000000..c6863c3 --- /dev/null +++ b/milena/mln/value/internal/gray_f.hxx @@ -0,0 +1,160 @@ +// Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013 EPITA Research and +// Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <
http://www.gnu.org/licenses/
>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef MLN_VALUE_INTERNAL_GRAY_F_HXX +# define MLN_VALUE_INTERNAL_GRAY_F_HXX + +/// \file +/// +/// Definition of the mln::value::internal::gray_f class. + +# include <mln/value/internal/gray_f.hh> + +# include <mln/math/round.hh> + + +namespace mln +{ + + namespace value + { + + namespace internal + { + + // gray_f. + + inline + gray_f::gray_f() + { + } + + inline + gray_f::gray_f(const gray_f& g) + : Floating<gray_f>() + { + this->v_ = g.v_; + } + + inline + gray_f& + gray_f::operator=(const gray_f& g) + { + this->v_ = g.v_; + return *this; + } + + template <unsigned n> + gray_f::gray_f(const gray_<n>& rhs) + { + static const float denom = + float(metal::math::pow_int<2, n>::value) - 1.f; + this->v_ = float(rhs.value()) / denom; + } + + template <unsigned n> + gray_f& + gray_f::operator=(const gray_<n>& rhs) + { + static const float denom = + float(metal::math::pow_int<2, n>::value) - 1.f; + this->v_ = float(rhs.value()) / denom; + return *this; + } + + inline + gray_f::gray_f(float val) + { + this->v_ = val; + } + + inline + gray_f& + gray_f::operator=(float val) + { + this->v_ = val; + return *this; + } + + inline + gray_f::gray_f(const graylevel_f& rhs) + { + this->v_ = rhs.value(); + } + + inline + gray_f& + gray_f::operator=(const graylevel_f& rhs) + { + this->v_ = rhs.value(); + return *this; + } + + template <unsigned m> + inline + gray_f::operator graylevel<m>() const + { + return graylevel<m>(math::round<int>()(this->v_ + * (mlc_pow_int(2, m) - 1))); + } + + + template <unsigned m> + inline + gray_f::operator gray_<m>() const + { + return gray_<m>(math::round<int>()(this->v_ + * (mlc_pow_int(2, m) - 1))); + } + + inline + gray_f::operator graylevel_f() const + { + return graylevel_f(this->v_); + } + + inline + float + gray_f::value() const + { + return this->v_; + } + + // Operators. + + inline + std::ostream& operator<<(std::ostream& ostr, const gray_f& g) + { + return ostr << g.value() << "/gray_f"; // FIXME: Be more explicit! + } + + } // end of namespace mln::value::internal + + } // end of namespace mln::value + +} // end of namespace mln + +#endif // ! MLN_VALUE_INTERNAL_GRAY_F_HXX -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-73-gf782485 Address errors reported by clang++ in Scribo.
by Roland Levillain
* scribo/io/text_boxes/save.hh, * scribo/primitive/extract/components.hh, * scribo/primitive/link/with_single_right_link.hh, * scribo/text/recognition.hh, * scribo/toolchain/content_in_doc.hh, * scribo/toolchain/content_in_hdoc.hh, * scribo/toolchain/text_in_doc.hh, * scribo/toolchain/text_in_doc_preprocess.hh, * scribo/toolchain/text_in_picture.hh: Do not provide default arguments twice. --- scribo/ChangeLog | 15 +++++++++++++++ scribo/scribo/io/text_boxes/save.hh | 4 ++-- scribo/scribo/primitive/extract/components.hh | 6 +++--- .../primitive/link/with_single_right_link.hh | 4 ++-- scribo/scribo/text/recognition.hh | 4 ++-- scribo/scribo/toolchain/content_in_doc.hh | 12 ++++++------ scribo/scribo/toolchain/content_in_hdoc.hh | 10 +++++----- scribo/scribo/toolchain/text_in_doc.hh | 10 +++++----- scribo/scribo/toolchain/text_in_doc_preprocess.hh | 8 ++++---- scribo/scribo/toolchain/text_in_picture.hh | 6 +++--- 10 files changed, 47 insertions(+), 32 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index b4f5b9f..1d0c69d 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,18 @@ +2013-02-06 Roland Levillain <roland(a)lrde.epita.fr> + + Address errors reported by clang++ in Scribo. + + * scribo/io/text_boxes/save.hh, + * scribo/primitive/extract/components.hh, + * scribo/primitive/link/with_single_right_link.hh, + * scribo/text/recognition.hh, + * scribo/toolchain/content_in_doc.hh, + * scribo/toolchain/content_in_hdoc.hh, + * scribo/toolchain/text_in_doc.hh, + * scribo/toolchain/text_in_doc_preprocess.hh, + * scribo/toolchain/text_in_picture.hh: + Do not provide default arguments twice. + 2012-10-09 Roland Levillain <roland(a)lrde.epita.fr> Work around an overload resolution problem reported by g++ 4.7. diff --git a/scribo/scribo/io/text_boxes/save.hh b/scribo/scribo/io/text_boxes/save.hh index 5bbf97b..1a7842f 100644 --- a/scribo/scribo/io/text_boxes/save.hh +++ b/scribo/scribo/io/text_boxes/save.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -59,7 +59,7 @@ namespace scribo void save(const line_set<L>& lines, const std::string& output_name, - const mln_site(L)& crop_shift = literal::origin) + const mln_site(L)& crop_shift) { trace::entering("scribo::io::text_boxes:save"); mln_precondition(lines.is_valid()); diff --git a/scribo/scribo/primitive/extract/components.hh b/scribo/scribo/primitive/extract/components.hh index fe2b523..45e0a47 100644 --- a/scribo/scribo/primitive/extract/components.hh +++ b/scribo/scribo/primitive/extract/components.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2011, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -97,7 +97,7 @@ namespace scribo component_set<mln_ch_value(I,V)> components(const Image<I>& input, const Image<J>& binary_input, const Neighborhood<N>& nbh, V& ncomponents, - component::Type type = component::Undefined) + component::Type type) { trace::entering("scribo::components"); @@ -123,7 +123,7 @@ namespace scribo component_set<mln_ch_value(I,V)> components(const Image<I>& binary_input, const Neighborhood<N>& nbh, V& ncomponents, - component::Type type = component::Undefined) + component::Type type) { trace::entering("scribo::components"); diff --git a/scribo/scribo/primitive/link/with_single_right_link.hh b/scribo/scribo/primitive/link/with_single_right_link.hh index bc7942b..195a84c 100644 --- a/scribo/scribo/primitive/link/with_single_right_link.hh +++ b/scribo/scribo/primitive/link/with_single_right_link.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2011, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -126,7 +126,7 @@ namespace scribo object_links<L> with_single_right_link(const component_set<L>& components, unsigned neighb_max_distance, - anchor::Type anchor = anchor::MassCenter) + anchor::Type anchor) { trace::entering("scribo::primitive::link::with_single_right_link"); diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh index 4795511..540a01c 100644 --- a/scribo/scribo/text/recognition.hh +++ b/scribo/scribo/text/recognition.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -218,7 +218,7 @@ namespace scribo void recognition(const Image<I>& line_, const char *language, - const std::string& output_file = std::string()) + const std::string& output_file) { trace::entering("scribo::text::recognition"); diff --git a/scribo/scribo/toolchain/content_in_doc.hh b/scribo/scribo/toolchain/content_in_doc.hh index 0d3430e..4a3f48c 100644 --- a/scribo/scribo/toolchain/content_in_doc.hh +++ b/scribo/scribo/toolchain/content_in_doc.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -59,11 +59,11 @@ namespace scribo document<mln_ch_value(I, def::lbl_type)> content_in_doc(const Image<I>& input, const Image<J>& input_preproc, bool denoise, - bool find_line_seps = true, - bool find_whitespace_seps = true, - bool enable_ocr = true, - const std::string& language = std::string("eng"), - bool verbose = false) + bool find_line_seps, + bool find_whitespace_seps, + bool enable_ocr, + const std::string& language, + bool verbose) { mln_precondition(exact(input).is_valid()); mln_precondition(exact(input_preproc).is_valid()); diff --git a/scribo/scribo/toolchain/content_in_hdoc.hh b/scribo/scribo/toolchain/content_in_hdoc.hh index 97233d5..4b8b72a 100644 --- a/scribo/scribo/toolchain/content_in_hdoc.hh +++ b/scribo/scribo/toolchain/content_in_hdoc.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -58,10 +58,10 @@ namespace scribo document<mln_ch_value(I, def::lbl_type)> content_in_hdoc(const Image<I>& input, const Image<J>& input_preproc, bool denoise, - bool find_line_seps = true, - bool find_whitespace_seps = true, - bool enable_ocr = true, - const std::string& language = std::string("eng")) + bool find_line_seps, + bool find_whitespace_seps, + bool enable_ocr, + const std::string& language) { mln_precondition(exact(input).is_valid()); mln_precondition(exact(input_preproc).is_valid()); diff --git a/scribo/scribo/toolchain/text_in_doc.hh b/scribo/scribo/toolchain/text_in_doc.hh index 960a22a..0d0ab9f 100644 --- a/scribo/scribo/toolchain/text_in_doc.hh +++ b/scribo/scribo/toolchain/text_in_doc.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -57,10 +57,10 @@ namespace scribo template <typename I> line_set<mln_ch_value(I, def::lbl_type)> text_in_doc(const Image<I>& input, bool denoise, - const std::string& language = std::string("eng"), - bool find_line_seps = true, - bool find_whitespace_seps = true, - bool verbose = false) + const std::string& language, + bool find_line_seps, + bool find_whitespace_seps, + bool verbose) { internal::text_in_doc_functor<I> f; f.enable_denoising = denoise; diff --git a/scribo/scribo/toolchain/text_in_doc_preprocess.hh b/scribo/scribo/toolchain/text_in_doc_preprocess.hh index 0a99487..a614996 100644 --- a/scribo/scribo/toolchain/text_in_doc_preprocess.hh +++ b/scribo/scribo/toolchain/text_in_doc_preprocess.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// Copyright (C) 2010, 2011, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -117,7 +117,7 @@ namespace scribo template <typename I> mln_ch_value(I,bool) text_in_doc_preprocess(const Image<I>& input, bool enable_fg_bg, - bool verbose = false) + bool verbose) { return text_in_doc_preprocess(input, enable_fg_bg, 0.34, verbose); } @@ -127,7 +127,7 @@ namespace scribo mln_ch_value(I,bool) text_in_doc_preprocess(const Image<I>& input_, bool enable_fg_bg, unsigned lambda, double K, - bool verbose = false) + bool verbose) { const I& input = exact(input_); mln_precondition(input.is_valid()); @@ -146,7 +146,7 @@ namespace scribo template <typename I> mln_ch_value(I,bool) text_in_doc_preprocess(const Image<I>& input, unsigned lambda, - bool verbose = false) + bool verbose) { I tmp; return text_in_doc_preprocess(input, lambda, 0.34, true, tmp, verbose); diff --git a/scribo/scribo/toolchain/text_in_picture.hh b/scribo/scribo/toolchain/text_in_picture.hh index 8d05158..e588c45 100644 --- a/scribo/scribo/toolchain/text_in_picture.hh +++ b/scribo/scribo/toolchain/text_in_picture.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -57,8 +57,8 @@ namespace scribo component_set<mln_ch_value(I, def::lbl_type)> text_in_picture(const Image<I>& input_rgb_, bool bg_removal, bool multi_scale_bin, - unsigned max_dim_size = 0, unsigned lambda = 0, - bool verbose = false) + unsigned max_dim_size, unsigned lambda, + bool verbose) { trace::entering("scribo::toolchain::text_in_picture"); -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-72-g1f8557c Address more remaining clang++ errors in Milena.
by Roland Levillain
* mln/core/concept/proxy.hxx: Add and reorder forward declarations. * mln/accu/site_set/rectangularity.hh (rectangularity<P>): Do not re-import base class attributes as protected members, so that the base class can still access them. Adjust. * mln/geom/seeds2tiling_roundness.hh, * mln/subsampling/antialiased.hh, * mln/world/inter_pixel/dim2/make_edge_image.hh: Add missing header inclusions. * mln/io/plot/save.hh (save) * mln/morpho/tree/propagate_node.hh (propagate_node_to_descendants): Do not provide default arguments twice. * mln/topo/face_iter.hh, * mln/topo/n_face_iter.hh: Add `this->' qualifiers to disambiguate calls to base class methods. * tests/metal/converts_to.cc (from_2): Do not rely on uninitialized data. (main): Add a test case. --- milena/ChangeLog | 26 ++++++++++++++++++++ milena/mln/accu/site_set/rectangularity.hh | 19 ++++++-------- milena/mln/core/concept/proxy.hxx | 23 +++++++++++++---- milena/mln/geom/seeds2tiling_roundness.hh | 3 +- milena/mln/io/plot/save.hh | 4 +- milena/mln/morpho/tree/propagate_node.hh | 4 +- milena/mln/subsampling/antialiased.hh | 3 +- milena/mln/topo/face_iter.hh | 7 +++-- milena/mln/topo/n_face_iter.hh | 5 ++- .../mln/world/inter_pixel/dim2/make_edge_image.hh | 3 +- milena/tests/metal/converts_to.cc | 8 ++++- 11 files changed, 75 insertions(+), 30 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 41d7081..e294ca0 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,29 @@ +2013-02-05 Roland Levillain <roland(a)lrde.epita.fr> + + Address more remaining clang++ errors in Milena. + + * mln/core/concept/proxy.hxx: Add and reorder forward + declarations. + * mln/accu/site_set/rectangularity.hh (rectangularity<P>): Do not + re-import base class attributes as protected members, so that the + base class can still access them. + Adjust. + * mln/geom/seeds2tiling_roundness.hh, + * mln/subsampling/antialiased.hh, + * mln/world/inter_pixel/dim2/make_edge_image.hh: + Add missing header inclusions. + * mln/io/plot/save.hh (save) + * mln/morpho/tree/propagate_node.hh + (propagate_node_to_descendants): + Do not provide default arguments twice. + * mln/topo/face_iter.hh, + * mln/topo/n_face_iter.hh: + Add `this->' qualifiers to disambiguate calls to base class + methods. + * tests/metal/converts_to.cc (from_2): Do not rely on + uninitialized data. + (main): Add a test case. + 2012-03-09 Roland Levillain <roland(a)lrde.epita.fr> More clang++ support in Milena. diff --git a/milena/mln/accu/site_set/rectangularity.hh b/milena/mln/accu/site_set/rectangularity.hh index c278f0d..d74599f 100644 --- a/milena/mln/accu/site_set/rectangularity.hh +++ b/milena/mln/accu/site_set/rectangularity.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -77,13 +77,9 @@ namespace mln /// Return the rectangularity value. result to_result() const; - - protected: - using super_::a1_; - using super_::a2_; - }; + # ifndef MLN_INCLUDE_ONLY template <typename P> @@ -97,8 +93,8 @@ namespace mln mln_result(rectangularity<P>::A1) rectangularity<P>::bbox() const { - mln_precondition(a1_.is_valid()); - return a1_.to_result(); + mln_precondition(this->a1_.is_valid()); + return this->a1_.to_result(); } template <typename P> @@ -106,8 +102,8 @@ namespace mln mln_result(rectangularity<P>::A2) rectangularity<P>::area() const { - mln_precondition(a2_.is_valid()); - return a2_.to_result(); + mln_precondition(this->a2_.is_valid()); + return this->a2_.to_result(); } template <typename P> @@ -117,7 +113,8 @@ namespace mln { mln_precondition(this->is_valid()); // Force division return type. - return static_cast<result>(a2_.to_result()) / a1_.to_result().nsites(); + return static_cast<result> + (this->a2_.to_result()) / this->a1_.to_result().nsites(); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/core/concept/proxy.hxx b/milena/mln/core/concept/proxy.hxx index 114c4a9..3159fd3 100644 --- a/milena/mln/core/concept/proxy.hxx +++ b/milena/mln/core/concept/proxy.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2008, 2009, 2012 EPITA Research and Development +// Copyright (C) 2008, 2009, 2012, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -42,9 +42,25 @@ namespace mln { - // Fwd decls. + /// Fwd decls. + /// \{ template <typename E> struct Proxy; + namespace internal + { + template <typename T> + struct unproxy_rec_; + } + + template <typename T> + typename mln::internal::unproxy_rec_<T>::ret + unproxy_rec(T& t); + + template <typename T> + typename mln::internal::unproxy_rec_<const T>::ret + unproxy_rec(const T& t); + /// \} + namespace internal { @@ -81,9 +97,6 @@ namespace mln - template <typename T> - struct unproxy_rec_; - template <typename O, bool is_proxy> struct helper_unproxy_rec; diff --git a/milena/mln/geom/seeds2tiling_roundness.hh b/milena/mln/geom/seeds2tiling_roundness.hh index 214e553..5a61d1b 100644 --- a/milena/mln/geom/seeds2tiling_roundness.hh +++ b/milena/mln/geom/seeds2tiling_roundness.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -33,6 +33,7 @@ # include <map> # include <mln/core/concept/image.hh> +# include <mln/core/image/image2d.hh> # include <mln/core/concept/neighborhood.hh> # include <mln/core/alias/w_window2d_int.hh> # include <mln/core/site_set/p_priority.hh> diff --git a/milena/mln/io/plot/save.hh b/milena/mln/io/plot/save.hh index d217915..9571847 100644 --- a/milena/mln/io/plot/save.hh +++ b/milena/mln/io/plot/save.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2010, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -87,7 +87,7 @@ namespace mln template <typename T> inline void save(const util::array<T>& arr, const std::string& filename, - int start_value = 0) + int start_value) { trace::entering("mln::io::plot::save"); diff --git a/milena/mln/morpho/tree/propagate_node.hh b/milena/mln/morpho/tree/propagate_node.hh index 7778905..33c06c2 100644 --- a/milena/mln/morpho/tree/propagate_node.hh +++ b/milena/mln/morpho/tree/propagate_node.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -121,7 +121,7 @@ namespace mln const T& t, Image<A>& a_, const mln_value(A)& v, - unsigned* nb_leaves = 0) + unsigned* nb_leaves) { A& a = exact(a_); mln_precondition(a.is_valid()); diff --git a/milena/mln/subsampling/antialiased.hh b/milena/mln/subsampling/antialiased.hh index 66bdd33..24b7224 100644 --- a/milena/mln/subsampling/antialiased.hh +++ b/milena/mln/subsampling/antialiased.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory +// Copyright (C) 2009, 2010, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -33,6 +33,7 @@ #include <mln/core/concept/image.hh> +#include <mln/core/alias/point2d.hh> #include <mln/border/thickness.hh> #include <mln/extension/adjust_duplicate.hh> #include <mln/core/macros.hh> diff --git a/milena/mln/topo/face_iter.hh b/milena/mln/topo/face_iter.hh index c78500a..6e91a08 100644 --- a/milena/mln/topo/face_iter.hh +++ b/milena/mln/topo/face_iter.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -162,7 +163,7 @@ namespace mln face_fwd_iter<D>::face_fwd_iter(complex<D>& c) : super_(c) { - set_cplx(c); + this->set_cplx(c); mln_postcondition(!is_valid()); } @@ -214,7 +215,7 @@ namespace mln face_bkd_iter<D>::face_bkd_iter(complex<D>& c) : super_(c) { - set_cplx(c); + this->set_cplx(c); mln_postcondition(!is_valid()); } diff --git a/milena/mln/topo/n_face_iter.hh b/milena/mln/topo/n_face_iter.hh index 4cdb091..9dfc670 100644 --- a/milena/mln/topo/n_face_iter.hh +++ b/milena/mln/topo/n_face_iter.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -191,7 +192,7 @@ namespace mln : super_(c) { mln_precondition(n <= D); - set_cplx(c); + this->set_cplx(c); set_n(n); mln_postcondition(!is_valid()); } diff --git a/milena/mln/world/inter_pixel/dim2/make_edge_image.hh b/milena/mln/world/inter_pixel/dim2/make_edge_image.hh index 8012b60..68593bd 100644 --- a/milena/mln/world/inter_pixel/dim2/make_edge_image.hh +++ b/milena/mln/world/inter_pixel/dim2/make_edge_image.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -30,6 +30,7 @@ /// /// Construct a valued image of edges. +# include <mln/core/image/image2d.hh> # include <mln/core/image/dmorph/extension_ima.hh> # include <mln/core/image/dmorph/image_if.hh> diff --git a/milena/tests/metal/converts_to.cc b/milena/tests/metal/converts_to.cc index 119fc8f..68b20b9 100644 --- a/milena/tests/metal/converts_to.cc +++ b/milena/tests/metal/converts_to.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -25,6 +26,7 @@ #include <mln/metal/converts_to.hh> +#include <mln/accu/math/sum.hh> struct from_1 @@ -38,7 +40,7 @@ struct dest struct from_2 { - operator dest() const { dest* tmp; return *tmp; } + operator dest() const { dest* tmp = 0; return *tmp; } }; @@ -72,6 +74,8 @@ int main() metal::converts_to<derived, base>::check(); metal::converts_to<derived, const base>::check(); + metal::converts_to<accu::math::sum<int, int>, int>::check(); + // metal::converts_to<derived, base_>::check_not(); // metal::converts_to<derived, const base_>::check_not(); } -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-71-gc52c5f6 More clang++ support in Milena.
by Roland Levillain
* mln/core/concept/proxy.hxx (get_proxy_impl<Subject, E>): Swap two definitions to help clang++ properly resolve calls to the overloaded conversion operator. --- milena/ChangeLog | 8 ++++++++ milena/mln/core/concept/proxy.hxx | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index ff573d2..41d7081 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,11 @@ +2012-03-09 Roland Levillain <roland(a)lrde.epita.fr> + + More clang++ support in Milena. + + * mln/core/concept/proxy.hxx (get_proxy_impl<Subject, E>): Swap + two definitions to help clang++ properly resolve calls to the + overloaded conversion operator. + 2010-11-29 Roland Levillain <roland(a)lrde.epita.fr> Start to work around clang++ deficiencies to compile Milena. diff --git a/milena/mln/core/concept/proxy.hxx b/milena/mln/core/concept/proxy.hxx index 2f77cec..114c4a9 100644 --- a/milena/mln/core/concept/proxy.hxx +++ b/milena/mln/core/concept/proxy.hxx @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2012 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -263,8 +264,8 @@ namespace mln mlc_is_a(Subject, Proxy)::value > { public: - operator mlc_fix_return(Subject) (); operator mlc_fix_return(mlc_const_return(Subject)) () const; + operator mlc_fix_return(Subject) (); }; template <typename Subject, typename E> -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
olena-2.0-70-g44a94cb Start to work around clang++ deficiencies to compile Milena.
by Roland Levillain
* mln/util/tracked_ptr.hh (tracked_ptr<T>::operator*): New. * mln/topo/complex.hh: Decompose complex instructions. --- milena/ChangeLog | 7 +++++ milena/mln/topo/complex.hh | 54 +++++++++++++++++++++++++++++++-------- milena/mln/util/tracked_ptr.hh | 32 ++++++++++++++++++++++- 3 files changed, 80 insertions(+), 13 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 6ce0fe2..ff573d2 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,10 @@ +2010-11-29 Roland Levillain <roland(a)lrde.epita.fr> + + Start to work around clang++ deficiencies to compile Milena. + + * mln/util/tracked_ptr.hh (tracked_ptr<T>::operator*): New. + * mln/topo/complex.hh: Decompose complex instructions. + 2012-10-08 Roland Levillain <roland(a)lrde.epita.fr> Revive headers required by the RGB component functors. diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh index 9cfd266..9a3d4bb 100644 --- a/milena/mln/topo/complex.hh +++ b/milena/mln/topo/complex.hh @@ -479,9 +479,13 @@ namespace mln n_face<0u, D> complex<D>::add_face() { + // Upcast `data_' to get access to the field `faces_' of its + // base class `internal::faces_set_mixin<0u, D>'. + std::vector< face_data<0u, D> >& faces_0 = + static_cast< internal::faces_set_mixin<0u, D>& >(*data_).faces_; /* FIXME: This is not thread-proof (these two lines should form an atomic section). */ - data_->internal::faces_set_mixin<0u, D>::faces_.push_back(face_data<0u, D>()); + faces_0.push_back(face_data<0u, D>()); unsigned id = nfaces_of_static_dim<0u>() - 1; return n_face<0u, D>(*this, id); } @@ -505,9 +509,13 @@ namespace mln } face_data<N + 1, D> f; + // Upcast `data_' to get access to the field `faces_' of its + // base class `internal::faces_set_mixin<N + 1, D>'. + std::vector< face_data<N + 1, D> >& faces_n_plus_1 = + static_cast< internal::faces_set_mixin<N + 1, D>& >(*data_).faces_; /* FIXME: This is not thread-proof (these two lines should form an atomic section). */ - data_->internal::faces_set_mixin<N + 1, D>::faces_.push_back(f); + faces_n_plus_1.push_back(f); unsigned id = nfaces_of_static_dim<N + 1>() - 1; n_face<N + 1, D> fh(*this, id); @@ -587,7 +595,11 @@ namespace mln unsigned complex<D>::nfaces_of_static_dim() const { - return data_->internal::faces_set_mixin<N, D>::faces_.size(); + // Upcast `data_' to get access to the field `faces_' of its + // base class `internal::faces_set_mixin<N, D>'. + const std::vector< face_data<N, D> >& faces_n = + static_cast< const internal::faces_set_mixin<N, D>& >(*data_).faces_; + return faces_n.size(); } @@ -616,7 +628,11 @@ namespace mln face_data<N, D>& complex<D>::face_data_(unsigned face_id) { - return data_->internal::faces_set_mixin<N, D>::faces_[face_id]; + // Upcast `data_' to get access to the field `faces_' of its + // base class `internal::faces_set_mixin<N, D>'. + std::vector< face_data<N, D> >& faces_n = + static_cast< internal::faces_set_mixin<N, D>& >(*data_).faces_; + return faces_n[face_id]; } template <unsigned D> @@ -625,7 +641,11 @@ namespace mln const face_data<N, D>& complex<D>::face_data_(unsigned face_id) const { - return data_->internal::faces_set_mixin<N, D>::faces_[face_id]; + // Upcast `data_' to get access to the field `faces_' of its + // base class `internal::faces_set_mixin<N, D>'. + const std::vector< face_data<N, D> >& faces_n = + static_cast< const internal::faces_set_mixin<N, D>& >(*data_).faces_; + return faces_n[face_id]; } template <unsigned D> @@ -678,7 +698,9 @@ namespace mln void complex<D>::print(std::ostream& ostr) const { - data_->internal::faces_set_mixin<D, D>::print_rec_asc(ostr); + // Upcast `data_' to get access to the method `print_rec_asc' of + // its base class `internal::faces_set_mixin<D, D>'. + static_cast< const internal::faces_set_mixin<D, D>& >(*data_).print_rec_asc(ostr); } template <unsigned D> @@ -690,7 +712,9 @@ namespace mln // Ensure N is compatible with D. metal::bool_< N <= D >::check(); - data_->internal::faces_set_mixin<N, D>::print(ostr); + // Upcast `data_' to get access to the method `print' of its + // base class `internal::faces_set_mixin<N, D>'. + static_cast< const internal::faces_set_mixin<N, D>& >(*data_).print(ostr); } template <unsigned D> @@ -842,7 +866,9 @@ namespace mln T complex<D>::fold_left_(const BinaryFunction& f, const T& accu) const { - return data_->internal::faces_set_mixin<D, D>::fold_left_(f, accu); + // Upcast `data_' to get access to the method `fold_left_' of + // its base class `internal::faces_set_mixin<D, D>'. + return static_cast< const internal::faces_set_mixin<D, D>& >(*data_).fold_left_(f, accu); } namespace internal @@ -857,7 +883,9 @@ namespace mln faces_set_mixin<D, D>::fold_left_(const BinaryFunction& f, const T& accu) const { - return faces_set_mixin<D - 1, D>::fold_left_(f, f(accu, faces_)); + // Upcast `data_' to get access to the method `fold_left_' of + // its base class `internal::faces_set_mixin<D - 1, D>'. + return static_cast< const faces_set_mixin<D - 1, D>& >(*this).fold_left_(f, f(accu, faces_)); } template <unsigned N, unsigned D> @@ -867,7 +895,9 @@ namespace mln faces_set_mixin<N, D>::fold_left_(const BinaryFunction& f, const T& accu) const { - return faces_set_mixin<N - 1, D>::fold_left_(f, f(accu, faces_)); + // Upcast `data_' to get access to the method `fold_left_' of + // its base class `internal::faces_set_mixin<N - 1, D>'. + return static_cast< const faces_set_mixin<N - 1, D>& >(*this).fold_left_(f, f(accu, faces_)); } template <unsigned D> @@ -904,7 +934,9 @@ namespace mln { // Ensure N is compatible with D. mln_precondition(n <= D); - return data_->internal::faces_set_mixin<D, D>::apply_if_dim_matches_(n, f); + // Upcast `data_' to get access to the method `apply_if_dim_matches_' of + // its base class `internal::faces_set_mixin<D, D>'. + return static_cast< const internal::faces_set_mixin<D, D>& >(*data_).apply_if_dim_matches_(n, f); } namespace internal diff --git a/milena/mln/util/tracked_ptr.hh b/milena/mln/util/tracked_ptr.hh index 24b9b62..a13ecef 100644 --- a/milena/mln/util/tracked_ptr.hh +++ b/milena/mln/util/tracked_ptr.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2006, 2007, 2008, 2009, 2010 EPITA Research and +// Development Laboratory (LRDE) // // This file is part of Olena. // @@ -63,6 +63,16 @@ namespace mln /// Negation (for arithmetical tests). bool operator !() const; + /// Mimics the behavior of op* for a pointer in the const case. + /// + /// \invariant Pointer proxy exists. + const T& operator*() const; + + /// Mimics the behavior of op* for a pointer in the mutable case. + /// + /// \invariant Pointer proxy exists. + T& operator*(); + /// Mimics the behavior of op-> for a pointer in the const case. /// /// \invariant Pointer proxy exists. @@ -119,6 +129,24 @@ namespace mln template <typename T> inline + const T& tracked_ptr<T>::operator*() const + { + mln_invariant(run_()); + mln_precondition(ptr_ != 0); + return *ptr_; + } + + template <typename T> + inline + T& tracked_ptr<T>::operator*() + { + mln_invariant(run_()); + mln_precondition(ptr_ != 0); + return *ptr_; + } + + template <typename T> + inline const T* tracked_ptr<T>::operator->() const { mln_invariant(run_()); -- 1.7.2.5
11Â years, 11Â months
1
0
0
0
← Newer
1
...
150
151
152
153
154
155
156
...
963
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
Results per page:
10
25
50
100
200