27 #ifndef SCRIBO_PRIMITIVE_INTERNAL_FIND_SEVERAL_LINKS_HH
28 # define SCRIBO_PRIMITIVE_INTERNAL_FIND_SEVERAL_LINKS_HH
37 # include <mln/core/concept/image.hh>
39 # include <mln/math/abs.hh>
41 # include <mln/util/array.hh>
42 # include <mln/util/couple.hh>
44 # include <scribo/core/concept/link_functor.hh>
45 # include <scribo/core/tag/anchor.hh>
46 # include <scribo/core/object_links.hh>
73 mln_site(scribo_support_(F))> >
74 find_several_links(Link_Functor<F>& functor,
75 unsigned current_object);
78 # ifndef MLN_INCLUDE_ONLY
83 mln_site(scribo_support_(F))> >
84 find_several_links(Link_Functor<F>& functor_,
85 unsigned current_object)
87 F& functor =
exact(functor_);
89 typedef mln_site(scribo_support_(F)) P;
90 typedef mln::util::couple<anchor::Type, P> link_t;
92 functor.initialize_link(current_object);
94 for_all_anchors(a, functor.anchors())
97 anchor::Type anchor = functor.anchors()[a];
99 mln_site(scribo_support_(F))
100 start_point = functor.start_point(current_object, anchor),
103 mln_postcondition(p == start_point);
105 while (functor.labeled_image().domain().has(p)
106 && ! functor.is_potential_link(current_object,
108 && functor.verify_link_criterion(current_object,
109 start_point, p, anchor))
110 functor.compute_next_site(p);
112 if (functor.valid_link(current_object, start_point, p, anchor))
113 functor.validate_link(current_object, start_point, p, anchor);
115 functor.invalidate_link(current_object, start_point, p, anchor);
119 link_t l = functor.finalize_link(current_object);
121 bool b = (functor.link(current_object) != current_object);
122 return mln::make::couple(b, l);
125 # endif // MLN_INCLUDE_ONLY
137 #endif // ! SCRIBO_PRIMITIVE_INTERNAL_FIND_SEVERAL_LINKS_HH