https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix validity checks on iterators on graph neighborhoods and windows.
* mln/core/graph_psite.hh
(mln::graph_psite<P>::is_valid_): Set it public.
Rename as...
(mln::graph_psite<P>::is_valid): ...this.
Adjust callers.
* mln/core/graph_neighborhood_piter.hh
(mln::graph_neighborhood_fwd_piter<P>::is_valid):
(mln::graph_neighborhood_bkd_piter<P>::is_valid):
* mln/core/graph_window_piter.hh
(mln::graph_window_fwd_piter<P>::is_valid):
(mln::graph_window_bkd_piter<P>::is_valid):
Use mln::graph_psite<P>::is_valid.
* mln/core/line_graph_psite.hh
(mln::line_graph_psite<P>::is_valid_): Set it public.
Rename as...
(mln::line_graph_psite<P>::is_valid): ...this.
Adjust callers.
* mln/core/line_graph_neighborhood_piter.hh
(mln::line_graph_neighborhood_fwd_piter<P>::is_valid):
(mln::line_graph_neighborhood_bkd_piter<P>::is_valid):
* mln/core/line_graph_window_piter.hh
(mln::line_graph_window_fwd_piter<P>::is_valid):
(mln::line_graph_window_bkd_piter<P>::is_valid):
Use mln::line_graph_psite<P>::is_valid.
graph_neighborhood_piter.hh | 4 ++--
graph_psite.hh | 7 +++----
graph_window_piter.hh | 4 ++--
line_graph_neighborhood_piter.hh | 4 ++--
line_graph_psite.hh | 15 +++++++--------
line_graph_window_piter.hh | 4 ++--
6 files changed, 18 insertions(+), 20 deletions(-)
Index: mln/core/graph_psite.hh
--- mln/core/graph_psite.hh (revision 1802)
+++ mln/core/graph_psite.hh (working copy)
@@ -76,9 +76,8 @@
/// Return the node id of this point site.
util::node_id id() const;
- private:
/// Is this psite valid?
- bool is_valid_() const;
+ bool is_valid() const;
private:
/// The p_graph this point site belongs to.
@@ -137,7 +136,7 @@
template<typename P>
inline
bool
- graph_psite<P>::is_valid_() const
+ graph_psite<P>::is_valid() const
{
return pg_ && id_ < pg_->gr_->nnodes();
}
@@ -163,7 +162,7 @@
mln_coord(P)
graph_psite<P>::operator[](unsigned i) const
{
- mln_assertion(is_valid_());
+ mln_assertion(is_valid());
return to_point()[i];
}
Index: mln/core/graph_neighborhood_piter.hh
--- mln/core/graph_neighborhood_piter.hh (revision 1802)
+++ mln/core/graph_neighborhood_piter.hh (working copy)
@@ -227,7 +227,7 @@
// FIXME: We depend too much on the implementation of util::graph
// here. The util::graph should provide the service to abstract
// these manipulations.
- return id_ < p_ref_.pg().gr_->nnodes();
+ return p_ref_.is_valid() && id_ < p_ref_.pg().gr_->nnodes();
}
template <typename P>
@@ -352,7 +352,7 @@
// FIXME: We depend too much on the implementation of util::graph
// here. The util::graph should provide the service to abstract
// these manipulations.
- return id_ < p_ref_.pg().gr_->nnodes();
+ return p_ref_.is_valid() && id_ < p_ref_.pg().gr_->nnodes();
}
template <typename P>
Index: mln/core/graph_window_piter.hh
--- mln/core/graph_window_piter.hh (revision 1802)
+++ mln/core/graph_window_piter.hh (working copy)
@@ -228,7 +228,7 @@
bool
graph_window_fwd_piter<P>::is_valid() const
{
- return id_ < p_ref_.pg().npoints();
+ return p_ref_.is_valid() && id_ < p_ref_.pg().npoints();
}
template <typename P>
@@ -351,7 +351,7 @@
bool
graph_window_bkd_piter<P>::is_valid() const
{
- return id_ < p_ref_.pg().npoints();
+ return p_ref_.is_valid() && id_ < p_ref_.pg().npoints();
}
template <typename P>
Index: mln/core/line_graph_psite.hh
--- mln/core/line_graph_psite.hh (revision 1802)
+++ mln/core/line_graph_psite.hh (working copy)
@@ -89,9 +89,8 @@
/// Return the id of the second associated vertex.
util::node_id second_id() const;
- private:
/// Is this psite valid?
- bool is_valid_() const;
+ bool is_valid() const;
private:
/// The p_line_graph this point site belongs to.
@@ -179,7 +178,7 @@
template<typename P>
inline
bool
- line_graph_psite<P>::is_valid_() const
+ line_graph_psite<P>::is_valid() const
{
return plg_ && id_ < plg_->gr_->nedges();
}
@@ -206,7 +205,7 @@
mln_coord(P)
line_graph_psite<P>::operator[](unsigned i) const
{
- mln_assertion(is_valid_());
+ mln_assertion(is_valid());
return to_point()[i];
}
@@ -232,7 +231,7 @@
P
line_graph_psite<P>::first() const
{
- mln_assertion(is_valid_());
+ mln_assertion(is_valid());
return plg().gr_->node_data(first_id());
}
@@ -241,7 +240,7 @@
P
line_graph_psite<P>::second() const
{
- mln_assertion(is_valid_());
+ mln_assertion(is_valid());
return plg().gr_->node_data(second_id());
}
@@ -251,7 +250,7 @@
util::node_id
line_graph_psite<P>::first_id() const
{
- mln_assertion(is_valid_());
+ mln_assertion(is_valid());
return plg().gr_->edge(id_).n1();
}
@@ -260,7 +259,7 @@
util::node_id
line_graph_psite<P>::second_id() const
{
- mln_assertion(is_valid_());
+ mln_assertion(is_valid());
return plg().gr_->edge(id_).n2();
}
Index: mln/core/line_graph_neighborhood_piter.hh
--- mln/core/line_graph_neighborhood_piter.hh (revision 1802)
+++ mln/core/line_graph_neighborhood_piter.hh (working copy)
@@ -258,7 +258,7 @@
// FIXME: We depend too much on the implementation of util::graph
// here. The util::graph should provide the service to abstract
// these manipulations.
- return id_ < p_ref_.plg().gr_->nedges();
+ return p_ref_.is_valid() && id_ < p_ref_.plg().gr_->nedges();
}
template <typename P>
@@ -414,7 +414,7 @@
// FIXME: We depend too much on the implementation of util::graph
// here. The util::graph should provide the service to abstract
// these manipulations.
- return id_ < p_ref_.plg().gr_->nedges();
+ return p_ref_.is_valid() && id_ < p_ref_.plg().gr_->nedges();
}
template <typename P>
Index: mln/core/line_graph_window_piter.hh
--- mln/core/line_graph_window_piter.hh (revision 1802)
+++ mln/core/line_graph_window_piter.hh (working copy)
@@ -252,7 +252,7 @@
// FIXME: We depend too much on the implementation of util::graph
// here. The util::graph should provide the service to abstract
// these manipulations.
- return id_ < p_ref_.plg().gr_->nedges();
+ return p_ref_.is_valid() && id_ < p_ref_.plg().gr_->nedges();
}
template <typename P>
@@ -407,7 +407,7 @@
// FIXME: We depend too much on the implementation of util::graph
// here. The util::graph should provide the service to abstract
// these manipulations.
- return id_ < p_ref_.plg().gr_->nedges();
+ return p_ref_.is_valid() && id_ < p_ref_.plg().gr_->nedges();
}
template <typename P>