* mln/core/internal/site_set_base.hh: Do it.
---
milena/ChangeLog | 6 ++++++
milena/mln/core/internal/site_set_base.hh | 6 +++++-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index a98db9a..18f27e1 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,11 @@
2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+ Update the Doxygen documentation of site set internal classes.
+
+ * mln/core/internal/site_set_base.hh: Do it.
+
+2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+
Update line graph image.
* mln/core/image/line_graph_image.hh
diff --git a/milena/mln/core/internal/site_set_base.hh b/milena/mln/core/internal/site_set_base.hh
index 42c0199..de2eaeb 100644
--- a/milena/mln/core/internal/site_set_base.hh
+++ b/milena/mln/core/internal/site_set_base.hh
@@ -46,7 +46,11 @@ namespace mln
/*! \internal A base class for site set classes.
- * \p P is a psite type.
+ *
+ * \arg \p P The psite type of what is ``contained'' in the site
+ * set, not the psite of the site set (which is
+ * different, and defined by the site set itself).
+ * \arg \p E The exact type of the site set.
*/
template <typename P, typename E>
struct site_set_base_ : public Site_Set<E>
--
1.6.0.1
* mln/core/image/line_graph_elt_neighborhood.hh,
* mln/core/image/line_graph_elt_window.hh
(mln::line_graph_elt_neighborhood<P>::site)
(mln::line_graph_elt_window<P>::site):
Deduce these typedefs from their respective psites.
(mln::line_graph_elt_neighborhood<P>::compute_sites_)
(mln::line_graph_elt_window<P>::compute_sites_):
Adjust to the new psite interface.
s/pref()/center()/.
s/plg()/center().site_set()/.
---
milena/ChangeLog | 15 +++++++++++++++
.../mln/core/image/line_graph_elt_neighborhood.hh | 19 ++++++++++---------
milena/mln/core/image/line_graph_elt_window.hh | 16 +++++++++-------
3 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 763076d..f41074f 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,20 @@
2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+ Update line graph elementary neighborhood and window.
+
+ * mln/core/image/line_graph_elt_neighborhood.hh,
+ * mln/core/image/line_graph_elt_window.hh
+ (mln::line_graph_elt_neighborhood<P>::site)
+ (mln::line_graph_elt_window<P>::site):
+ Deduce these typedefs from their respective psites.
+ (mln::line_graph_elt_neighborhood<P>::compute_sites_)
+ (mln::line_graph_elt_window<P>::compute_sites_):
+ Adjust to the new psite interface.
+ s/pref()/center()/.
+ s/plg()/center().site_set()/.
+
+2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+
Add a site_set accessor on site_relative_iterator_base.
* mln/core/internal/site_relative_iterator_base.hh
diff --git a/milena/mln/core/image/line_graph_elt_neighborhood.hh b/milena/mln/core/image/line_graph_elt_neighborhood.hh
index 80dc0f3..38b7d8f 100644
--- a/milena/mln/core/image/line_graph_elt_neighborhood.hh
+++ b/milena/mln/core/image/line_graph_elt_neighborhood.hh
@@ -38,7 +38,9 @@
- mln::graph_elt_window
- mln::graph_elt_neighborhood
- mln::line_graph_elt_window
- - mln::line_graph_elt_neighborhood. */
+ - mln::line_graph_elt_neighborhood.
+
+ See https://trac.lrde.org/olena/ticket/139. */
/* FIXME: Due to the poor interface of mln::p_line_graph and
mln::util::graph, we show to much implementation details here.
@@ -70,10 +72,10 @@ namespace mln
public:
/// Associated types.
/// \{
- /// The type of site corresponding to the neighborhood.
- typedef P site;
/// The type of psite corresponding to the neighborhood.
typedef line_graph_psite<P> psite;
+ /// The type of site corresponding to the neighborhood.
+ typedef mln_site(psite) site;
// The type of the set of neighbors (edge ids adjacent to the
// reference psite).
typedef std::set<util::edge_id> sites_t;
@@ -98,7 +100,6 @@ namespace mln
window to_window() const;
/// \}
-
/// Services for iterators.
/// \{
/// Compute the set of sites for this neighborhood around \a piter.
@@ -126,15 +127,15 @@ namespace mln
line_graph_elt_neighborhood<P>::compute_sites_(Site_Iterator<Piter>& piter_) const
{
Piter& piter = exact(piter_);
- util::edge_id ref_edge_id = piter.p_ref().id();
+ util::edge_id ref_edge_id = piter.center().edge_id();
sites_t& sites = piter.sites();
sites.clear();
/* FIXME: Move this computation out of the neighborhood. In fact,
this should be a service of the graph, also proposed by the
p_line_graph. */
// Ajacent edges connected through vertex 1.
- util::vertex_id id1 = piter.p_ref().first_id();
- const util::vertex<P>& vertex1 = piter.plg().gr_->vertex(id1);
+ util::vertex_id id1 = piter.center().first_id();
+ const util::vertex<P>& vertex1 = piter.center().site_set().gr_->vertex(id1);
for (std::vector<util::edge_id>::const_iterator e =
vertex1.edges.begin(); e != vertex1.edges.end(); ++e)
// We explicitly enforce that the reference piter edge id is
@@ -142,8 +143,8 @@ namespace mln
if (*e != ref_edge_id)
sites.insert(*e);
// Ajacent edges connected through vertex 2.
- util::vertex_id id2 = piter.p_ref().second_id();
- const util::vertex<P>& vertex2 = piter.plg().gr_->vertex(id2);
+ util::vertex_id id2 = piter.center().second_id();
+ const util::vertex<P>& vertex2 = piter.center().site_set().gr_->vertex(id2);
for (std::vector<util::edge_id>::const_iterator e =
vertex2.edges.begin(); e != vertex2.edges.end(); ++e)
// Same remark as above.
diff --git a/milena/mln/core/image/line_graph_elt_window.hh b/milena/mln/core/image/line_graph_elt_window.hh
index 04bc542..8649372 100644
--- a/milena/mln/core/image/line_graph_elt_window.hh
+++ b/milena/mln/core/image/line_graph_elt_window.hh
@@ -38,7 +38,9 @@
- mln::graph_elt_window
- mln::graph_elt_neighborhood
- mln::line_graph_elt_window
- - mln::line_graph_elt_neighborhood. */
+ - mln::line_graph_elt_neighborhood.
+
+ See https://trac.lrde.org/olena/ticket/139. */
/* FIXME: Due to the poor interface of mln::p_line_graph and
mln::util::graph, we show to much implementation details here.
@@ -65,10 +67,10 @@ namespace mln
public:
/// Associated types.
/// \{
- /// The type of site corresponding to the window.
- typedef P site;
/// The type of psite corresponding to the window.
typedef line_graph_psite<P> psite;
+ /// The type of site corresponding to the window.
+ typedef mln_site(psite) site;
// The type of the set of window sites (edge ids adjacent to the
// reference psite).
typedef std::set<util::edge_id> sites_t;
@@ -142,14 +144,14 @@ namespace mln
id) itself into SITES, since it is part of the set of edges
adjacent to VERTEX1 and VERTEX2, and will therefore be
automatically added. */
- util::vertex_id id1 = piter.p_ref().first_id();
- const util::vertex<P>& vertex1 = piter.plg().gr_->vertex(id1);
+ util::vertex_id id1 = piter.center().first_id();
+ const util::vertex<P>& vertex1 = piter.center().site_set().gr_->vertex(id1);
for (std::vector<util::edge_id>::const_iterator e =
vertex1.edges.begin(); e != vertex1.edges.end(); ++e)
sites.insert(*e);
// Ajacent edges connected through vertex 2.
- util::vertex_id id2 = piter.p_ref().second_id();
- const util::vertex<P>& vertex2 = piter.plg().gr_->vertex(id2);
+ util::vertex_id id2 = piter.center().second_id();
+ const util::vertex<P>& vertex2 = piter.center().site_set().gr_->vertex(id2);
for (std::vector<util::edge_id>::const_iterator e =
vertex2.edges.begin(); e != vertex2.edges.end(); ++e)
sites.insert(*e);
--
1.6.0.1
* mln/core/internal/site_relative_iterator_base.hh
(mln::internal::site_relative_iterator_base<S, E>::site_set):
New method.
---
milena/ChangeLog | 8 ++++++++
.../core/internal/site_relative_iterator_base.hh | 15 ++++++++++++++-
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 75826ef..763076d 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,13 @@
2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+ Add a site_set accessor on site_relative_iterator_base.
+
+ * mln/core/internal/site_relative_iterator_base.hh
+ (mln::internal::site_relative_iterator_base<S, E>::site_set):
+ New method.
+
+2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+
Update line graph psite set iterators.
* mln/core/site_set/p_line_graph_piter.hh
diff --git a/milena/mln/core/internal/site_relative_iterator_base.hh b/milena/mln/core/internal/site_relative_iterator_base.hh
index ea30c22..f9b582f 100644
--- a/milena/mln/core/internal/site_relative_iterator_base.hh
+++ b/milena/mln/core/internal/site_relative_iterator_base.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -75,6 +75,10 @@ namespace mln
/// Go to the next point.
void next_();
+ /// Give the site set (neighborhood or window) that this
+ /// iterator browses.
+ const S& site_set() const;
+
/// The psite around which this iterator moves.
const mln_psite(S)& center() const;
@@ -172,6 +176,15 @@ namespace mln
template <typename S, typename E>
inline
+ const S&
+ site_relative_iterator_base<S, E>::site_set() const
+ {
+ mln_precondition(this->s_ != 0);
+ return *this->s_;
+ }
+
+ template <typename S, typename E>
+ inline
const mln_psite(S)&
site_relative_iterator_base<S,E>::subj_()
{
--
1.6.0.1
* mln/util/site_pair.hh: New.
---
milena/ChangeLog | 6 +++
milena/mln/util/site_pair.hh | 100 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 106 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/util/site_pair.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 2a8833e..7d3f79a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,11 @@
2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+ Create an util::ordpair_-based container usable as a site.
+
+ * mln/util/site_pair.hh: New.
+
+2008-09-17 Roland Levillain <roland(a)lrde.epita.fr>
+
Update util::ordpair_.
* mln/util/ordpair.hh
diff --git a/milena/mln/util/site_pair.hh b/milena/mln/util/site_pair.hh
new file mode 100644
index 0000000..76ab3ab
--- /dev/null
+++ b/milena/mln/util/site_pair.hh
@@ -0,0 +1,100 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_UTIL_SITE_PAIR_HH
+# define MLN_UTIL_SITE_PAIR_HH
+
+# include <mln/util/ordpair.hh>
+
+/// \file mln/util/site_pair.hh
+/// \brief Definition of a site pair type.
+
+namespace mln
+{
+ /* FIXME: The class mln::internal::image_base requires its site
+ types to have a `coord' typedef, but util::ordpair_ has none.
+ Hence this small workaround. Remove 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::ordpair_<P> pair_;
+ };
+
+ /* FIXME: The proxy mechanism requires these operators; why? It
+ seems its static assertions do not check the right guy. 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);
+
+ template <typename P>
+ bool operator< (const site_pair<P>& lhs, const site_pair<P>& rhs);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ 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)
+ {
+ }
+
+ template <typename P>
+ inline
+ bool
+ operator==(const site_pair<P>& lhs, const site_pair<P>& rhs)
+ {
+ abort();
+ return lhs.pair_ == rhs.pair_;
+ }
+
+ template <typename P>
+ inline
+ bool
+ operator< (const site_pair<P>& lhs, const site_pair<P>& rhs)
+ {
+ abort();
+ return lhs.pair_ < rhs.pair_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of mln
+
+
+#endif // ! MLN_UTIL_SITE_PAIR_HH
--
1.6.0.1