Commit 64b780e2 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Cleaning point set classes.

	* oln/core/point_set_entry.hh: Rename as...
	* oln/core/internal/point_set_base.hh: ...this and update.
	* oln/core/abstract/point_set.hh: Rename as...
	* oln/core/concept/point_set.hh: ...this and update.
	* oln/core/abstract/iterator.hh: Rename as...
	* oln/core/concept/iterator.hh: ...this and update.
	* oln/core/abstract/iterator_on_points.hh: Rename as...
	* oln/core/concept/iterator_on_points.hh: ...this and update.
	* oln/core/abstract/point_set/point_set_being_random_accessible.hh,
	* oln/core/abstract/point_set/point_set_having_known_size.hh,
	* oln/core/abstract/point_set/hierarchies.hh,
	* oln/core/abstract/point_set/all.hh,
	* oln/core/abstract/point_set/point_set_being_connected.hh,
	* oln/core/abstract/point_set/point_set_having_bbox.hh: Remove.
	* oln/core/gen/bbox.hh: Split and rename as...
	* oln/core/gen/box.hh: ...this and update...
	* oln/core/gen/fbbox.hh: ...and this and update.
	* oln/core/gen/bbox_fwd_piter.hh,
	* oln/core/gen/bbox_bkd_piter.hh: Remove because merge with...
	* oln/core/gen/box.hh: ...this.
	* oln/core/gen/pset_.hh: Rename as...
	* oln/core/gen/pset.hh: ...this and update.
	* oln/core/gen/pset_list.hh: Rename as...
	* oln/core/gen/plist.hh: ...this and update.
	* oln/core/gen/pset_vec.hh: Rename as...
	* oln/core/gen/pvec.hh: ...this and update.
	* oln/core/gen/piter_on_std_based_pset.hh: Rename as...
	* oln/core/internal/point_set_std_based.hh: ...this and update.
	* oln/core/2d/aliases.hh: Update.
	* oln/core/equipment.hh: Update.
	* oln/core/2d/box2d.hh: New.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@844 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 2689d29e
