Commit 1cd4b005 authored by Roland Levillain's avatar Roland Levillain
Browse files

Add oln::level::fill().

	* oln/level/fill.hh: New.
	* oln/Makefile.am (nobase_oln_HEADERS): Add level/fill.hh.
	* tests/fill.cc: New test.
	* tests/Makefile.am (AM_CXXFLAGS): Rename as...
	(CXXFLAGS): ...this.
	(check_PROGRAMS): Add fill.
	(fill_SOURCES): New.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@585 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 79c7b4b8
2006-09-28 Roland Levillain <roland@lrde.epita.fr>
Add oln::level::fill().
* oln/level/fill.hh: New.
* oln/Makefile.am (nobase_oln_HEADERS): Add level/fill.hh.
* tests/fill.cc: New test.
* tests/Makefile.am (AM_CXXFLAGS): Rename as...
(CXXFLAGS): ...this.
(check_PROGRAMS): Add fill.
(fill_SOURCES): New.
2006-09-28 Roland Levillain <roland@lrde.epita.fr>
Catch up with Static's changes on automatically retrieved
......
......@@ -112,6 +112,8 @@ nobase_oln_HEADERS = \
\
debug/print.hh \
\
level/fill.hh \
\
morpher/internal/image_extension.hh \
\
morpher/add_neighborhood.hh \
......
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 EPITA Research and
// Development Laboratory
//
// 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 OLN_LEVEL_FILL_HH
# define OLN_LEVEL_FILL_HH
# include <mlc/assert.hh>
# include <mlc/is_a.hh>
# include <oln/core/abstract/image.hh>
# include <oln/core/automatic/image_being_mutable.hh>
namespace oln
{
namespace ERROR
{
struct FIRST_ARGUMENT_OF_oln_level_fill_IS_NOT_MUTABLE;
}
namespace level
{
/// Fwd decl.
template <typename I>
void fill(abstract::image<I>& input, const oln_type_of(I, value)& val);
namespace impl
{
/// Generic version.
template <typename I>
void fill(abstract::image_being_mutable<I>& input,
const oln_type_of(I, value)& val)
{
oln_type_of(I, piter) p(input.topo());
for_all(p)
input(p) = val;
}
} // end of namespace oln::level::fill
/// Facade.
template <typename I>
void fill(abstract::image<I>& input, const oln_type_of(I, value)& val)
{
// Precondition.
mlc::assert_<
mlc_is_a(I, abstract::image_being_mutable),
ERROR::FIRST_ARGUMENT_OF_oln_level_fill_IS_NOT_MUTABLE
>::check();
impl::fill(input.exact(), val);
}
} // end of namespace oln::level
} // end of namespace oln
#endif // ! OLN_LEVEL_FILL_HH
......@@ -3,12 +3,14 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/olena -I$(top_srcdir)/extended \
-I$(top_srcdir)/static -I$(top_srcdir)/metalic
# FIXME: Add
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) -ggdb
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
# when oln.m4 is available in the distribution.
AM_CXXFLAGS = -O0 -ggdb
# Meanwhile, alter CXXFLAGS to turn off any optimization.
CXXFLAGS = -O0 -ggdb
check_PROGRAMS = \
......@@ -18,14 +20,22 @@ check_PROGRAMS = \
\
identity_morpher \
add_neighborhood_morpher \
morphers
morphers \
\
fill
# Images and auxiliary structures.
grid_SOURCES = grid.cc
image_entry_SOURCES = image_entry.cc
npoints_SOURCES = npoints.cc
# Morphers.
identity_morpher_SOURCES = identity_morpher.cc
add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
morphers_SOURCES = morphers.cc
# Algorithms.
fill_SOURCES = fill.cc
TESTS = $(check_PROGRAMS)
// Copyright (C) 2006 EPITA Research and Development Laboratory
//
// 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.
/// Test oln::level::fill.
#include <cassert>
// FIXME: We should not include oln/basics2d.hh, but
// oln/core/2d/image2d.hh (and oln/core/2d/neigh2d.hh ?).
#include <oln/basics2d.hh>
#include <oln/level/fill.hh>
int
main()
{
typedef oln::image2d<int> image_t;
image_t ima(3, 3);
oln::level::fill(ima, 51);
oln_type_of_(image_t, piter) p(ima.topo());
for_all(p)
assert(ima(p) == 51);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment