Commit c4188fdf authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Update windows and neighborhoods + remove obsolete files.

	* oln/core/abstract/window.hh: Rename as...
	* oln/core/concept/window.hh: ...this and update.
	* oln/core/abstract/neighborhood.hh: Rename as...
	* oln/core/concept/neighborhood.hh: ...this and update.
	* oln/core/gen/fwd_qiter_win.hh: Rename as...
	* oln/core/gen/dpoints_piter.hh: ...this and update.
	* oln/core/internal/dpoints_impl.hh: New.
	* oln/core/2d/neighb2d.hh: Update.
	* oln/core/internal/image_base.hh (plain_primitive_image_): New.
	* oln/core/2d/image2d.hh (image2d): Inherit from plain_primitive_image_.
	* oln/core/2d/window2d.hh: Update
	(mk_square): New.
	* oln/core/gen/neighb.hh: Update.
	* oln/core/internal/image_selectors.hh: Fix.
	* oln/core/internal/dpoint_base.hh (include): Fix.

	* oln/core/type.hh,
	* oln/core/typedefs.hh,
	* oln/core/macros.hh,
	* oln/core/neighborhood_entry.hh,
	* oln/core/gen/bkd_qiter_win.hh,
	* oln/core/gen/grid.hh,
	* oln/core/gen/topo_add_isubset.hh,
	* oln/core/gen/topo_bbox.hh,
	* oln/core/gen/fwd_niter_neighb.hh,
	* oln/core/gen/topo_lbbox.hh,
	* oln/core/gen/bkd_niter_neighb.hh,
	* oln/core/gen/topo_add_nbh.hh,
	* oln/core/internal/topology_morpher.hh: Remove.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@855 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent ece7a482