2007-03-05 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Cleaning point set classes.
* oln/core/point_set_entry.hh: Rename as...
* oln/core/internal/point_set_base.hh: ...this and update.
* oln/core/abstract/point_set.hh: Rename as...
* oln/core/concept/point_set.hh: ...this and update.
* oln/core/abstract/iterator.hh: Rename as...
* oln/core/concept/iterator.hh: ...this and update.
* oln/core/abstract/iterator_on_points.hh: Rename as...
* oln/core/concept/iterator_on_points.hh: ...this and update.
* oln/core/abstract/point_set/point_set_being_random_accessible.hh,
* oln/core/abstract/point_set/point_set_having_known_size.hh,
* oln/core/abstract/point_set/hierarchies.hh,
* oln/core/abstract/point_set/all.hh,
* oln/core/abstract/point_set/point_set_being_connected.hh,
* oln/core/abstract/point_set/point_set_having_bbox.hh: Remove.
* oln/core/gen/bbox.hh: Split and rename as...
* oln/core/gen/box.hh: ...this and update...
* oln/core/gen/fbbox.hh: ...and this and update.
* oln/core/gen/bbox_fwd_piter.hh,
* oln/core/gen/bbox_bkd_piter.hh: Remove because merge with...
* oln/core/gen/box.hh: ...this.
* oln/core/gen/pset_.hh: Rename as...
* oln/core/gen/pset.hh: ...this and update.
* oln/core/gen/pset_list.hh: Rename as...
* oln/core/gen/plist.hh: ...this and update.
* oln/core/gen/pset_vec.hh: Rename as...
* oln/core/gen/pvec.hh: ...this and update.
* oln/core/gen/piter_on_std_based_pset.hh: Rename as...
* oln/core/internal/point_set_std_based.hh: ...this and update.
* oln/core/2d/aliases.hh: Update.
* oln/core/equipment.hh: Update.
* oln/core/2d/box2d.hh: New.
2007-03-02 Thierry Geraud <theo@lrde.epita.fr>
Start cleaning so the trunk is BROKEN for several weeks.
......
......@@ -35,12 +35,8 @@ namespace oln
/// Forward declarations.
/// \{
template <unsigned D> struct grid_;
template <typename C> class point2d_;
template <typename C> class dpoint2d_;
template <typename D> class neighb_;
template <typename D> class window_;
template <typename P> class bbox_;
template <typename P> class topo_lbbox_;
template <typename P> class fwd_piter_bbox_;
template <typename P> class bkd_piter_bbox_;
......@@ -51,15 +47,10 @@ namespace oln
/// Aliases.
/// \{
typedef grid_<2> grid2d;
typedef point2d_<int> point2d;
typedef dpoint2d_<int> dpoint2d;
typedef neighb_<dpoint2d> neighb2d;
typedef window_<dpoint2d> window2d;
typedef bbox_<point2d> bbox2d;
typedef topo_lbbox_<point2d> topo2d;
typedef fwd_piter_bbox_<point2d> fwd_piter2d;
......@@ -68,8 +59,6 @@ namespace oln
typedef fwd_qiter_win_<point2d> fwd_qiter2d;
typedef bkd_qiter_win_<point2d> bkd_qiter2d;
typedef point2d_<float> point2df;
typedef dpoint2d_<float> dpoint2df;
/// \}
......
// Copyright (C) 2006 EPITA Research and Development Laboratory
// 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
......@@ -25,23 +25,20 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLN_CORE_ABSTRACT_POINT_SET_HIERARCHIES_HH
# define OLN_CORE_ABSTRACT_POINT_SET_HIERARCHIES_HH
#ifndef OLN_CORE_2D_BOX2D_HH
# define OLN_CORE_2D_BOX2D_HH
# include <oln/core/abstract/entry.hh>
# include <oln/core/abstract/point_set.hh>
# include <oln/core/gen/box.hh>
# include <oln/core/2d/point2d.hh>
namespace oln
{
typedef hierarchy< abstract::point_set, 1 > point_set_hierarchy_wrt_known_size;
typedef hierarchy< abstract::point_set, 2 > point_set_hierarchy_wrt_accessibility;
typedef hierarchy< abstract::point_set, 3 > point_set_hierarchy_wrt_bbox;
typedef hierarchy< abstract::point_set, 4 > point_set_hierarchy_wrt_connectivity;
typedef box_<point2d> box2d;
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_POINT_SET_HIERARCHIES_HH
#endif // ! OLN_CORE_2D_BOX2D_HH
// Copyright (C) 2001, 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_CORE_ABSTRACT_ITERATOR_ON_POINTS_HH
# define OLN_CORE_ABSTRACT_ITERATOR_ON_POINTS_HH
# include <oln/core/abstract/iterator.hh>
# include <oln/core/abstract/point.hh>
namespace oln
{
// Forward declaration.
namespace abstract { template <typename E> class iterator_on_points; }
// Super type declaration.
template <typename E>
struct set_super_type< abstract::iterator_on_points<E> >
{
typedef abstract::iterator<E> ret;
};
/// Virtual types associated to abstract::iterator_on_points<E>.
template <typename E>
struct vtypes< abstract::iterator_on_points<E> >
{
typedef stc::abstract point_type;
# ifndef OLENA_USE_SCOOP_ALT
typedef oln_deduce_deferred_vtype(E, point, coord) coord_type;
# endif // !OLENA_USE_SCOOP_ALT
};
# ifdef OLENA_USE_SCOOP_ALT
template <typename E>
struct single_vtype< abstract::iterator_on_points<E>,
typedef_::coord_type >
{
typedef oln_deduce_deferred_vtype(E, point, coord) ret;
};
# endif // OLENA_USE_SCOOP_ALT
namespace abstract
{
/// Abstract point iterator class.
template <typename E>
class iterator_on_points : public abstract::iterator<E>
{
typedef oln_point(E) point_t;
public:
point_t to_point() const;
const point_t* point_adr() const;
// Concrete method.
operator point_t() const;
protected:
iterator_on_points();
~iterator_on_points();
}; // end of class oln::abstract::iterator_on_points<E>
template <typename E>
std::ostream& operator<<(std::ostream& ostr, const iterator_on_points<E>& pit);
# ifndef OLN_INCLUDE_ONLY
template <typename E>
typename iterator_on_points<E>::point_t
iterator_on_points<E>::to_point() const
{
precondition(this->is_valid());
return this->exact().impl_to_point();
}
template <typename E>
const typename iterator_on_points<E>::point_t*
iterator_on_points<E>::point_adr() const
{
return this->exact().impl_point_adr();
}
template <typename E>
// Concrete method.
iterator_on_points<E>::operator typename iterator_on_points<E>::point_t() const
{
precondition(this->is_valid());
return this->to_point();
}
template <typename E>
iterator_on_points<E>::iterator_on_points()
{
}
template <typename E>
iterator_on_points<E>::~iterator_on_points()
{
mlc::assert_defined_< typename iterator_on_points<E>::point_t >::check();
mlc::assert_< mlc_is_a(typename iterator_on_points<E>::point_t, abstract::point) >::check();
}
template <typename E>
std::ostream& operator<<(std::ostream& ostr, const iterator_on_points<E>& pit)
{
return ostr << pit.to_point();
}
# endif
} // end of namespace oln::abstract
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_ITERATOR_ON_POINTS_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_POINT_SET_HH
# define OLN_CORE_ABSTRACT_POINT_SET_HH
# include <oln/core/typedefs.hh>
namespace oln
{
namespace abstract
{
/// Abstract point class.
template <typename E>
class point_set : public virtual stc::any__simple<E>,
public virtual oln::type
{
public:
bool is_valid() const;
struct decl
{
oln_virtual_typedef(point);
oln_virtual_typedef(piter);
oln_virtual_typedef(fwd_piter);
oln_virtual_typedef(bkd_piter);
oln_virtual_typedef(bbox); // provides .bbox()
oln_virtual_typedef(is_random_accessible); // provides .has(p)
oln_virtual_typedef(has_known_size); // provides .npoints()
oln_virtual_typedef(is_connected); // provides, e.g., .nrows()
// derived from point:
oln_virtual_typedef(coord);
oln_virtual_typedef(grid);
oln_virtual_typedef(dim);
decl();
};
~point_set();
protected:
point_set();
}; // end of class oln::abstract::point_set<E>
# ifndef OLN_INCLUDE_ONLY
template <typename E>
bool point_set<E>::is_valid() const
{
return this->exact().impl_is_valid();
}
template <typename E>
point_set<E>::decl::decl()
{
// coherence check:
// FIXME: Rec?
// mlc::assert_equal_< oln_grid(fwd_piter), oln_grid(point) >::check();
// mlc::assert_equal_< oln_grid(bkd_piter), oln_grid(point) >::check();
}
template <typename E>
point_set<E>::point_set()
{
}
template <typename E>
point_set<E>::~point_set()
{
decl();
}
# endif
} // end of namespace oln::abstract
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_POINT_SET_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_POINT_SET_ALL_HH
# define OLN_CORE_ABSTRACT_POINT_SET_ALL_HH
# include <oln/core/abstract/point_set.hh>
# include <oln/core/abstract/point_set/hierarchies.hh>
// Hierarchy 1: point set w.r.t. size.
# include <oln/core/abstract/point_set/point_set_having_known_size.hh>
// Hierarchy 2: point set w.r.t. accessibility.
# include <oln/core/abstract/point_set/point_set_being_random_accessible.hh>
// Hierarchy 3: point set w.r.t. bbox.
# include <oln/core/abstract/point_set/point_set_having_bbox.hh>
# include <oln/core/abstract/bbox.hh>
// Hierarchy 4: point set w.r.t. connexity.
# include <oln/core/abstract/point_set/point_set_being_connected.hh>
#endif // ! OLN_CORE_ABSTRACT_POINT_SET_ALL_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_POINT_SET_POINT_SET_BEING_CONNECTED_HH
# define OLN_CORE_ABSTRACT_POINT_SET_POINT_SET_BEING_CONNECTED_HH
# include <oln/core/abstract/point_set.hh>
# include <oln/core/abstract/point_set/hierarchies.hh>
namespace oln
{
namespace abstract
{
template <typename E>
class point_set_being_1d_connected : public virtual abstract::point_set<E>
{
public:
unsigned nindices() const;
protected:
point_set_being_1d_connected();
};
template <typename E>
class point_set_being_2d_connected : public virtual abstract::point_set<E>
{
public:
unsigned nrows() const;
unsigned ncols() const;
protected:
point_set_being_2d_connected();
};
template <typename E>
class point_set_being_3d_connected : public virtual abstract::point_set<E>
{
public:
unsigned nslices() const;
unsigned nrows() const;
unsigned ncols() const;
protected:
point_set_being_3d_connected();
};
# ifndef OLN_INCLUDE_ONLY
template <typename E>
unsigned point_set_being_1d_connected<E>::nindices() const
{
precondition(this->is_valid());
return this->exact().len(0);
}
template <typename E>
point_set_being_1d_connected<E>::point_set_being_1d_connected()
{
}
template <typename E>
unsigned point_set_being_2d_connected<E>::nrows() const
{
precondition(this->is_valid());
return this->exact().len(0);
}
template <typename E>
unsigned point_set_being_2d_connected<E>::ncols() const
{
precondition(this->is_valid());
return this->exact().len(1);
}
template <typename E>
point_set_being_2d_connected<E>::point_set_being_2d_connected()
{
}
template <typename E>
unsigned point_set_being_3d_connected<E>::nslices() const
{
precondition(this->is_valid());
return this->exact().len(0);
}
template <typename E>
unsigned point_set_being_3d_connected<E>::nrows() const
{
precondition(this->is_valid());
return this->exact().len(1);
}
template <typename E>
unsigned point_set_being_3d_connected<E>::ncols() const
{
precondition(this->is_valid());
return this->exact().len(2);
}
template <typename E>
point_set_being_3d_connected<E>::point_set_being_3d_connected()
{
}
# endif
} // end of namespace oln::abstract
// Forward declarations.
template <unsigned D> struct grid_;
typedef grid_<1> grid1d;
typedef grid_<2> grid2d;
typedef grid_<3> grid3d;
template <typename E>
struct case_ < point_set_hierarchy_wrt_connectivity, E, 1 >
: where_< mlc::and_list_<
mlc::neq_< oln_vtype(E, bbox), mlc::none >,
mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >,
mlc::eq_< oln_vtype(E, grid), grid1d >
> >
{
typedef abstract::point_set_being_1d_connected<E> ret;
};
template <typename E>
struct case_ < point_set_hierarchy_wrt_connectivity, E, 2 >
: where_< mlc::and_list_<
mlc::neq_< oln_vtype(E, bbox), mlc::none >,
mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >,