LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
List overview
Download
Olena-patches
June 2007
----- 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
4 participants
12 discussions
Start a n
N
ew thread
984: Change oln_ into mln_.
by Thierry Geraud
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog from Thierry Geraud <thierry.geraud(a)lrde.epita.fr> Change oln_ into mln_. * milena/morpho/erosion.hh: New. * milena/io: New. * milena/value/props.hh: New. * milena/border: New. * milena/test/main.cc, * milena/debug/println.hh, * milena/level/fill.hh, * milena/core/dpoints_qiter.hh, * milena/core/macros.hh, * milena/core/box_piter.hh, * milena/core/concept/image.hh, * milena/core/concept/genpoint.hh, * milena/core/concept/piter.hh, * milena/core/concept/point_set.hh, * milena/core/concept/window.hh, * milena/core/concept/box.hh, * milena/core/concept/point.hh, * milena/core/concept/dpoint.hh, * milena/core/internal/image_adaptor.hh, * milena/core/internal/image_base.hh, * milena/core/safe_image.hh, * milena/mlc/same_point.hh: Change oln_ into mln_. core/box_piter.hh | 6 +-- core/concept/box.hh | 2 - core/concept/dpoint.hh | 4 +- core/concept/genpoint.hh | 22 ++++++------- core/concept/image.hh | 20 +++++------ core/concept/piter.hh | 4 +- core/concept/point.hh | 8 ++-- core/concept/point_set.hh | 10 ++--- core/concept/window.hh | 6 +-- core/dpoints_qiter.hh | 10 ++--- core/internal/image_adaptor.hh | 18 +++++----- core/internal/image_base.hh | 10 ++--- core/macros.hh | 44 +++++++++++++------------- core/safe_image.hh | 16 ++++----- debug/println.hh | 6 +-- level/fill.hh | 6 +-- mlc/same_point.hh | 2 - morpho/erosion.hh | 69 +++++++++++++++++++++++++++++++++++++++++ test/main.cc | 3 + value/props.hh | 47 +++++++++++++++++++++++++++ 20 files changed, 216 insertions(+), 97 deletions(-) Index: milena/test/main.cc --- milena/test/main.cc (revision 983) +++ milena/test/main.cc (working copy) @@ -5,6 +5,8 @@ #include <core/window2d.hh> #include <core/rectangle2d.hh> +#include <morpho/erosion.hh> + int main() { @@ -26,6 +28,7 @@ std::cout << win << std::endl; debug::println(ima, win); + morpho::erosion(ima, win); rectangle2d rec(1, 2); std::cout << rec << std::endl; Index: milena/morpho/erosion.hh --- milena/morpho/erosion.hh (revision 0) +++ milena/morpho/erosion.hh (revision 0) @@ -0,0 +1,69 @@ +#ifndef MLN_MORPHO_EROSION_HH +# define MLN_MORPHO_EROSION_HH + +# include <core/concept/image.hh> +# include <core/concept/window.hh> +// FIXME: # include <border/assign.hh> +# include <value/props.hh> + + +namespace mln +{ + + namespace morpho + { + + template <typename I, typename W> + I erosion(const Image<I>& input, const Window<W>& win); + + +# ifndef MLN_INCLUDE_ONLY + + namespace impl + { + + template <typename I, typename W> + I erosion(const Image<I>& input_, const Window<W>& win_) + { + const I& input = exact(input_); + const W& win = exact(win_); + + typedef mln_value(I) value; + + I output(input.domain()); + mln_piter(I) p(input.domain()); + mln_qiter(W) q(win, p); + for_all(p) + { + value v = mln_max(value); + for_all(q) if (input.owns_(q)) + { + if (input(q) < v) + v = input(q); + } + output(p) = v; + } + return output; + } + + // ... + + } // end of namespace mln::morpho::impl + + + // facade + + template <typename I, typename W> + I erosion(const Image<I>& input, const Window<W>& win) + { + return impl::erosion(exact(input), exact(win)); + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::morpho + +} // end of namespace mln + + +#endif // ! MLN_MORPHO_EROSION_HH Index: milena/debug/println.hh --- milena/debug/println.hh (revision 983) +++ milena/debug/println.hh (working copy) @@ -25,7 +25,7 @@ void println(const Image<I>& input_) { const I& input = exact(input_); - oln_piter(I) p(input.domain()); + mln_piter(I) p(input.domain()); for_all(p) std::cout << input(p) << ' '; std::cout << std::endl; @@ -39,8 +39,8 @@ const I& input = exact(input_); const W& win = exact(win_); - oln_piter(I) p(input.domain()); - oln_qiter(W) q(win, p); + mln_piter(I) p(input.domain()); + mln_qiter(W) q(win, p); for_all(p) { std::cout << input(p) << ':'; Index: milena/level/fill.hh --- milena/level/fill.hh (revision 983) +++ milena/level/fill.hh (working copy) @@ -11,16 +11,16 @@ { template <typename I> - void fill(Image<I>& ima_, const oln_value(I)& value); + void fill(Image<I>& ima_, const mln_value(I)& value); # ifndef MLN_INCLUDE_ONLY template <typename I> - void fill(Image<I>& ima_, const oln_value(I)& value) + void fill(Image<I>& ima_, const mln_value(I)& value) { I& ima = exact(ima_); - oln_piter(I) p(ima.domain()); + mln_piter(I) p(ima.domain()); for_all(p) ima(p) = value; } Index: milena/core/dpoints_qiter.hh --- milena/core/dpoints_qiter.hh (revision 983) +++ milena/core/dpoints_qiter.hh (working copy) @@ -16,9 +16,9 @@ enum { dim = D::dim }; typedef D dpoint; - typedef oln_point(D) point; + typedef mln_point(D) point; typedef point psite; - typedef oln_coord(D) coord; + typedef mln_coord(D) coord; template <typename Dps, typename Pref> dpoints_fwd_qiter(const Dps& dps, @@ -57,14 +57,14 @@ } template <typename D> - dpoints_fwd_qiter<D>::operator point() const + dpoints_fwd_qiter<D>::operator mln_point(D)() const { assert(is_valid()); return p_; } template <typename D> - const oln_point(D)* + const mln_point(D)* dpoints_fwd_qiter<D>::pointer() const { return & p_; @@ -109,7 +109,7 @@ } template <typename D> - oln_coord(D) + mln_coord(D) dpoints_fwd_qiter<D>::operator[](unsigned i) const { return p_[i]; Index: milena/core/macros.hh --- milena/core/macros.hh (revision 983) +++ milena/core/macros.hh (working copy) @@ -2,27 +2,27 @@ # define MLN_CORE_MACROS_HH -# define oln_point(T) typename T::point -# define oln_dpoint(T) typename T::dpoint -# define oln_psite(T) typename T::psite -# define oln_pset(T) typename T::pset -# define oln_box(T) typename T::box -# define oln_coord(T) typename T::coord - -# define oln_piter(T) typename T::piter -# define oln_fwd_piter(T) typename T::fwd_piter -# define oln_bkd_piter(T) typename T::bkd_piter - -# define oln_qiter(T) typename T::qiter -# define oln_fwd_qiter(T) typename T::fwd_qiter -# define oln_bkd_qiter(T) typename T::bkd_qiter - -# define oln_niter(T) typename T::niter -# define oln_fwd_niter(T) typename T::fwd_niter -# define oln_bkd_niter(T) typename T::bkd_niter - -# define oln_value(T) typename T::value -# define oln_rvalue(T) typename T::rvalue -# define oln_lvalue(T) typename T::lvalue +# define mln_point(T) typename T::point +# define mln_dpoint(T) typename T::dpoint +# define mln_psite(T) typename T::psite +# define mln_pset(T) typename T::pset +# define mln_box(T) typename T::box +# define mln_coord(T) typename T::coord + +# define mln_piter(T) typename T::piter +# define mln_fwd_piter(T) typename T::fwd_piter +# define mln_bkd_piter(T) typename T::bkd_piter + +# define mln_qiter(T) typename T::qiter +# define mln_fwd_qiter(T) typename T::fwd_qiter +# define mln_bkd_qiter(T) typename T::bkd_qiter + +# define mln_niter(T) typename T::niter +# define mln_fwd_niter(T) typename T::fwd_niter +# define mln_bkd_niter(T) typename T::bkd_niter + +# define mln_value(T) typename T::value +# define mln_rvalue(T) typename T::rvalue +# define mln_lvalue(T) typename T::lvalue #endif // ! MLN_CORE_MACROS_HH Index: milena/core/box_piter.hh --- milena/core/box_piter.hh (revision 983) +++ milena/core/box_piter.hh (working copy) @@ -17,8 +17,8 @@ typedef P psite; typedef P point; - typedef oln_coord(P) coord; - typedef oln_dpoint(P) dpoint; + typedef mln_coord(P) coord; + typedef mln_dpoint(P) dpoint; box_fwd_piter_(const box_<P>& b) : b_(b) @@ -89,7 +89,7 @@ typedef P psite; typedef P point; - typedef oln_coord(P) coord; + typedef mln_coord(P) coord; box_bkd_piter_(const box_<P>& b) : b_(b) Index: milena/core/concept/image.hh --- milena/core/concept/image.hh (revision 983) +++ milena/core/concept/image.hh (working copy) @@ -52,13 +52,13 @@ { // provided by internal::image_base_: - typedef oln_pset(E) pset; - typedef oln_point(E) point; - typedef oln_psite(E) psite; - - typedef oln_piter(E) piter; - typedef oln_fwd_piter(E) fwd_piter; - typedef oln_bkd_piter(E) bkd_piter; + typedef mln_pset(E) pset; + typedef mln_point(E) point; + typedef mln_psite(E) psite; + + typedef mln_piter(E) piter; + typedef mln_fwd_piter(E) fwd_piter; + typedef mln_bkd_piter(E) bkd_piter; bool (E::*m1)(const psite& p) const = & E::has; m1 = 0; @@ -67,9 +67,9 @@ // to be provided in concrete image classes: - typedef oln_value(E) value; - typedef oln_rvalue(E) rvalue; - typedef oln_lvalue(E) lvalue; + typedef mln_value(E) value; + typedef mln_rvalue(E) rvalue; + typedef mln_lvalue(E) lvalue; bool (E::*m3)() const = & E::has_data; m3 = 0; Index: milena/core/concept/genpoint.hh --- milena/core/concept/genpoint.hh (revision 983) +++ milena/core/concept/genpoint.hh (working copy) @@ -38,12 +38,12 @@ bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs); template <typename Pl, typename Pr> - oln_dpoint(Pl) + mln_dpoint(Pl) operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs); template <typename P> - oln_point(P) - operator+(const GenPoint<P>& lhs, const oln_dpoint(P)& rhs); + mln_point(P) + operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs); template <typename P> std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>& p); @@ -54,9 +54,9 @@ template <typename E> GenPoint<E>::GenPoint() { - typedef oln_point(E) point; - typedef oln_dpoint(E) dpoint; - typedef oln_coord(E) coord; + typedef mln_point(E) point; + typedef mln_dpoint(E) dpoint; + typedef mln_coord(E) coord; const point* (E::*m1)() const = & E::pointer; m1 = 0; coord (E::*m2)(unsigned i) const = & E::operator[]; @@ -92,12 +92,12 @@ template <typename Pl, typename Pr> - oln_dpoint(Pl) + mln_dpoint(Pl) operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs) { const Pl& lhs_ = force_exact<Pl>(lhs); const Pr& rhs_ = force_exact<Pr>(rhs); - oln_dpoint(Pl) tmp; + mln_dpoint(Pl) tmp; for (unsigned i = 0; i < Pl::dim; ++i) tmp[i] = lhs_[i] - rhs_[i]; return tmp; @@ -105,11 +105,11 @@ template <typename P> - oln_point(P) - operator+(const GenPoint<P>& lhs, const oln_dpoint(P)& rhs) + mln_point(P) + operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs) { const P& lhs_ = force_exact<P>(lhs); - oln_point(P) tmp; + mln_point(P) tmp; for (unsigned i = 0; i < P::dim; ++i) tmp[i] = lhs_[i] + rhs[i]; return tmp; Index: milena/core/concept/piter.hh --- milena/core/concept/piter.hh (revision 983) +++ milena/core/concept/piter.hh (working copy) @@ -31,8 +31,8 @@ template <typename E> Piter<E>::Piter() { - typedef oln_psite(E) psite; - typedef oln_point(E) point; + typedef mln_psite(E) psite; + typedef mln_point(E) point; const point* (E::*m)() const = & E::pointer; m = 0; } Index: milena/core/concept/point_set.hh --- milena/core/concept/point_set.hh (revision 983) +++ milena/core/concept/point_set.hh (working copy) @@ -35,11 +35,11 @@ template <typename E> Point_Set<E>::Point_Set() { - typedef oln_point(E) point; - typedef oln_psite(E) psite; - typedef oln_piter(E) piter; - typedef oln_fwd_piter(E) fwd_piter; - typedef oln_bkd_piter(E) bkd_piter; + typedef mln_point(E) point; + typedef mln_psite(E) psite; + typedef mln_piter(E) piter; + typedef mln_fwd_piter(E) fwd_piter; + typedef mln_bkd_piter(E) bkd_piter; bool (E::*m1)(const psite& p) const = & E::has; m1 = 0; Index: milena/core/concept/window.hh --- milena/core/concept/window.hh (revision 983) +++ milena/core/concept/window.hh (working copy) @@ -30,9 +30,9 @@ template <typename E> Window<E>::Window() { - typedef oln_qiter(E) qiter; - typedef oln_fwd_qiter(E) fwd_qiter; - typedef oln_bkd_qiter(E) bkd_qiter; + typedef mln_qiter(E) qiter; + typedef mln_fwd_qiter(E) fwd_qiter; + typedef mln_bkd_qiter(E) bkd_qiter; bool (E::*m1)() const = & E::is_empty; m1 = 0; Index: milena/core/concept/box.hh --- milena/core/concept/box.hh (revision 983) +++ milena/core/concept/box.hh (working copy) @@ -33,7 +33,7 @@ template <typename E> Box<E>::Box() { - typedef oln_point(E) point; + typedef mln_point(E) point; point (E::*m1)() const = & E::pmin; m1 = 0; point (E::*m2)() const = & E::pmax; Index: milena/core/concept/point.hh --- milena/core/concept/point.hh (revision 983) +++ milena/core/concept/point.hh (working copy) @@ -20,10 +20,10 @@ template <typename P> - P& operator+=(Point<P>& lhs, const oln_dpoint(P)& rhs); + P& operator+=(Point<P>& lhs, const mln_dpoint(P)& rhs); template <typename P> - P& operator-=(Point<P>& lhs, const oln_dpoint(P)& rhs); + P& operator-=(Point<P>& lhs, const mln_dpoint(P)& rhs); @@ -41,7 +41,7 @@ } template <typename P> - P& operator+=(Point<P>& lhs, const oln_dpoint(P)& rhs) + P& operator+=(Point<P>& lhs, const mln_dpoint(P)& rhs) { for (unsigned i = 0; i < P::dim; ++i) exact(lhs)[i] += rhs[i]; @@ -49,7 +49,7 @@ } template <typename P> - P& operator-=(Point<P>& lhs, const oln_dpoint(P)& rhs) + P& operator-=(Point<P>& lhs, const mln_dpoint(P)& rhs) { for (unsigned i = 0; i < P::dim; ++i) exact(lhs)[i] -= rhs[i]; Index: milena/core/concept/dpoint.hh --- milena/core/concept/dpoint.hh (revision 983) +++ milena/core/concept/dpoint.hh (working copy) @@ -42,8 +42,8 @@ template <typename E> Dpoint<E>::Dpoint() { - typedef oln_point(E) point; - typedef oln_coord(E) coord; + typedef mln_point(E) point; + typedef mln_coord(E) coord; enum { dim = E::dim }; coord (E::*m)(unsigned i) const = & E::operator[]; m = 0; Index: milena/core/internal/image_adaptor.hh --- milena/core/internal/image_adaptor.hh (revision 983) +++ milena/core/internal/image_adaptor.hh (working copy) @@ -11,14 +11,14 @@ { template <typename I, typename E> - struct image_adaptor_ : public internal::image_base_< oln_pset(I), E > + struct image_adaptor_ : public internal::image_base_< mln_pset(I), E > { - typedef oln_psite(I) psite; - typedef oln_pset(I) pset; + typedef mln_psite(I) psite; + typedef mln_pset(I) pset; - typedef oln_value(I) value; - typedef oln_rvalue(I) rvalue; - typedef oln_lvalue(I) lvalue; + typedef mln_value(I) value; + typedef mln_rvalue(I) rvalue; + typedef mln_lvalue(I) lvalue; bool has_data() const; @@ -51,21 +51,21 @@ } template <typename I, typename E> - const oln_pset(I)& + const mln_pset(I)& image_adaptor_<I,E>::domain() const { return adaptee_.domain(); } template <typename I, typename E> - oln_rvalue(I) + mln_rvalue(I) image_adaptor_<I,E>::operator()(const psite& p) const { return adaptee_(p); } template <typename I, typename E> - oln_lvalue(I) + mln_lvalue(I) image_adaptor_<I,E>::operator()(const psite& p) { return adaptee_(p); Index: milena/core/internal/image_base.hh --- milena/core/internal/image_base.hh (revision 983) +++ milena/core/internal/image_base.hh (working copy) @@ -14,11 +14,11 @@ struct image_base_ : public Image<E> { typedef S pset; - typedef oln_psite(S) psite; - typedef oln_point(S) point; + typedef mln_psite(S) psite; + typedef mln_point(S) point; - typedef oln_fwd_piter(S) fwd_piter; - typedef oln_bkd_piter(S) bkd_piter; + typedef mln_fwd_piter(S) fwd_piter; + typedef mln_bkd_piter(S) bkd_piter; typedef fwd_piter piter; bool has(const psite& p) const; @@ -47,7 +47,7 @@ } template <typename S, typename E> - const box_<oln_point(S)>& + const box_<mln_point(S)>& image_base_<S,E>::bbox() const { return exact(this)->domain().bbox(); Index: milena/core/safe_image.hh --- milena/core/safe_image.hh (revision 983) +++ milena/core/safe_image.hh (working copy) @@ -15,8 +15,8 @@ safe_image(Image<I>& ima); - oln_rvalue(I) operator()(const oln_psite(I)& p) const; - oln_lvalue(I) operator()(const oln_psite(I)& p); + mln_rvalue(I) operator()(const mln_psite(I)& p) const; + mln_lvalue(I) operator()(const mln_psite(I)& p); }; @@ -36,20 +36,20 @@ } template <typename I> - oln_rvalue(I) - safe_image<I>::operator()(const oln_psite(I)& p) const + mln_rvalue(I) + safe_image<I>::operator()(const mln_psite(I)& p) const { - static oln_value(I) tmp; + static mln_value(I) tmp; if (not this->owns_(p)) return tmp; return this->adaptee_(p); } template <typename I> - oln_lvalue(I) - safe_image<I>::operator()(const oln_psite(I)& p) + mln_lvalue(I) + safe_image<I>::operator()(const mln_psite(I)& p) { - static oln_value(I) tmp; + static mln_value(I) tmp; if (not this->owns_(p)) return tmp; return this->adaptee_(p); Index: milena/mlc/same_point.hh --- milena/mlc/same_point.hh (revision 983) +++ milena/mlc/same_point.hh (working copy) @@ -12,7 +12,7 @@ { template <typename T1, typename T2> - struct same_point : mlc::equal<oln_point(T2), oln_point(T2)> + struct same_point : mlc::equal<mln_point(T2), mln_point(T2)> { }; Index: milena/value/props.hh --- milena/value/props.hh (revision 0) +++ milena/value/props.hh (revision 0) @@ -0,0 +1,47 @@ +#ifndef MLN_VALUE_PROPS_HH +# define MLN_VALUE_PROPS_HH + +# include <limits> + +# define mln_min(T) mln::value::props<T>::min() +# define mln_max(T) mln::value::props<T>::max() + + +namespace mln +{ + + namespace value + { + + template <typename T> + struct props + { + static T min(); + static T max(); + }; + + +# ifndef MLN_INCLUDE_ONLY + + template <> + struct props<unsigned char> + { + static unsigned char min() { return 0; } + static unsigned char max() { return 255; } + }; + + template <> + struct props<int> + { + static int min() { return std::numeric_limits<int>::min(); } + static int max() { return std::numeric_limits<int>::max(); } + }; + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::value + +} // end of namespace mln + + +#endif // ! MLN_VALUE_PROPS_HH
17 years, 5 months
1
0
0
0
r980: Add logger morpher and fix transform morpher.
by Thomas Moulard
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 URL:
https://svn.lrde.epita.fr/svn/oln/trunk/static
ChangeLog: 2007-06-15 Thomas Moulard <thomas.moulard(a)lrde.epita.fr> Add logger morpher and fix transform morpher. * samples/mini-std/cpp2/Makefile: New. * samples/mini-std/cpp2/mini-std.cc: Here. Makefile | 7 ++ mini-std.cc | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 133 insertions(+), 16 deletions(-) Index: trunk/static/samples/mini-std/cpp2/mini-std.cc =================================================================== - --- trunk/static/samples/mini-std/cpp2/mini-std.cc (revision 979) +++ trunk/static/samples/mini-std/cpp2/mini-std.cc (revision 980) @@ -535,35 +535,35 @@ template <typename Exact> struct case_<switch_iterator_kind, Exact, 1> : - - public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t), forwardIterator) > + public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t)::primitiveIterator_t, forwardIterator) > { typedef ForwardContainer<Exact> ret; }; template <typename Exact> struct case_<switch_iterator_kind, Exact, 2> : - - public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t), backwardIterator) > + public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t)::primitiveIterator_t, backwardIterator) > { typedef BiDirContainer<Exact> ret; }; template <typename Exact> struct case_<switch_iterator_kind, Exact, 3> : - - public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t)::primitiveIterator_t, biDirIterator) > // ::primitiveIterator_t + public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t)::primitiveIterator_t, biDirIterator) > { typedef BiDirContainer<Exact> ret; }; template <typename Exact> struct case_<switch_iterator_kind, Exact, 4> : - - public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t), randomAccessibleIterator) > + public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t)::primitiveIterator_t, randomAccessibleIterator) > { typedef RandomAccessibleContainer<Exact> ret; }; template <typename Exact> struct case_<switch_iterator_kind, Exact, 5> : - - public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t), associativeIterator) > + public mlc::where_ < mlc_is_a(stc_find_type(Exact, iter_t)::primitiveIterator_t, associativeIterator) > { typedef AssociativeContainer<Exact> ret; }; @@ -1076,20 +1076,18 @@ return deleg_; } - - delegatee& get_deleg() const + delegatee get_deleg() const { return deleg_; } - - //FIXME current& operator++() { deleg_++; return *exact(this); } - - //FIXME current operator++(int) { current ret = *exact(this); @@ -1097,7 +1095,7 @@ return ret; } protected: - - delegatee& deleg_; + delegatee deleg_; Functor trans_; }; @@ -1159,8 +1157,6 @@ stc_using(value_t); stc_using(iter_t); - - //typedef std::unary_function<value_t&,value_t> transform_t; - - transform_morpher(delegatee& d, Functor trans) : container_morpher_<current>(), deleg_ (d), @@ -1185,9 +1181,9 @@ iter_t impl_end() { - - // iter_t it(deleg_.end(), trans_); - - // it.get_deleg().to_end(); - - return iter_t(deleg_.end(), trans_); + iter_t it(deleg_.end(), trans_); + it.get_deleg().to_end(); + return it; } protected: @@ -1195,6 +1191,85 @@ Functor trans_; }; + // logger morpher +#define LOGGER(name) NAME##_logger_morpher +#define LOGGER_STREAM std::cerr +#define LOGGER_BEGIN(NAME) \ + template <typename Container> \ + struct NAME##_logger_morpher; \ + \ + template <typename Container> \ + struct super_trait_<NAME##_logger_morpher<Container> > \ + { \ + typedef container_morpher_<Container> ret; \ + }; \ + \ + template <typename Container> \ + struct vtypes<NAME##_logger_morpher<Container> > \ + { \ + typedef Container delegatee; \ + }; \ + \ + template <typename Container> \ + struct NAME##_logger_morpher : \ + public container_morpher_<NAME##_logger_morpher<Container> > \ + { \ + typedef NAME##_logger_morpher<Container> current; \ + typedef container_morpher_<current> super; \ + \ + stc_using(delegatee); \ + stc_using(iter_t); \ + \ + NAME##_logger_morpher(delegatee& d) : \ + container_morpher_<current>(), \ + deleg_ (d) \ + { \ + } \ + \ + delegatee& get_deleg() \ + { \ + return deleg_; \ + } \ + \ + delegatee& get_deleg() const \ + { \ + return deleg_; \ + } + +#define LOGMETHOD(MESSAGE, RETURNTYPE, NAME) \ + \ + RETURNTYPE NAME() \ + { \ + LOGGER_STREAM << __FILE__ << ":" << __LINE__ << ":" \ + << MESSAGE << std::endl; \ + return deleg_.NAME(); \ + } + +#define LOGMETHODVOID(MESSAGE, RETURNTYPE, NAME) \ + \ + RETURNTYPE NAME() \ + { \ + LOGGER_STREAM << __FILE__ << ":" << __LINE__ << ":" \ + << MESSAGE << std::endl; \ + deleg_.NAME(); \ + } + +#define LOGMETHODARG(MESSAGE, RETURNTYPE, NAME, ARGTYPE, ARGNAME) \ + \ + RETURNTYPE NAME(ARGTYPE) \ + { \ + LOGGER_STREAM << __FILE__ << ":" << __LINE__ << ":" \ + << MESSAGE << std::endl; \ + return deleg_.NAME(ARGNAME); \ + } + + +#define LOGGER_END() \ + \ + protected: \ + delegatee& deleg_; \ + }; + } // End of namespace mstd. @@ -1224,6 +1299,15 @@ { } +// Create logger class. +namespace mstd +{ + LOGGER_BEGIN(begin) + LOGMETHOD("Begin has been triggered.", iter_t, begin) + LOGMETHOD("End has been triggered.", iter_t, end) + LOGGER_END() +}; + int main() { // List @@ -1295,8 +1379,15 @@ // Dummy<int> a; // test(a); - - // Morphers + // *** Morphers *** typedef mstd::transform_morpher<mstd::list<int>, transform > morpher_t; + typedef mstd::begin_logger_morpher<mstd::list<int> > logger_t; + + typedef mstd::transform_morpher<logger_t, transform > translog_t; + + + // Transform + { morpher_t tm(l, transform()); typedef mstd::transform_morpher_iterator<mstd::list<int>::iter_t, transform> itmorpher_t; @@ -1319,6 +1410,25 @@ TEST(*it); TEST(*im); } - - tm.clear(); TEST(tm.size()); } + + // Logger + { + logger_t lm(l); + + logger_t::iter_t im = lm.begin(); + for (; im != lm.end(); ++im) + TEST(*im); + TEST(*im); + } + + // Transform + Log + { + logger_t lm(l); + translog_t tlm(lm, transform()); + + translog_t::iter_t im = tlm.begin(); + TEST(*im); + } +} Index: trunk/static/samples/mini-std/cpp2/Makefile =================================================================== - --- trunk/static/samples/mini-std/cpp2/Makefile (revision 0) +++ trunk/static/samples/mini-std/cpp2/Makefile (revision 980) @@ -0,0 +1,7 @@ +CPPFLAGS = -I../../../../olena/oln -I../../../../metalic + +.PHONY: all + +all: mini-std + +mini-std: mini-std.cc \ No newline at end of file - -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGcmNd8QvmnUS5oeMRAtrKAKDGo424ympOK/fS7Tsw+WYI9yq6zQCfYER3 E3bqGThYOBu00+Og85t+jqw= =1OpT -----END PGP SIGNATURE-----
17 years, 6 months
1
0
0
0
← Newer
1
2
Older →
Jump to page:
1
2
Results per page:
10
25
50
100
200