---
milena/mln/util/internal/graph_edge.hh | 30 +++++++++++++++++++++++++-----
milena/mln/util/internal/graph_vertex.hh | 20 ++++++++++++++++++++
2 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/milena/mln/util/internal/graph_edge.hh
b/milena/mln/util/internal/graph_edge.hh
index 24bb716..18f9858 100644
--- a/milena/mln/util/internal/graph_edge.hh
+++ b/milena/mln/util/internal/graph_edge.hh
@@ -69,7 +69,10 @@ namespace mln
void update_id(unsigned id);
/// Return pointer of the graph holding this edge.
- const graph_t * const g() const;
+ const graph_t * g() const;
+
+ /// Set \att g_ with \p g;
+ void change_graph(const graph_t& g);
/// \}
@@ -99,7 +102,7 @@ namespace mln
/// \}
private:
- graph_t * const g_;
+ graph_t * g_;
unsigned id_;
};
@@ -123,7 +126,7 @@ namespace mln
struct subject_impl< const util::edge<G>, E >
{
unsigned id() const;
- const mlc_const(G) * const g() const;
+ const mlc_const(G) * g() const;
unsigned v_other(unsigned id_v) const;
bool is_valid() const;
unsigned v1() const;
@@ -141,6 +144,7 @@ namespace mln
subject_impl< const util::edge<G>, E >
{
void update_id(unsigned id);
+ void change_graph(const mlc_const(G)& g);
private:
E& exact_();
@@ -199,7 +203,7 @@ namespace mln
template <typename G>
inline
- const typename edge<G>::graph_t * const
+ const typename edge<G>::graph_t *
edge<G>::g() const
{
return g_;
@@ -207,6 +211,14 @@ namespace mln
template <typename G>
inline
+ void
+ edge<G>::change_graph(const graph_t& g)
+ {
+ g_ = & g;
+ }
+
+ template <typename G>
+ inline
unsigned
edge<G>::v_other(unsigned id_v) const
{
@@ -303,7 +315,7 @@ namespace mln
template <typename G, typename E>
inline
- const mlc_const(G) * const
+ const mlc_const(G) *
subject_impl< const util::edge<G>, E >::g() const
{
return exact_().get_subject().g();
@@ -370,6 +382,14 @@ namespace mln
return exact_().get_subject().update_id(id);
}
+ template <typename G, typename E>
+ inline
+ void
+ subject_impl< util::edge<G>, E >::change_graph(const mlc_const(G)&
g)
+ {
+ return exact_().get_subject().change_graph(&g);
+ }
+
} // End of namespace mln::internal
# endif // !MLN_INCLUDE_ONLY
diff --git a/milena/mln/util/internal/graph_vertex.hh
b/milena/mln/util/internal/graph_vertex.hh
index 02dee6d..8d35282 100644
--- a/milena/mln/util/internal/graph_vertex.hh
+++ b/milena/mln/util/internal/graph_vertex.hh
@@ -56,6 +56,8 @@ namespace mln
/// Check whether the vertex is still part of the graph.
bool is_valid() const;
+ /// Invalidate that vertex.
+ void invalidate();
unsigned other(unsigned id_e) const;
@@ -118,6 +120,7 @@ namespace mln
struct subject_impl< util::vertex<G>, E > :
subject_impl< const util::vertex<G>, E >
{
+ void invalidate();
void change_graph(const G& g);
void update_id(unsigned id);
@@ -171,6 +174,15 @@ namespace mln
template<typename G>
inline
+ void
+ vertex<G>::invalidate()
+ {
+ id_ = g_->v_nmax();
+ }
+
+
+ template<typename G>
+ inline
unsigned
vertex<G>::other(unsigned id_e) const
{
@@ -338,6 +350,14 @@ namespace mln
template <typename G, typename E>
inline
void
+ subject_impl< util::vertex<G>, E >::invalidate()
+ {
+ exact_().get_subject().invalidate();
+ }
+
+ template <typename G, typename E>
+ inline
+ void
subject_impl< util::vertex<G>, E >::change_graph(const G& g)
{
exact_().get_subject().change_graph(g);
--
1.5.6.5
Show replies by date