Commit 1f303fb1 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

2006-10-05 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>

	Decouple iterators from image topology; update neighborhood tools
	and start to add window tools.
	
	* oln/core/automatic/topology_having_subset.hh: New.
	* oln/core/abstract/topology_having_subset.hh: New.
	* oln/core/gen/fwd_niter_neighb.hh: New.
	* oln/core/gen/fwd_qiter_win.hh: New.
	* oln/core/gen/window.hh: New.
	* oln/core/typedefs.hh
	(qiter_type, fwd_qiter_type, bkd_qiter_type): Uncomment.
	(niter_type, fwd_niter_type, bkd_niter_type): Uncomment.
	(isubset): Rename into...
	(subset_type): ...this.
	* oln/core/macros.hh
	(oln_type_of, oln_deduce_type_of, oln_type_of_): Rely on direct access.
	(oln_check_type_of, oln_check_type_of_): Rely on direct access.
	(oln_deduce_direct_type_of): New.
	* oln/core/topology_entry.hh (subset_type): New.
	* oln/core/image_entry.hh (fwd_piter_type, bkd_piter_type): Move
	from vtypes to single_vtype.
	(fwd_qiter_type): New.
	* oln/core/abstract/topology_hierarchies.hh
	(topology_hierarchy_wrt_subset): New.
	(include): Add topology_having_subset.hh.
	* oln/core/abstract/image/neighborhood/hierarchy.hh
	(niter, fwd_niter, bkd_niter): New in decl.
	* oln/core/2d/aliases.hh
	(fwd_piter_bbox_, bkd_piter_bbox_): Change param letter.
	(fwd_piter2d, bkd_piter2d): Update.
	* oln/core/2d/neighb2d.hh (c4, c8, c2_row, c2_col): Rename into...
	(mk_c4, mk_c8, mk_c2_row, mk_c2_col): ...these in namespace internal.
	(c4, c8, c2r, c2c): New objects.
	* oln/core/gen/piter_isubset.hh (piter_isubset_): New ctor for
	iterators around a point.
	(topo): Return a copy.
	(change_topology_): Remove; obsolete.
	* oln/core/gen/topo_add_isubset.hh (isubset_type): Rename into...
	(subset_type): ...this.
	(isubset): Rename into...
	(impl_subset): ...this.
	* oln/core/gen/topo_bbox.hh (impl_lbbox): New; experimental!
	* oln/core/gen/fwd_piter_bbox.hh (fwd_piter_bbox_): Change parameter
	from topo to point; update.
	(topo): Remove this method; obsolete.
	(change_topology_): Remove; obsolete.
	(topo_): Remove this attribute; obsolete.
	* oln/core/gen/bkd_piter_bbox.hh: Likewise.
	* oln/basics2d.hh: Update.
	* oln/Makefile.am (nobase_oln_HEADERS): Update.
	* oln/core/2d/image2d.hh
	(fwd_piter_type, bkd_piter_type): Move these definitions into...
	* oln/core/fwd_piter.hh: ... this new file.
	* oln/morpher/add_isubset.hh: Likewise.
	* oln/morpher/add_neighborhood.hh: Likewise.
	* oln/morpher/internal/image_extension.hh (image_): Change from
	const& to plain type.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@607 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent e145418e
