* mln/util/site_pair.hh (mln::site_pair): Move class...
(mln::util::site_pair): ...here, into namespace mln::util.
* mln/core/image/line_graph_psite.hh,
* mln/core/site_set/p_complex.hh,
* mln/core/site_set/p_line_graph.hh:
Adjust.
---
milena/ChangeLog | 11 +++
milena/mln/core/image/line_graph_psite.hh | 8 +-
milena/mln/core/site_set/p_complex.hh | 2 +-
milena/mln/core/site_set/p_line_graph.hh | 4 +-
milena/mln/util/site_pair.hh | 135 ++++++++++++++++-------------
5 files changed, 91 insertions(+), 69 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 28c9b28..8aeb1dc 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,16 @@
2008-10-17 Roland Levillain <roland(a)lrde.epita.fr>
+ Move site_pair into namespace mln::util.
+
+ * mln/util/site_pair.hh (mln::site_pair): Move class...
+ (mln::util::site_pair): ...here, into namespace mln::util.
+ * mln/core/image/line_graph_psite.hh,
+ * mln/core/site_set/p_complex.hh,
+ * mln/core/site_set/p_line_graph.hh:
+ Adjust.
+
+2008-10-17 Roland Levillain <roland(a)lrde.epita.fr>
+
Factor neighborhoods of complex images.
* mln/core/image/complex_neighborhoods.hh: New.
diff --git a/milena/mln/core/image/line_graph_psite.hh
b/milena/mln/core/image/line_graph_psite.hh
index df79d88..4b2e0aa 100644
--- a/milena/mln/core/image/line_graph_psite.hh
+++ b/milena/mln/core/image/line_graph_psite.hh
@@ -56,7 +56,7 @@ namespace mln
/// \arg \p P The type of the site.
template <typename P>
class line_graph_psite
- : public internal::pseudo_site_base_< const site_pair<P>&,
+ : public internal::pseudo_site_base_< const util::site_pair<P>&,
line_graph_psite<P> >
{
typedef line_graph_psite<P> self_;
@@ -95,7 +95,7 @@ namespace mln
/// Proxy manipulators.
/// \{
/// Return the site corresponding to this psite.
- const site_pair<P>& subj_();
+ const util::site_pair<P>& subj_();
/// \}
/// Edge id manipulators.
@@ -131,7 +131,7 @@ namespace mln
/// Update the site corresponding to this psite.
void update_();
// The site corresponding to this psite.
- site_pair<P> p_;
+ util::site_pair<P> p_;
/// \}
private:
@@ -256,7 +256,7 @@ namespace mln
// FIXME: Write or extend a test to exercise this method.
template <typename P>
inline
- const site_pair<P>&
+ const util::site_pair<P>&
line_graph_psite<P>::subj_()
{
return p_;
diff --git a/milena/mln/core/site_set/p_complex.hh
b/milena/mln/core/site_set/p_complex.hh
index 8f79961..7b5e815 100644
--- a/milena/mln/core/site_set/p_complex.hh
+++ b/milena/mln/core/site_set/p_complex.hh
@@ -94,7 +94,7 @@ namespace mln
dimensions, e.g.
mln_type_list(point2d,
- mln_type_list(site_pair<point2d>,
+ mln_type_list(util::site_pair<point2d>,
mln_type_list(site_set<point2d>, // or site_triplet<point2d>
mln_empty_list)))
diff --git a/milena/mln/core/site_set/p_line_graph.hh
b/milena/mln/core/site_set/p_line_graph.hh
index d86cb9d..b9a3ed0 100644
--- a/milena/mln/core/site_set/p_line_graph.hh
+++ b/milena/mln/core/site_set/p_line_graph.hh
@@ -68,10 +68,10 @@ namespace mln
template<typename P>
struct p_line_graph
- : public internal::site_set_base_< site_pair<P>, p_line_graph<P> >
+ : public internal::site_set_base_< util::site_pair<P>, p_line_graph<P>
>
{
typedef p_line_graph<P> self_;
- typedef internal::site_set_base_< site_pair<P>, self_ > super_;
+ typedef internal::site_set_base_< util::site_pair<P>, self_ > super_;
typedef util::graph<P> graph;
diff --git a/milena/mln/util/site_pair.hh b/milena/mln/util/site_pair.hh
index efde98d..b9a5611 100644
--- a/milena/mln/util/site_pair.hh
+++ b/milena/mln/util/site_pair.hh
@@ -35,83 +35,94 @@
namespace mln
{
- /* FIXME: The class mln::internal::image_base requires its site
- types to have a `coord' typedef, but util::ord_pair has none.
- Hence this small workaround. Use ord_pair directly as soon as
- image_base is refurbished. */
- template <typename P>
- struct site_pair : public mln::Object< site_pair<P> >
- {
- site_pair();
- site_pair(const P& first, const P& second);
- typedef mln_coord(P) coord;
- util::ord_pair<P> pair_;
- };
- /* FIXME: The proxy mechanism requires operator== and operator<= for
- line_graph_psite to compile (line_graph_psite aggregates a
- site_pair); why? It seems its static assertions do not check the
- right guy(s). IMHO (Roland's), it should look for
- line_graph_psite's operators, not site_pair's. */
- template <typename P>
- bool operator==(const site_pair<P>& lhs, const site_pair<P>& rhs);
+ namespace util
+ {
- template <typename P>
- bool operator< (const site_pair<P>& lhs, const site_pair<P>&
rhs);
+ /* FIXME: The class mln::internal::image_base requires its site
+ types to have a `coord' typedef, but util::ord_pair has none.
+ Hence this small workaround. Use ord_pair directly as soon as
+ image_base is refurbished. */
+ template <typename P>
+ struct site_pair : public mln::Object< site_pair<P> >
+ {
+ /* FIXME: We should not need to define this typedef
+ (see. mln::internal::image_base's site `coord' typedef). */
+ typedef mln_coord(P) coord;
- template <typename P>
- bool operator< (const site_pair<P>& lhs, const site_pair<P>&
rhs);
+ site_pair();
+ site_pair(const P& first, const P& second);
+ util::ord_pair<P> pair_;
+ };
-# ifndef MLN_INCLUDE_ONLY
+ /* FIXME: The proxy mechanism requires operator== and operator<= for
+ line_graph_psite to compile (note: line_graph_psite aggregates a
+ site_pair); why? It seems its static assertions do not check the
+ right guy(s). IMHO (Roland's), it should look for
+ line_graph_psite's operators, not site_pair's. */
+ template <typename P>
+ bool operator==(const site_pair<P>& lhs, const site_pair<P>&
rhs);
- /*---------------.
- | Construction. |
- `---------------*/
+ template <typename P>
+ bool operator< (const site_pair<P>& lhs, const site_pair<P>&
rhs);
- template <typename P>
- site_pair<P>::site_pair()
- : pair_(P(), P())
- {
- }
+ template <typename P>
+ bool operator< (const site_pair<P>& lhs, const site_pair<P>&
rhs);
- template <typename P>
- site_pair<P>::site_pair(const P& first, const P& second)
- : pair_(first, second)
- {
- }
- /*-------------.
- | Comparison. |
- `-------------*/
- template <typename P>
- inline
- bool
- operator==(const site_pair<P>& lhs, const site_pair<P>& rhs)
- {
- return lhs.pair_ == rhs.pair_;
- }
+# ifndef MLN_INCLUDE_ONLY
- template <typename P>
- inline
- bool
- operator< (const site_pair<P>& lhs, const site_pair<P>& rhs)
- {
- return lhs.pair_ < rhs.pair_;
- }
-
- template <typename P>
- inline
- bool
- operator<=(const site_pair<P>& lhs, const site_pair<P>& rhs)
- {
- return lhs.pair_ <= rhs.pair_;
- }
+ /*---------------.
+ | Construction. |
+ `---------------*/
+
+ template <typename P>
+ site_pair<P>::site_pair()
+ : pair_(P(), P())
+ {
+ }
+
+ template <typename P>
+ site_pair<P>::site_pair(const P& first, const P& second)
+ : pair_(first, second)
+ {
+ }
+
+ /*-------------.
+ | Comparison. |
+ `-------------*/
+
+ template <typename P>
+ inline
+ bool
+ operator==(const site_pair<P>& lhs, const site_pair<P>& rhs)
+ {
+ return lhs.pair_ == rhs.pair_;
+ }
+
+ template <typename P>
+ inline
+ bool
+ operator< (const site_pair<P>& lhs, const site_pair<P>& rhs)
+ {
+ return lhs.pair_ < rhs.pair_;
+ }
+
+ template <typename P>
+ inline
+ bool
+ operator<=(const site_pair<P>& lhs, const site_pair<P>& rhs)
+ {
+ return lhs.pair_ <= rhs.pair_;
+ }
# endif // ! MLN_INCLUDE_ONLY
+ } // end of mln::util
+
} // end of mln
--
1.6.0.1