
* mln/make/vertex_image: new routine. --- milena/ChangeLog | 6 +++ milena/mln/make/vertex_image.hh | 88 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 0 deletions(-) create mode 100644 milena/mln/make/vertex_image.hh diff --git a/milena/ChangeLog b/milena/ChangeLog index 13558bc..4ff058c 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,11 @@ 2009-04-15 Guillaume Lazzara <lazzara@lrde.epita.fr> + Add make::vertex_image + + * mln/make/vertex_image: new routine. + +2009-04-15 Guillaume Lazzara <lazzara@lrde.epita.fr> + Fix more tests. * tests/fun/l2l/wrap.cc, diff --git a/milena/mln/make/vertex_image.hh b/milena/mln/make/vertex_image.hh new file mode 100644 index 0000000..c5db7ea --- /dev/null +++ b/milena/mln/make/vertex_image.hh @@ -0,0 +1,88 @@ +// Copyright (C) 2009 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. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MAKE_VERTEX_IMAGE_HH +# define MLN_MAKE_VERTEX_IMAGE_HH + +/// \file mln/make/vertex_image.hh +/// +/// Routine to create a vertex image. + +# include <mln/core/image/vertex_image.hh> +# include <mln/core/concept/function.hh> +# include <mln/util/internal/id2element.hh> + + +namespace mln +{ + + namespace make + { + + +# ifndef MLN_INCLUDE_ONLY + + template <typename V, typename G> + mln::vertex_image<void,V,G> + vertex_image(const Graph<G>& g, const fun::i2v::array<V>& fv) + { + trace::entering("make::vertex_image"); + mln_precondition(exact(g).is_valid()); + + p_vertices<G> pv(g); + mln::vertex_image<void,V,G> ima(pv, fv); + + trace::exiting("make::vertex_image"); + return ima; + } + + + template <typename FP, typename FV, typename G> + mln::vertex_image<mln_result(FP),mln_result(FV),G> + vertex_image(const Graph<G>& g_, + const Function_i2v<FP>& fp, + const Function_i2v<FV>& fv) + { + trace::entering("make::vertex_image"); + const G& g = exact(g_); + mln_precondition(g.is_valid()); + + p_vertices<G,FP> pv(g,fp); + mln::vertex_image<mln_result(FP),mln_result(FV),G> ima(pv, fv); + + trace::exiting("make::vertex_image"); + return ima; + } + +# endif // ! MLN_INCLUDE_ONLY + + + } // end of namespace mln::make + +} // end of namespace mln + +# endif // ! MLN_MAKE_VERTEX_IMAGE_HH -- 1.5.6.5
participants (1)
-
Guillaume Lazzara