* scribo/primitive/link/internal/find_link.hh,
* scribo/primitive/link/internal/link_functor_base.hh,
* scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here.
---
scribo/ChangeLog | 8 +++++
scribo/scribo/primitive/link/internal/find_link.hh | 5 ++-
.../primitive/link/internal/link_functor_base.hh | 31 +++++++++++++-------
.../link/internal/link_single_dmax_ratio_base.hh | 7 +++-
4 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index bd7b036..fc78930 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,13 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Spread anchor value to more methods in link functors.
+
+ * scribo/primitive/link/internal/find_link.hh,
+ * scribo/primitive/link/internal/link_functor_base.hh,
+ * scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Introduce a logger class.
* scribo/debug/logger.hh: New.
diff --git a/scribo/scribo/primitive/link/internal/find_link.hh
b/scribo/scribo/primitive/link/internal/find_link.hh
index dd0b308..7220b0c 100644
--- a/scribo/scribo/primitive/link/internal/find_link.hh
+++ b/scribo/scribo/primitive/link/internal/find_link.hh
@@ -87,10 +87,11 @@ namespace scribo
while (functor.components().labeled_image().domain().has(p)
&& ! functor.is_potential_link(current_object,
start_point, p)
- && functor.verify_link_criterion(current_object, start_point, p))
+ && functor.verify_link_criterion(current_object, start_point,
+ p, anchor))
functor.compute_next_site(p); // <-- compute_next_site
- if (functor.valid_link(current_object, start_point, p)) // <-- valid_link
+ if (functor.valid_link(current_object, start_point, p, anchor)) // <-- valid_link
functor.validate_link(current_object, start_point, p, anchor); // <--
validate_link
else
functor.invalidate_link(current_object, start_point, p, anchor); // <--
invalidate_link
diff --git a/scribo/scribo/primitive/link/internal/link_functor_base.hh
b/scribo/scribo/primitive/link/internal/link_functor_base.hh
index ad3d71b..d214c91 100644
--- a/scribo/scribo/primitive/link/internal/link_functor_base.hh
+++ b/scribo/scribo/primitive/link/internal/link_functor_base.hh
@@ -88,13 +88,15 @@ namespace scribo
bool verify_link_criterion(unsigned current_object,
- const P& start_point, const P& p) const;
+ const P& start_point, const P& p,
+ anchor::Type anchor) const;
bool is_potential_link(unsigned current_object,
const P& start_point, const P& p) const;
bool valid_link(unsigned current_object,
- const P& start_point, const P& p);
+ const P& start_point, const P& p,
+ anchor::Type anchor);
@@ -147,10 +149,12 @@ namespace scribo
const P& start_point, const P& p) const;
bool verify_link_criterion_(unsigned current_object,
- const P& start_point, const P& p) const;
+ const P& start_point, const P& p,
+ anchor::Type anchor) const;
bool valid_link_(unsigned current_object,
- const P& start_point, const P& p);
+ const P& start_point, const P& p,
+ anchor::Type anchor);
void validate_link_(unsigned current_object,
const P& start_point, const P& p,
@@ -263,14 +267,15 @@ namespace scribo
bool
link_functor_base<L,E>::verify_link_criterion(unsigned current_object,
const P& start_point,
- const P& p) const
+ const P& p,
+ anchor::Type anchor) const
{
return
// Do not link with separators...
! this->components_.separators()(p)
// ... and perform custom checks.
&& exact(this)->verify_link_criterion_(current_object,
- start_point, p);
+ start_point, p, anchor);
}
template <typename L, typename E>
@@ -278,10 +283,11 @@ namespace scribo
bool
link_functor_base<L,E>::valid_link(unsigned current_object,
const P& start_point,
- const P& p)
+ const P& p,
+ anchor::Type anchor)
{
return this->labeled_image_.domain().has(p)
- && exact(this)->valid_link_(current_object, start_point, p);
+ && exact(this)->valid_link_(current_object, start_point, p, anchor);
}
@@ -428,11 +434,13 @@ namespace scribo
bool
link_functor_base<L,E>::verify_link_criterion_(unsigned current_object,
const P& start_point,
- const P& p) const
+ const P& p,
+ anchor::Type anchor) const
{
(void) current_object;
(void) start_point;
(void) p;
+ (void) anchor;
// No-Op
return true;
}
@@ -443,10 +451,11 @@ namespace scribo
bool
link_functor_base<L,E>::valid_link_(unsigned current_object,
const P& start_point,
- const P& p)
+ const P& p,
+ anchor::Type anchor)
{
return is_potential_link(current_object, start_point, p)
- && verify_link_criterion(current_object, start_point, p);
+ && verify_link_criterion(current_object, start_point, p, anchor);
}
diff --git a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh
b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh
index d3aba42..3abe663 100644
--- a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh
+++ b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh
@@ -86,7 +86,8 @@ namespace scribo
bool verify_link_criterion_(unsigned current_object,
- const P& start_point, const P& p) const;
+ const P& start_point, const P& p,
+ anchor::Type anchor) const;
mln_site(L) start_point_(unsigned current_object,
anchor::Type anchor);
@@ -123,9 +124,11 @@ namespace scribo
link_single_dmax_ratio_base<L, F, E>::verify_link_criterion_(
unsigned current_object,
const P& start_point,
- const P& p) const
+ const P& p,
+ anchor::Type anchor) const
{
(void) current_object;
+ (void) anchor;
float dist = math::abs(p[direction_] - start_point[direction_]);
return dist <= dmax_; // Not too far
--
1.5.6.5