Commit a161df7d authored by Thomas Moulard's avatar Thomas Moulard
Browse files

Split morphers' interface and implementation.

	* oln/morpher/add_isubset.hh: Split into...
	* oln/morpher/add_isubset.hxx: ...this new file.
	* oln/morpher/add_neighborhood.hh: Split into...
	* oln/morpher/add_neighborhood.hxx: : ...this new file.
	* oln/morpher/count_rw.hh: Split into...
	* oln/morpher/count_rw.hxx: : ...this new file.
	* oln/morpher/identity.hh: Split into...
	* oln/morpher/identity.hxx: : ...this new file.
	* oln/morpher/stack.hh: Split into...
	* oln/morpher/stack.hxx: : ...this new file.
	* oln/morpher/stack_rw.hh: Split into...
	* oln/morpher/stack_rw.hxx: : ...this new file.
	* oln/morpher/thru_fun.hh: Split into...
	* oln/morpher/thru_mfun.hh: Split into...
	* oln/morpher/thru_mfun.hxx: : ...this new file.
	* oln/morpher/two_way.hh: Split into...
	* oln/morpher/two_way.hxx: : ...this new file.
	* oln/morpher/two_way_rw.hh: Split into...
	* oln/morpher/two_way_rw.hxx: : ...this new file.
	* oln/morpher/value_cast.hh: Split into...
	* oln/morpher/value_cast.hxx: : ...this new file.
	* oln/morpher/with_lut.hh: Split into...
	* oln/morpher/with_lut.hxx: : ...this new file.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@720 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 66791198
2007-01-19 Thomas Moulard <thomas.moulard@lrde.epita.fr>
Split morphers' interface and implementation.
* oln/morpher/add_isubset.hh: Split into...
* oln/morpher/add_isubset.hxx: ...this new file.
* oln/morpher/add_neighborhood.hh: Split into...
* oln/morpher/add_neighborhood.hxx: : ...this new file.
* oln/morpher/count_rw.hh: Split into...
* oln/morpher/count_rw.hxx: : ...this new file.
* oln/morpher/identity.hh: Split into...
* oln/morpher/identity.hxx: : ...this new file.
* oln/morpher/stack.hh: Split into...
* oln/morpher/stack.hxx: : ...this new file.
* oln/morpher/stack_rw.hh: Split into...
* oln/morpher/stack_rw.hxx: : ...this new file.
* oln/morpher/thru_fun.hh: Split into...
* oln/morpher/thru_mfun.hh: Split into...
* oln/morpher/thru_mfun.hxx: : ...this new file.
* oln/morpher/two_way.hh: Split into...
* oln/morpher/two_way.hxx: : ...this new file.
* oln/morpher/two_way_rw.hh: Split into...
* oln/morpher/two_way_rw.hxx: : ...this new file.
* oln/morpher/value_cast.hh: Split into...
* oln/morpher/value_cast.hxx: : ...this new file.
* oln/morpher/with_lut.hh: Split into...
* oln/morpher/with_lut.hxx: : ...this new file.
2006-12-04 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Propagate scoop update to oln.
......
// Copyright (C) 2006 EPITA Research and Development Laboratory
// Copyright (C) 2006, 2007 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
......@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLN_MORPHER_ADD_ISUBSET
# define OLN_MORPHER_ADD_ISUBSET
#ifndef OLN_MORPHER_ADD_ISUBSET_HH
# define OLN_MORPHER_ADD_ISUBSET_HH
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/image/type/binary.hh>
......@@ -72,7 +72,7 @@ namespace oln
{
/// Isubset addition morpher.
template <typename Image, typename Isubset>
class add_isubset : public morpher::internal::image_extension< Image,
class add_isubset : public morpher::internal::image_extension< Image,
add_isubset<Image, Isubset> >
// FIXME: Uncomment. stc_get_supers(mlc_comma_1(add_isubset<Image, Isubset>))
{
......@@ -93,34 +93,9 @@ namespace oln
protected:
topo_t topo_;
};
# ifndef OLN_INCLUDE_ONLY
template <typename Image, typename Isubset>
add_isubset<Image, Isubset>::add_isubset(const Image& image, const Isubset& isubset) :
super_t(image),
topo_(image.topo(), isubset)
{
// mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Isubset, grid)>::check();
// FIXME: check that Image is without a isubset
}
template <typename Image, typename Isubset>
const typename add_isubset<Image, Isubset>::topo_t&
add_isubset<Image, Isubset>::impl_topo() const
{
return topo_;
}
# endif
} // end of namespace oln::morpher
template <typename I, typename S>
morpher::add_isubset<I, S>
operator | (const abstract::image<I>& image,
......@@ -135,33 +110,10 @@ namespace oln
operator | (const abstract::image<I>& image,
const xtd::abstract::fun_nary_expr_<1,S>& fsubset);
} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
template <typename I, typename S>
morpher::add_isubset<I, S>
operator | (const abstract::image<I>& image,
const abstract::binary_image<S>& isubset)
{
mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(S, grid)>::check();
// FIXME: check that Image does not have yet a subset
morpher::add_isubset<I, S> tmp(image.exact(), isubset.exact());
return tmp;
}
template <typename I, typename S>
morpher::add_isubset<I, S>
operator | (const abstract::image<I>& image,
const xtd::abstract::fun_nary_expr_<1,S>& fsubset)
{
morpher::add_isubset<I, S> tmp(image.exact(), fsubset.exact_());
return tmp;
}
# include "add_isubset.hxx"
# endif
} // end of namespace oln
#endif // ! OLN_MORPHER_ADD_ISUBSET
#endif // ! OLN_MORPHER_ADD_ISUBSET_HH
// Copyright (C) 2007 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_MORPHER_ADD_ISUBSET_HXX
# define OLN_MORPHER_ADD_ISUBSET_HXX
namespace oln
{
namespace morpher
{
template <typename Image, typename Isubset>
add_isubset<Image, Isubset>::add_isubset(const Image& image, const Isubset& isubset) :
super_t(image),
topo_(image.topo(), isubset)
{
// mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Isubset, grid)>::check();
// FIXME: check that Image is without a isubset
}
template <typename Image, typename Isubset>
const typename add_isubset<Image, Isubset>::topo_t&
add_isubset<Image, Isubset>::impl_topo() const
{
return topo_;
}
} // end of namespace oln::morpher
template <typename I, typename S>
morpher::add_isubset<I, S>
operator | (const abstract::image<I>& image,
const abstract::binary_image<S>& isubset)
{
mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(S, grid)>::check();
// FIXME: check that Image does not have yet a subset
morpher::add_isubset<I, S> tmp(image.exact(), isubset.exact());
return tmp;
}
template <typename I, typename S>
morpher::add_isubset<I, S>
operator | (const abstract::image<I>& image,
const xtd::abstract::fun_nary_expr_<1,S>& fsubset)
{
morpher::add_isubset<I, S> tmp(image.exact(), fsubset.exact_());
return tmp;
}
} // end of namespace oln
#endif // ! OLN_MORPHER_ADD_ISUBSET_HXX
// Copyright (C) 2006 EPITA Research and Development Laboratory
// Copyright (C) 2006, 2007 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
......@@ -95,27 +95,6 @@ namespace oln
topo_t topo_;
};
# ifndef OLN_INCLUDE_ONLY
template <typename Image, typename Neighb>
add_neighborhood<Image, Neighb>::add_neighborhood(const Image& image, const Neighb& nbh) :
super_t(image),
topo_(image.topo(), nbh)
{
mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Neighb, grid)>::check();
// FIXME: check that Image is without a nbh
}
template <typename Image, typename Neighb>
const typename add_neighborhood<Image, Neighb>::topo_t&
add_neighborhood<Image, Neighb>::impl_topo() const
{
return topo_;
}
# endif
} // end of namespace oln::morpher
......@@ -124,23 +103,10 @@ namespace oln
morpher::add_neighborhood<I, N>
operator + (const abstract::image<I>& image, const abstract::neighborhood<N>& nbh);
} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
template <typename I, typename N>
morpher::add_neighborhood<I, N>
operator + (const abstract::image<I>& image,
const abstract::neighborhood<N>& nbh)
{
mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(N, grid)>::check();
// FIXME: check that Image is without a nbh
morpher::add_neighborhood<I, N> tmp(image.exact(), nbh.exact());
return tmp;
}
# include "add_neighborhood.hxx"
# endif
} // end of namespace oln
#endif // ! OLN_MORPHER_ADD_NEIGHBORHOOD_HH
// Copyright (C) 2007 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_MORPHER_ADD_NEIGHBORHOOD_HXX
# define OLN_MORPHER_ADD_NEIGHBORHOOD_HXX
namespace oln
{
namespace morpher
{
template <typename Image, typename Neighb>
add_neighborhood<Image, Neighb>::add_neighborhood(const Image& image, const Neighb& nbh) :
super_t(image),
topo_(image.topo(), nbh)
{
mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Neighb, grid)>::check();
// FIXME: check that Image is without a nbh
}
template <typename Image, typename Neighb>
const typename add_neighborhood<Image, Neighb>::topo_t&
add_neighborhood<Image, Neighb>::impl_topo() const
{
return topo_;
}
} // end of namespace oln::morpher
template <typename I, typename N>
morpher::add_neighborhood<I, N>
operator + (const abstract::image<I>& image,
const abstract::neighborhood<N>& nbh)
{
mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(N, grid)>::check();
// FIXME: check that Image is without a nbh
morpher::add_neighborhood<I, N> tmp(image.exact(), nbh.exact());
return tmp;
}
} // end of namespace oln
#endif // ! ADD_NEIGHBORHOOD_HXX
// Copyright (C) 2006 EPITA Research and Development Laboratory
// Copyright (C) 2006, 2007 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
......@@ -99,41 +99,6 @@ namespace oln
} // end of namespace oln::morpher::ERROR
# ifndef OLN_INCLUDE_ONLY
// public
template <typename Image>
count_rw_<Image>::count_rw_(Image& image) :
super_t(image)
{
}
template <typename Image>
count_rw_<Image>::count_rw_(oln::abstract::mutable_image<Image>& image) :
super_t(image.exact())
{
}
template <typename Image>
oln_rvalue(count_rw_<Image>)
count_rw_<Image>::impl_op_read(const oln_psite(count_rw_<Image>)& p) const
{
value::ro_counter<Image> tmp(image_, p);
return tmp;
}
template <typename Image>
oln_lvalue(count_rw_<Image>)
count_rw_<Image>::impl_op_readwrite(const oln_psite(count_rw_<Image>)& p)
{
value::rw_counter<Image> tmp(image_, p);
return tmp;
}
# endif
} // end of namespace oln::morpher
......@@ -145,31 +110,10 @@ namespace oln
morpher::count_rw_<I>
count_rw(const oln::abstract::mutable_image<I>& input);
} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
template <typename I>
morpher::count_rw_<I>
count_rw(oln::abstract::mutable_image<I>& input)
{
morpher::count_rw_<I> tmp(input.exact());
return tmp;
}
template <typename I>
morpher::count_rw_<I>
count_rw(const oln::abstract::mutable_image<I>& input)
{
// FIXME: Hack.
I& input_ = const_cast<I&>(input.exact());
morpher::count_rw_<I> tmp(input_);
return tmp;
}
# include "count_rw.hxx"
# endif
} // end of namespace oln
#endif // ! OLN_MORPHER_COUNT_RW_HH
// Copyright (C) 2007 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_MORPHER_COUNT_RW_HXX
# define OLN_MORPHER_COUNT_RW_HXX
namespace oln
{
namespace morpher
{
// public
template <typename Image>
count_rw_<Image>::count_rw_(Image& image) :
super_t(image)
{
}
template <typename Image>
count_rw_<Image>::count_rw_(oln::abstract::mutable_image<Image>& image) :
super_t(image.exact())
{
}
template <typename Image>
oln_rvalue(count_rw_<Image>)
count_rw_<Image>::impl_op_read(const oln_psite(count_rw_<Image>)& p) const
{
value::ro_counter<Image> tmp(image_, p);
return tmp;
}
template <typename Image>
oln_lvalue(count_rw_<Image>)
count_rw_<Image>::impl_op_readwrite(const oln_psite(count_rw_<Image>)& p)
{
value::rw_counter<Image> tmp(image_, p);
return tmp;
}
} // end of namespace oln::morpher
template <typename I>
morpher::count_rw_<I>
count_rw(oln::abstract::mutable_image<I>& input)
{
morpher::count_rw_<I> tmp(input.exact());
return tmp;
}
template <typename I>
morpher::count_rw_<I>
count_rw(const oln::abstract::mutable_image<I>& input)
{
// FIXME: Hack.
I& input_ = const_cast<I&>(input.exact());
morpher::count_rw_<I> tmp(input_);
return tmp;
}
} // end of namespace oln
#endif // ! OLN_MORPHER_COUNT_RW_HH
// Copyright (C) 2006 EPITA Research and Development Laboratory
// Copyright (C) 2006, 2007 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
......@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLN_MORPHER_IDENTITY
# define OLN_MORPHER_IDENTITY
#ifndef OLN_MORPHER_IDENTITY_HH
# define OLN_MORPHER_IDENTITY_HH
# include <oln/morpher/internal/image_extension.hh>
......@@ -82,4 +82,6 @@ namespace oln
} // end of namespace oln
#endif // ! OLN_MORPHER_IDENTITY
#endif // ! OLN_MORPHER_IDENTITY_HH
// Copyright (C) 2007 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_MORPHER_IDENTITY_HXX
# define OLN_MORPHER_IDENTITY_HXX
namespace oln
{
namespace morpher
{
template <typename Image>
identity<Image>::identity(const Image& image) :
super_t(image)
{
}
} // end of namespace oln::morpher