URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-07-24 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Minor fixes linked to graph.
* core/site_set/p_vertices.hh: Fix bug in constructor.
* make/edge_image.hh: Add overload to compute
edge_image from function v2v.
* util/internal/graph_base.hh: Make typedef visibility to public.
---
core/site_set/p_vertices.hh | 1 -
make/edge_image.hh | 31 +++++++++++++++++++++++++++++++
util/internal/graph_base.hh | 2 +-
3 files changed, 32 insertions(+), 2 deletions(-)
Index: trunk/milena/mln/core/site_set/p_vertices.hh
===================================================================
--- trunk/milena/mln/core/site_set/p_vertices.hh (revision 4327)
+++ trunk/milena/mln/core/site_set/p_vertices.hh (revision 4328)
@@ -218,7 +218,6 @@
template <typename G, typename F>
inline
p_vertices<G,F>::p_vertices()
- : f_(0)
{
}
Index: trunk/milena/mln/make/edge_image.hh
===================================================================
--- trunk/milena/mln/make/edge_image.hh (revision 4327)
+++ trunk/milena/mln/make/edge_image.hh (revision 4328)
@@ -54,6 +54,16 @@
mln::edge_image<void,V,G>
edge_image(const Graph<G>& g, const fun::i2v::array<V>& fv);
+ /// Construct an edge image.
+ ///
+ /// \param[in] g A graph
+ /// \param[in] fv A function mapping edge ids to values.
+ ///
+ /// \return an edge image.
+ //
+ template <typename FV, typename G>
+ mln::edge_image<void, mln_result(FV), G>
+ edge_image(const Graph<G>& g, const Function_v2v<FV>& fv);
/// Construct an edge image.
@@ -122,6 +132,27 @@
return ima;
}
+ template <typename FV, typename G>
+ mln::edge_image<void,mln_result(FV),G>
+ edge_image(const Graph<G>& g_,
+ const Function_v2v<FV>& fv)
+ {
+ trace::entering("make::edge_image");
+ const G& g = exact(g_);
+ const FV& f = exact(fv);
+ mln_precondition(g.is_valid());
+
+ p_edges<G> pe(g);
+ typedef mln::edge_image<void,mln_result(FV),G> ima_t;
+ ima_t ima(pe);
+
+ mln_piter(ima_t) e(ima.domain());
+ for_all(e)
+ ima(e) = f(e.id());
+
+ trace::exiting("make::edge_image");
+ return ima;
+ }
template <typename FP, typename FV, typename G>
Index: trunk/milena/mln/util/internal/graph_base.hh
===================================================================
--- trunk/milena/mln/util/internal/graph_base.hh (revision 4327)
+++ trunk/milena/mln/util/internal/graph_base.hh (revision 4328)
@@ -64,7 +64,7 @@
class graph_base : public Graph<E>
{
- protected:
+ public:
/// The type of a vertex.
typedef util::vertex<E> vertex_t;
/// The type of an edge.