last-svn-commit-831-g0012ddf Update dmax functors interface.

* scribo/primitive/link/internal/dmax_default.hh, * scribo/primitive/link/internal/dmax_width_and_height.hh, * scribo/primitive/link/internal/dmax_width_only.hh: Rename operator() as compute_(). * scribo/primitive/link/internal/dmax_functor_base.hh: Make use of compute_(). * scribo/primitive/link/internal/link_functor_base.hh: Add a fixme. --- scribo/ChangeLog | 13 +++++++++++++ .../scribo/primitive/link/internal/dmax_default.hh | 16 ++++++++++++++-- .../primitive/link/internal/dmax_functor_base.hh | 13 +++++-------- .../link/internal/dmax_width_and_height.hh | 11 ++++++----- .../primitive/link/internal/dmax_width_only.hh | 7 ++++--- .../primitive/link/internal/link_functor_base.hh | 7 +++++-- 6 files changed, 47 insertions(+), 20 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index d388268..8acfc4e 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,18 @@ 2011-04-05 Guillaume Lazzara <z@lrde.epita.fr> + Update dmax functors interface. + + * scribo/primitive/link/internal/dmax_default.hh, + * scribo/primitive/link/internal/dmax_width_and_height.hh, + * scribo/primitive/link/internal/dmax_width_only.hh: Rename + operator() as compute_(). + + * scribo/primitive/link/internal/dmax_functor_base.hh: Make use of compute_(). + + * scribo/primitive/link/internal/link_functor_base.hh: Add a fixme. + +2011-04-05 Guillaume Lazzara <z@lrde.epita.fr> + Various fixes in Scribo. * scribo/core/component_set.hh: Update FIXMEs. diff --git a/scribo/scribo/primitive/link/internal/dmax_default.hh b/scribo/scribo/primitive/link/internal/dmax_default.hh index b4106a9..8a86f7e 100644 --- a/scribo/scribo/primitive/link/internal/dmax_default.hh +++ b/scribo/scribo/primitive/link/internal/dmax_default.hh @@ -52,7 +52,8 @@ namespace scribo typedef dmax_functor_base<dmax_default> super_; public: - dmax_default(const float& dmax_factor); + dmax_default(float dmax_factor); + float compute_(const box2d& b) const; protected: using super_::dmax_factor_; @@ -63,12 +64,23 @@ namespace scribo inline - dmax_default::dmax_default(const float& dmax_factor) + dmax_default::dmax_default(float dmax_factor) : super_(dmax_factor) { } + inline + float + dmax_default::compute_(const box2d& b) const + { + float + w = b.width(), + h = b.height(); + + return (w / 2.0f) + (dmax_factor_ * h);//math::max(w, h)); + } + # endif // ! MLN_INCLUDE_ONLY diff --git a/scribo/scribo/primitive/link/internal/dmax_functor_base.hh b/scribo/scribo/primitive/link/internal/dmax_functor_base.hh index 334cc4d..21ac818 100644 --- a/scribo/scribo/primitive/link/internal/dmax_functor_base.hh +++ b/scribo/scribo/primitive/link/internal/dmax_functor_base.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -57,7 +58,7 @@ namespace scribo { public: - dmax_functor_base(const float& dmax_factor); + dmax_functor_base(float dmax_factor); float operator()(const box2d& b) const; protected: @@ -69,7 +70,7 @@ namespace scribo template <typename E> - dmax_functor_base<E>::dmax_functor_base(const float& dmax_factor) + dmax_functor_base<E>::dmax_functor_base(float dmax_factor) : dmax_factor_(dmax_factor) { } @@ -79,11 +80,7 @@ namespace scribo float dmax_functor_base<E>::operator()(const box2d& b) const { - float - w = b.width(), - h = b.height(); - - return (w / 2.0f) + (dmax_factor_ * h);//math::max(w, h)); + return exact(this)->compute_(b); } diff --git a/scribo/scribo/primitive/link/internal/dmax_width_and_height.hh b/scribo/scribo/primitive/link/internal/dmax_width_and_height.hh index 4c1d561..fa68836 100644 --- a/scribo/scribo/primitive/link/internal/dmax_width_and_height.hh +++ b/scribo/scribo/primitive/link/internal/dmax_width_and_height.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -55,8 +56,8 @@ namespace scribo public: - dmax_width_and_height(const float& dmax_factor); - float operator()(const box2d&) const; + dmax_width_and_height(float dmax_factor); + float compute_(const box2d&) const; protected: using super_::dmax_factor_; @@ -67,7 +68,7 @@ namespace scribo inline - dmax_width_and_height::dmax_width_and_height(const float& dmax_factor) + dmax_width_and_height::dmax_width_and_height(float dmax_factor) : super_(dmax_factor) { } @@ -75,7 +76,7 @@ namespace scribo inline float - dmax_width_and_height::operator()(const box2d& b) const + dmax_width_and_height::compute_(const box2d& b) const { float w = b.width(), diff --git a/scribo/scribo/primitive/link/internal/dmax_width_only.hh b/scribo/scribo/primitive/link/internal/dmax_width_only.hh index 1d882ba..03658bf 100644 --- a/scribo/scribo/primitive/link/internal/dmax_width_only.hh +++ b/scribo/scribo/primitive/link/internal/dmax_width_only.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -56,7 +57,7 @@ namespace scribo public: dmax_width_only(); - float operator()(const box2d&) const; + float compute_(const box2d&) const; protected: using super_::dmax_factor_; @@ -75,7 +76,7 @@ namespace scribo inline float - dmax_width_only::operator()(const box2d& b) const + dmax_width_only::compute_(const box2d& b) const { float w = b.width(); return (w / 2.0f) + (dmax_factor_ * w); diff --git a/scribo/scribo/primitive/link/internal/link_functor_base.hh b/scribo/scribo/primitive/link/internal/link_functor_base.hh index 5b4fefa..11066c5 100644 --- a/scribo/scribo/primitive/link/internal/link_functor_base.hh +++ b/scribo/scribo/primitive/link/internal/link_functor_base.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -30,6 +30,9 @@ /// \file /// /// Base class for link functors. +/// +/// \fixme type used for 'current_object' argument should be of type +/// mln_value(L) # include <mln/core/concept/image.hh> -- 1.5.6.5
participants (1)
-
Guillaume Lazzara