2006-10-05 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Decouple iterators from image topology; update neighborhood tools
and start to add window tools.
* oln/core/automatic/topology_having_subset.hh: New.
* oln/core/abstract/topology_having_subset.hh: New.
* oln/core/gen/fwd_niter_neighb.hh: New.
* oln/core/gen/fwd_qiter_win.hh: New.
* oln/core/gen/window.hh: New.
* oln/core/typedefs.hh
(qiter_type, fwd_qiter_type, bkd_qiter_type): Uncomment.
(niter_type, fwd_niter_type, bkd_niter_type): Uncomment.
(isubset): Rename into...
(subset_type): ...this.
* oln/core/macros.hh
(oln_type_of, oln_deduce_type_of, oln_type_of_): Rely on direct access.
(oln_check_type_of, oln_check_type_of_): Rely on direct access.
(oln_deduce_direct_type_of): New.
* oln/core/topology_entry.hh (subset_type): New.
* oln/core/image_entry.hh (fwd_piter_type, bkd_piter_type): Move
from vtypes to single_vtype.
(fwd_qiter_type): New.
* oln/core/abstract/topology_hierarchies.hh
(topology_hierarchy_wrt_subset): New.
(include): Add topology_having_subset.hh.
* oln/core/abstract/image/neighborhood/hierarchy.hh
(niter, fwd_niter, bkd_niter): New in decl.
* oln/core/2d/aliases.hh
(fwd_piter_bbox_, bkd_piter_bbox_): Change param letter.
(fwd_piter2d, bkd_piter2d): Update.
* oln/core/2d/neighb2d.hh (c4, c8, c2_row, c2_col): Rename into...
(mk_c4, mk_c8, mk_c2_row, mk_c2_col): ...these in namespace internal.
(c4, c8, c2r, c2c): New objects.
* oln/core/gen/piter_isubset.hh (piter_isubset_): New ctor for
iterators around a point.
(topo): Return a copy.
(change_topology_): Remove; obsolete.
* oln/core/gen/topo_add_isubset.hh (isubset_type): Rename into...
(subset_type): ...this.
(isubset): Rename into...
(impl_subset): ...this.
* oln/core/gen/topo_bbox.hh (impl_lbbox): New; experimental!
* oln/core/gen/fwd_piter_bbox.hh (fwd_piter_bbox_): Change parameter
from topo to point; update.
(topo): Remove this method; obsolete.
(change_topology_): Remove; obsolete.
(topo_): Remove this attribute; obsolete.
* oln/core/gen/bkd_piter_bbox.hh: Likewise.
* oln/basics2d.hh: Update.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
* oln/core/2d/image2d.hh
(fwd_piter_type, bkd_piter_type): Move these definitions into...
* oln/core/fwd_piter.hh: ... this new file.
* oln/morpher/add_isubset.hh: Likewise.
* oln/morpher/add_neighborhood.hh: Likewise.
* oln/morpher/internal/image_extension.hh (image_): Change from
const& to plain type.
2006-10-03 Roland Levillain <roland@lrde.epita.fr>
Fix the distribution.
......
......@@ -82,6 +82,7 @@ nobase_oln_HEADERS = \
core/abstract/topology_being_random_accessible.hh \
core/abstract/topology_having_bbox.hh \
core/abstract/topology_having_neighborhood.hh \
core/abstract/topology_having_subset.hh \
core/abstract/topology_hierarchies.hh \
\
core/automatic/image.hh \
......@@ -93,17 +94,23 @@ nobase_oln_HEADERS = \
core/automatic/topology_being_random_accessible.hh \
core/automatic/topology_having_bbox.hh \
core/automatic/topology_having_neighborhood.hh \
core/automatic/topology_having_subset.hh \
\
core/fwd_piter.hh \
\
core/gen/bbox.hh \
core/gen/bbox_bkd_piter.hh \
core/gen/bbox_fwd_piter.hh \
core/gen/bkd_piter_bbox.hh \
core/gen/fwd_niter_neighb.hh \
core/gen/fwd_piter_bbox.hh \
core/gen/fwd_qiter_win.hh \
core/gen/mapimage.hh \
core/gen/neighb.hh \
core/gen/topo_add_nbh.hh \
core/gen/topo_bbox.hh \
core/gen/topo_lbbox.hh \
core/gen/window.hh \
\
core/internal/bbox_bkd_piter.hh \
core/internal/bbox_fwd_piter.hh \
......
......@@ -47,10 +47,10 @@ namespace oln { template class bbox_<point2d>; }
namespace oln { template class topo_lbbox_<point2d>; }
# include <oln/core/gen/fwd_piter_bbox.hh>
namespace oln { template class fwd_piter_bbox_<topo2d>; }
namespace oln { template class fwd_piter_bbox_<point2d>; }
# include <oln/core/gen/bkd_piter_bbox.hh>
namespace oln { template class bkd_piter_bbox_<topo2d>; }
namespace oln { template class bkd_piter_bbox_<point2d>; }
# include <oln/core/gen/neighb.hh>
namespace oln { template class neighb_<dpoint2d>; }
......
......@@ -40,8 +40,8 @@ namespace oln
template <typename D> class neighb_;
template <typename P> class bbox_;
template <typename P> class topo_lbbox_;
template <typename T> class fwd_piter_bbox_;
template <typename T> class bkd_piter_bbox_;
template <typename P> class fwd_piter_bbox_;
template <typename P> class bkd_piter_bbox_;
class grid2d;
/// \}
......@@ -55,8 +55,8 @@ namespace oln
typedef bbox_<point2d> bbox2d;
typedef topo_lbbox_<point2d> topo2d;
typedef fwd_piter_bbox_<topo2d> fwd_piter2d;
typedef bkd_piter_bbox_<topo2d> bkd_piter2d;
typedef fwd_piter_bbox_<point2d> fwd_piter2d;
typedef bkd_piter_bbox_<point2d> bkd_piter2d;
typedef point2d_<float> point2df;
typedef dpoint2d_<float> dpoint2df;
......
......@@ -50,10 +50,7 @@ namespace oln
typedef grid2d grid_type;
typedef point2d point_type;
typedef fwd_piter_bbox_<topo_type> fwd_piter_type;
typedef bkd_piter_bbox_<topo_type> bkd_piter_type;
typedef T value_type;
typedef T lvalue_type;
typedef mlc::true_ is_mutable_type;
......
......@@ -37,64 +37,72 @@ namespace oln
{
neighb2d c4()
namespace internal
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(0, 1))
.add(dpoint2d(1, 0));
flower = false;
}
return the_;
}
neighb2d c8()
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(0, 1))
.add(dpoint2d(1,-1))
.add(dpoint2d(1, 0))
.add(dpoint2d(1, 1));
flower = false;
}
return the_;
}
neighb2d c2_row()
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(0, 1));
flower = false;
}
return the_;
}
neighb2d c2_col()
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(1, 0));
flower = false;
}
return the_;
}
neighb2d mk_c4()
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(0, 1))
.add(dpoint2d(1, 0));
flower = false;
}
return the_;
}
neighb2d mk_c8()
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(0, 1))
.add(dpoint2d(1,-1))
.add(dpoint2d(1, 0))
.add(dpoint2d(1, 1));
flower = false;
}
return the_;
}
neighb2d mk_c2_row()
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(0, 1));
flower = false;
}
return the_;
}
neighb2d mk_c2_col()
{
static bool flower = true;
static neighb2d the_;
if (flower)
{
the_
.add(dpoint2d(1, 0));
flower = false;
}
return the_;
}
} // end of namespace oln::internal
static const neighb2d c4 = internal::mk_c4();
static const neighb2d c8 = internal::mk_c8();
static const neighb2d c2r = internal::mk_c2_row();
static const neighb2d c2c = internal::mk_c2_col();
} // end of namespace oln
......
......@@ -65,9 +65,9 @@ namespace oln
public:
struct decl {
// FIXME: Uncomment.
// stc_virtual_typedef(fwd_niter);
// stc_virtual_typedef(bkd_niter);
// stc_virtual_typedef(niter);
stc_virtual_typedef(fwd_niter);
stc_virtual_typedef(bkd_niter);
};
const neighborhood_t& neighborhood() const
......
// 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_TOPOLOGY_HAVING_SUBSET_HH
# define OLN_CORE_ABSTRACT_TOPOLOGY_HAVING_SUBSET_HH
# include <oln/core/abstract/topology.hh>
# include <oln/core/automatic/topology_having_subset.hh>
namespace oln
{
namespace abstract
{
template <typename E>
class topology_having_subset
: public virtual topology<E>,
public automatic::get_impl<topology_having_subset, E>
{
typedef oln_type_of(E, subset) subset_t;
public:
// abstract
const subset_t& subset() const
{
return this->exact().impl_subset();
}
protected:
topology_having_subset()
{}
};
} // end of namespace oln::abstract
template <typename E>
struct case_ < topology_hierarchy_wrt_subset, E, 1 >
: where_< mlc::neq_< oln_type_of(E, subset), mlc::none > >
{
typedef abstract::topology_having_subset<E> ret;
};
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_TOPOLOGY_HAVING_SUBSET_HH
......@@ -37,6 +37,7 @@ namespace oln
typedef hierarchy< abstract::topology, 1 > topology_hierarchy_wrt_accessibility;
typedef hierarchy< abstract::topology, 2 > topology_hierarchy_wrt_bbox;
typedef hierarchy< abstract::topology, 3 > topology_hierarchy_wrt_neighborhood;
typedef hierarchy< abstract::topology, 4 > topology_hierarchy_wrt_subset;
} // end of namespace oln
......@@ -47,9 +48,12 @@ namespace oln
// Hierarchy 2: topology w.r.t. bounding box.
# include <oln/core/abstract/topology_having_bbox.hh>
// Hierarchy 2: topology w.r.t. neighborhood.
// Hierarchy 3: topology w.r.t. neighborhood.
# include <oln/core/abstract/topology_having_neighborhood.hh>
// Hierarchy 4: topology w.r.t. neighborhood.
# include <oln/core/abstract/topology_having_subset.hh>
#endif // ! OLN_CORE_ABSTRACT_TOPOLOGY_HIERARCHIES_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_AUTOMATIC_TOPOLOGY_HAVING_SUBSET_HH
# define OLN_CORE_AUTOMATIC_TOPOLOGY_HAVING_SUBSET_HH
# include <oln/core/automatic/impl.hh>
# include <oln/morpher/tags.hh>
namespace oln
{
// Forward declaration.
namespace abstract
{
template <typename E> class topology_having_subset;
} // end of namespace oln::abstract
namespace automatic
{
/// Implementation corresponding to the interface
/// oln::abstract::topology_having_subset for an identity morpher.
template <typename E>
class set_impl< abstract::topology_having_subset,
morpher::tag::identity,
E > :
public virtual stc::any__simple<E>
{
private:
typedef oln_type_of(E, subset) subset_t;
public:
const subset_t& impl_subset() const
{
return this->exact().delegate().subset();
}
};
} // end of namespace oln::automatic
} // end of namespace oln
#endif // ! OLN_CORE_AUTOMATIC_TOPOLOGY_HAVING_SUBSET_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_FWD_PITER_HH
# define OLN_CORE_FWD_PITER_HH
# include <oln/core/abstract/entry.hh>
# include <oln/core/abstract/image.hh>
namespace oln
{
// morpher::add_isubset<Image, Isubset>
namespace morpher {
template <typename Image, typename Isubset> struct add_isubset;
}
template <typename piter_t, typename isubset_t> class piter_isubset_;
template <typename Image, typename Isubset>
struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_piter_type >
{
typedef piter_isubset_<oln_type_of(Image, fwd_piter), Isubset> ret;
};
template <typename Image, typename Isubset>
struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_piter_type >
{
typedef piter_isubset_<oln_type_of(Image, bkd_piter), Isubset> ret;
};
template <typename Image, typename Isubset>
struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_qiter_type >
{
typedef piter_isubset_<oln_type_of(Image, fwd_qiter), Isubset> ret;
};
template <typename Image, typename Isubset>
struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_qiter_type >
{
typedef piter_isubset_<oln_type_of(Image, bkd_qiter), Isubset> ret;
};
template <typename Image, typename Isubset>
struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_niter_type >
{
typedef piter_isubset_<oln_type_of(Image, fwd_niter), Isubset> ret;
};
template <typename Image, typename Isubset>
struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_niter_type >
{
typedef piter_isubset_<oln_type_of(Image, bkd_niter), Isubset> ret;
};
// morpher::add_neighborhood<Image, Isubset>
namespace morpher {
template <typename Image, typename Neighb> struct add_neighborhood;
}
template <typename point_t> class fwd_niter_neighb_;
template <typename Image, typename Neighb>
struct single_vtype< morpher::add_neighborhood<Image, Neighb>, typedef_::fwd_niter_type >
{
private:
typedef oln_type_of(Image, point) point_t;
public:
typedef fwd_niter_neighb_<point_t> ret;
};
template <typename Image, typename Neighb>
struct single_vtype< morpher::add_neighborhood<Image, Neighb>, typedef_::bkd_niter_type >
{
private:
typedef oln_type_of(Image, point) point_t;
public:
typedef fwd_niter_neighb_<point_t> ret; // FIXME: should be bkd but not yet impled!
};
// image2d<T>
template <typename T> class image2d;
template <typename T>
struct single_vtype< image2d<T>, typedef_::fwd_piter_type >
{
typedef fwd_piter2d ret;
};
template <typename T>
struct single_vtype< image2d<T>, typedef_::bkd_piter_type >
{
typedef bkd_piter2d ret;
};
} // end of namespace oln
#endif // ! OLN_CORE_FWD_PITER_HH
......@@ -30,6 +30,7 @@
# define OLN_CORE_GEN_BKD_PITER_BBOX_HH
# include <oln/core/abstract/topology.hh>
# include <oln/core/abstract/point.hh>
# include <oln/core/internal/bbox_bkd_piter.hh>
......@@ -38,75 +39,58 @@ namespace oln
// Forward declaration.
template <typename topo> class bkd_piter_bbox_;
template <typename point_t> class bkd_piter_bbox_;
// Super type declaration.
template <typename topo>
struct set_super_type< bkd_piter_bbox_<topo> >
template <typename point_t>
struct set_super_type< bkd_piter_bbox_<point_t> >
{
typedef bkd_piter_bbox_<topo> self_t;
typedef bkd_piter_bbox_<point_t> self_t;
typedef internal::