2007-03-06 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Update windows and neighborhoods + remove obsolete files.
* oln/core/abstract/window.hh: Rename as...
* oln/core/concept/window.hh: ...this and update.
* oln/core/abstract/neighborhood.hh: Rename as...
* oln/core/concept/neighborhood.hh: ...this and update.
* oln/core/gen/fwd_qiter_win.hh: Rename as...
* oln/core/gen/dpoints_piter.hh: ...this and update.
* oln/core/internal/dpoints_impl.hh: New.
* oln/core/2d/neighb2d.hh: Update.
* oln/core/internal/image_base.hh (plain_primitive_image_): New.
* oln/core/2d/image2d.hh (image2d): Inherit from plain_primitive_image_.
* oln/core/2d/window2d.hh: Update
(mk_square): New.
* oln/core/gen/neighb.hh: Update.
* oln/core/internal/image_selectors.hh: Fix.
* oln/core/internal/dpoint_base.hh (include): Fix.
* oln/core/type.hh,
* oln/core/typedefs.hh,
* oln/core/macros.hh,
* oln/core/neighborhood_entry.hh,
* oln/core/gen/bkd_qiter_win.hh,
* oln/core/gen/grid.hh,
* oln/core/gen/topo_add_isubset.hh,
* oln/core/gen/topo_bbox.hh,
* oln/core/gen/fwd_niter_neighb.hh,
* oln/core/gen/topo_lbbox.hh,
* oln/core/gen/bkd_niter_neighb.hh,
* oln/core/gen/topo_add_nbh.hh,
* oln/core/internal/topology_morpher.hh: Remove.
2007-03-06 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Extend image selectors and add image2d type.
......
......@@ -46,7 +46,6 @@ namespace oln
struct vtypes< image2d<T> >
{
typedef point2d point;
typedef point psite;
typedef int coord;
typedef unsigned index;
......@@ -65,17 +64,17 @@ namespace oln
struct super_trait_< image2d<T> >
{
typedef image2d<T> current;
typedef internal::image_base_<current> ret;
typedef internal::plain_primitive_image_<current> ret;
};
/// General 2D image class.
template <typename T>
class image2d : public internal::image_base_< image2d<T> >
class image2d : public internal::plain_primitive_image_< image2d<T> >
{
typedef image2d<T> current;
typedef internal::image_base_<current> super;
typedef internal::plain_primitive_image_<current> super;
public:
stc_using(data);
......
// Copyright (C) 2001, 2002, 2003, 2004, 2006 EPITA Research and
// Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 EPITA Research and
// Development Laboratory
//
// This file is part of the Olena Library. This library is free
......@@ -52,38 +52,38 @@ namespace oln
neighb2d mk_c4()
{
neighb2d the_;
the_
.add(dpoint2d(0, 1))
.add(dpoint2d(1, 0));
return the_;
neighb2d tmp;
tmp
.take(dpoint2d(0, 1))
.take(dpoint2d(1, 0));
return tmp;
}
neighb2d mk_c8()
{
neighb2d the_;
the_
.add(dpoint2d(0, 1))
.add(dpoint2d(1,-1))
.add(dpoint2d(1, 0))
.add(dpoint2d(1, 1));
return the_;
neighb2d tmp;
tmp
.take(dpoint2d(0, 1))
.take(dpoint2d(1,-1))
.take(dpoint2d(1, 0))
.take(dpoint2d(1, 1));
return tmp;
}
neighb2d mk_c2_row()
{
neighb2d the_;
the_
.add(dpoint2d(0, 1));
return the_;
neighb2d tmp;
tmp
.take(dpoint2d(0, 1));
return tmp;
}
neighb2d mk_c2_col()
{
neighb2d the_;
the_
.add(dpoint2d(1, 0));
return the_;
neighb2d tmp;
tmp
.take(dpoint2d(1, 0));
return tmp;
}
# endif
......
......@@ -28,10 +28,49 @@
#ifndef OLN_CORE_2D_WINDOW2D_HH
# define OLN_CORE_2D_WINDOW2D_HH
// Headers required for the complete definition of oln::window2d
// (i.e., oln::window_<dpoint2d>).
# include <oln/core/2d/aliases.hh>
# include <oln/core/2d/dpoint2d.hh>
# include <oln/core/gen/window.hh>
# include <oln/core/2d/dpoint2d.hh>
namespace oln
{
typedef window_<dpoint2d> window2d;
window2d mk_square(unsigned odd_len);
# ifndef OLN_INCLUDE_ONLY
window2d mk_square(unsigned odd_len)
{
precondition(odd_len % 2 == 1);
window2d tmp;
int half_len = odd_len / 2;
for (int drow = - half_len; drow <= half_len; ++drow)
for (int dcol = - half_len; dcol <= half_len; ++dcol)
tmp.take(dpoint2d(drow, dcol));
return tmp;
}
# endif
extern const window2d win3x3;
extern const window2d win5x5;
# ifndef OLN_INCLUDE_ONLY
const window2d win3x3 = mk_square(3);
const window2d win5x5 = mk_square(5);
# endif
} // end of namespace oln
#endif // ! OLN_CORE_2D_WINDOW2D_HH
// 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.
#ifndef OLN_CORE_ABSTRACT_NEIGHBORHOOD_HH
# define OLN_CORE_ABSTRACT_NEIGHBORHOOD_HH
# include <oln/core/typedefs.hh>
namespace oln
{
namespace abstract
{
/// Abstract neighborhood class.
template <typename E>
class neighborhood : public virtual stc::any__simple<E>,
public virtual oln::type
{
public:
bool is_valid() const;
struct decl
{
oln_virtual_typedef(grid);
decl();
};
protected:
neighborhood();
~neighborhood();
}; // end of class oln::abstract::neighborhood<E>
# ifndef OLN_INCLUDE_ONLY
template <typename E>
bool neighborhood<E>::is_valid() const
{
return this->exact().impl_is_valid();
}
template <typename E>
neighborhood<E>::neighborhood()
{
}
template <typename E>
neighborhood<E>::~neighborhood()
{
decl();
}
template <typename E>
neighborhood<E>::decl::decl()
{
}
# endif
} // end of namespace oln::abstract
} // end of namespace oln
// # include <oln/core/abstract/neighborhood_hierarchies.hh>
#endif // ! OLN_CORE_ABSTRACT_NEIGHBORHOOD_HH
// 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.
#ifndef OLN_CORE_ABSTRACT_WINDOW_HH
# define OLN_CORE_ABSTRACT_WINDOW_HH
# include <oln/core/typedefs.hh>
namespace oln
{
namespace abstract { template <typename E> class window; }
template <typename E>
struct set_super_type< abstract::window<E> >
{
typedef mlc::none ret;
};
namespace abstract
{
/// Abstract window class.
template <typename E>
class window : public virtual stc::any__simple<E>,
public virtual oln::type
{
public:
bool is_valid() const;
struct decl
{
oln_virtual_typedef(grid);
decl();
};
protected:
window();
~window();
}; // end of class oln::abstract::window<E>
# ifndef OLN_INCLUDE_ONLY
template <typename E>
bool window<E>::is_valid() const
{
return this->exact().impl_is_valid();
}
template <typename E>
window<E>::window()
{
}
template <typename E>
window<E>::~window()
{
decl();
}
template <typename E>
window<E>::decl::decl()
{
}
# endif
} // end of namespace oln::abstract
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_WINDOW_HH
// Copyright (C) 2005, 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
......@@ -11,7 +11,7 @@
// 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 tog
// 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.
//
......@@ -25,44 +25,39 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLN_CORE_GEN_GRID_HH
# define OLN_CORE_GEN_GRID_HH
#ifndef OLN_CORE_CONCEPT_NEIGHBORHOOD_HH
# define OLN_CORE_CONCEPT_NEIGHBORHOOD_HH
# include <mlc/int.hh>
# include <oln/core/abstract/grid.hh>
# include <oln/core/equipment.hh>
namespace oln
{
// Forward declaration.
template <unsigned D> struct grid_;
/// Concept-class "Neighborhood".
/// Super type declaration.
template <unsigned D>
struct set_super_type< grid_<D> >
template <typename Exact>
struct Neighborhood : public Any<Exact>
{
typedef abstract::grid< grid_<D> > ret;
};
stc_typename(grid);
protected:
Neighborhood();
}; // end of oln::Neighborhood<Exact>
/// Virtual types associated to oln::grid1d.
template <unsigned D>
struct vtypes< grid_<D> >
{
typedef mlc::uint_<D> dimvalue_type;
};
/// A 1D grid.
template <unsigned D>
struct grid_ : public abstract::grid< grid_<D> >
# ifndef OLN_INCLUDE_ONLY
template <typename Exact>
Neighborhood<Exact>::Neighborhood()
{
protected:
grid_() {}
};
}
# endif
} // end of namespace oln
#endif // ! OLN_CORE_GEN_GRID_HH
#endif // ! OLN_CORE_CONCEPT_NEIGHBORHOOD_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,23 +25,33 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLN_CORE_TYPE_HH
# define OLN_CORE_TYPE_HH
#ifndef OLN_CORE_CONCEPT_WINDOW_HH
# define OLN_CORE_CONCEPT_WINDOW_HH
# include <oln/core/equipment.hh>
namespace oln
{
struct type
/// Concept-class "Window".
template <typename Exact>
struct Window : public Any<Exact>
{
stc_typename(grid);
protected:
type();
};
Window();
}; // end of oln::Window<Exact>
# ifndef OLN_INCLUDE_ONLY
type::type()
template <typename Exact>
Window<Exact>::Window()
{
}
......@@ -50,4 +60,4 @@ namespace oln
} // end of namespace oln
#endif // ! OLN_CORE_TYPE_HH
#endif // ! OLN_CORE_CONCEPT_WINDOW_HH
// 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.
#ifndef OLN_CORE_GEN_BKD_NITER_NEIGHB_HH
# define OLN_CORE_GEN_BKD_NITER_NEIGHB_HH
# include <oln/core/abstract/topology.hh>
# include <oln/core/abstract/iterator_on_points.hh>
# include <oln/core/gen/neighb.hh>
namespace oln
{
// Backward declaration.
template <typename point_t> class bkd_niter_neighb_;
// Super type declaration.
template <typename point_t>
struct set_super_type< bkd_niter_neighb_<point_t> >
{
typedef bkd_niter_neighb_<point_t> self_t;
typedef abstract::iterator_on_points<self_t> ret;
};
/// Virtual types associated to oln::bkd_niter_neighb_<point_t>.
template <typename point_t>
struct vtypes< bkd_niter_neighb_<point_t> >
{
typedef point_t point_type;
typedef oln_grid(point_t) grid_type;
};
/// Abstract backward point iterator class.
template <typename point_t>
class bkd_niter_neighb_ : public abstract::iterator_on_points< bkd_niter_neighb_<point_t> >
{
typedef bkd_niter_neighb_<point_t> self_t;
typedef abstract::iterator_on_points<self_t> super_t;
typedef oln_dpoint(point_t) dpoint_t;
public:
template <typename P, typename T>
bkd_niter_neighb_(const abstract::iterator_on_points<P>& it,
const abstract::topology<T>& topo);
// FIXME: To be possibly enabled later (still unsure about it).
// template <typename P, typename N>
// bkd_niter_neighb_(const abstract::iterator_on_points<P>& it,
// const abstract::neighborhood<N>& nbh)
// : p_ref_(it.point_adr()),
// nbh_(nbh.exact())
// {
// precondition(nbh_.card() > 0);
// this->invalidate();
// }
// template <typename P, typename T>
// bkd_niter_neighb_(const abstract::point<P>& p,
// const abstract::topology<T>& topo)
// : p_ref_(&(p.exact())),
// nbh_(topo.exact().neighborhood())
// {
// precondition(nbh_.card() > 0);
// this->invalidate();
// }
// template <typename P, typename N>