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

2006-09-18 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>

	Rename bbox point iterators.
	
	* oln/core/abstract/iterator_on_points.hh
	(p_): Remove.  Abstract classes should not have attributes.
	(to_point): Turn abstract.
	(point_adr): New.
	* oln/core/gen/fwd_piter.hh: Update and rename as...
	* oln/core/gen/bbox_fwd_piter.hh: ...this.
	* oln/core/gen/bkd_piter.hh: Update and rename as...
	* oln/core/gen/bbox_bkd_piter.hh: ...this.
	* oln/core/2d/aliases.hh: Update.
	* oln/core/gen/bbox.hh: Update.
	* oln/basics2d.hh: Update.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@551 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 0a01ef5e
2006-09-18 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Rename bbox point iterators.
* oln/core/abstract/iterator_on_points.hh
(p_): Remove. Abstract classes should not have attributes.
(to_point): Turn abstract.
(point_adr): New.
* oln/core/gen/fwd_piter.hh: Update and rename as...
* oln/core/gen/bbox_fwd_piter.hh: ...this.
* oln/core/gen/bkd_piter.hh: Update and rename as...
* oln/core/gen/bbox_bkd_piter.hh: ...this.
* oln/core/2d/aliases.hh: Update.
* oln/core/gen/bbox.hh: Update.
* oln/basics2d.hh: Update.
2006-09-18 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Move some abstract classes below entries into internal.
......
......@@ -41,11 +41,11 @@ namespace oln { template class dpoint2d_<int>; }
# include <oln/core/gen/bbox.hh>
namespace oln { template class bbox_<point2d>; }
# include <oln/core/gen/fwd_piter.hh>
namespace oln { template class fwd_piter_<point2d>; }
# include <oln/core/gen/bbox_fwd_piter.hh>
namespace oln { template class bbox_fwd_piter_<point2d>; }
# include <oln/core/gen/bkd_piter.hh>
namespace oln { template class bkd_piter_<point2d>; }
# include <oln/core/gen/bbox_bkd_piter.hh>
namespace oln { template class bbox_bkd_piter_<point2d>; }
# include <oln/core/gen/topo_bbox.hh>
namespace oln { template class topo_bbox_<point2d>; }
......
......@@ -39,8 +39,8 @@ namespace oln
template <typename C> class dpoint2d_;
template <typename P> class bbox_;
template <typename P> class topo_bbox_;
template <typename P> class fwd_piter_;
template <typename P> class bkd_piter_;
template <typename P> class bbox_fwd_piter_;
template <typename P> class bbox_bkd_piter_;
class grid2d;
/// \}
......@@ -51,8 +51,8 @@ namespace oln
typedef dpoint2d_<int> dpoint2d;
typedef bbox_<point2d> bbox2d;
typedef fwd_piter_<point2d> fwd_piter2d;
typedef bkd_piter_<point2d> bkd_piter2d;
typedef bbox_fwd_piter_<point2d> fwd_piter2d;
typedef bbox_bkd_piter_<point2d> bkd_piter2d;
typedef topo_bbox_<point2d> topo2d;
typedef point2d_<float> point2df;
......
......@@ -68,22 +68,26 @@ namespace oln
public:
operator point_t() const
point_t to_point() const
{
precondition(this->is_valid());
return p_;
return this->exact().impl_to_point();
}
point_t to_point() const
const point_t* point_adr() const
{
return this->exact().impl_point_adr();
}
// Concrete method.
operator point_t() const
{
precondition(this->is_valid());
return p_;
return this->to_point();
}
protected:
point_t p_;
iterator_on_points()
{
}
......
......@@ -38,8 +38,8 @@ namespace oln
// Forward declarations.
template <typename point> class bbox_;
template <typename point> class fwd_piter_;
template <typename point> class bkd_piter_;
template <typename point> class bbox_fwd_piter_;
template <typename point> class bbox_bkd_piter_;
// Super type declaration.
......@@ -56,8 +56,8 @@ namespace oln
struct vtypes< bbox_<point> >
{
typedef point point_type;
typedef fwd_piter_<point> fwd_piter_type;
typedef bkd_piter_<point> bkd_piter_type;
typedef bbox_fwd_piter_<point> fwd_piter_type;
typedef bbox_bkd_piter_<point> bkd_piter_type;
typedef bbox_<point> bbox_type;
......
......@@ -26,8 +26,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLENA_CORE_GEN_BKD_PITER_HH
# define OLENA_CORE_GEN_BKD_PITER_HH
#ifndef OLENA_CORE_GEN_BBOX_BKD_PITER_HH
# define OLENA_CORE_GEN_BBOX_BKD_PITER_HH
# include <oln/core/abstract/iterator_on_points.hh>
# include <oln/core/abstract/point.hh>
......@@ -39,21 +39,21 @@ namespace oln
// Forward declaration.
template <typename point> class bkd_piter_;
template <typename point> class bbox_bkd_piter_;
// Super type declaration.
template <typename point>
struct set_super_type< bkd_piter_<point> >
struct set_super_type< bbox_bkd_piter_<point> >
{
typedef bkd_piter_<point> self_t;
typedef bbox_bkd_piter_<point> self_t;
typedef abstract::iterator_on_points<self_t> ret;
};
/// Virtual types associated to oln::bbox_<point>.
template <typename point>
struct vtypes< bkd_piter_<point> >
struct vtypes< bbox_bkd_piter_<point> >
{
typedef point point_type;
typedef oln_type_of(point, grid) grid_type;
......@@ -63,18 +63,17 @@ namespace oln
/// Abstract forward point iterator class.
template <typename point>
class bkd_piter_ : public abstract::iterator_on_points< bkd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
class bbox_bkd_piter_ : public abstract::iterator_on_points< bbox_bkd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef bkd_piter_<point> self_t;
typedef bbox_bkd_piter_<point> self_t;
typedef abstract::iterator_on_points<self_t> super_t;
using super_t::p_;
public:
bkd_piter_(const bbox_<point>& bb)
: bb_(bb)
bbox_bkd_piter_(const bbox_<point>& bb)
: p_(),
bb_(bb)
{
nop_ = bb_.pmin();
--nop_[0];
......@@ -118,15 +117,26 @@ namespace oln
return p_ != nop_;
}
point impl_to_point() const
{
return p_;
}
const point* impl_point_adr() const
{
return &p_;
}
protected:
point p_;
bbox_<point> bb_;
point nop_;
}; // end of class oln::bkd_piter_<point>
}; // end of class oln::bbox_bkd_piter_<point>
} // end of namespace oln
#endif // ! OLENA_CORE_GEN_BKD_PITER_HH
#endif // ! OLENA_CORE_GEN_BBOX_BKD_PITER_HH
......@@ -26,8 +26,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLENA_CORE_GEN_FWD_PITER_HH
# define OLENA_CORE_GEN_FWD_PITER_HH
#ifndef OLENA_CORE_GEN_BBOX_FWD_PITER_HH
# define OLENA_CORE_GEN_BBOX_FWD_PITER_HH
# include <oln/core/abstract/iterator_on_points.hh>
# include <oln/core/abstract/point.hh>
......@@ -39,21 +39,21 @@ namespace oln
// Forward declaration.
template <typename point> class fwd_piter_;
template <typename point> class bbox_fwd_piter_;
// Super type declaration.
template <typename point>
struct set_super_type< fwd_piter_<point> >
struct set_super_type< bbox_fwd_piter_<point> >
{
typedef fwd_piter_<point> self_t;
typedef bbox_fwd_piter_<point> self_t;
typedef abstract::iterator_on_points<self_t> ret;
};
/// Virtual types associated to oln::fwd_piter_<point>.
/// Virtual types associated to oln::bbox_fwd_piter_<point>.
template <typename point>
struct vtypes< fwd_piter_<point> >
struct vtypes< bbox_fwd_piter_<point> >
{
typedef point point_type;
typedef oln_type_of(point, grid) grid_type;
......@@ -63,25 +63,24 @@ namespace oln
/// Abstract forward point iterator class.
template <typename point>
class fwd_piter_ : public abstract::iterator_on_points< fwd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
class bbox_fwd_piter_ : public abstract::iterator_on_points< bbox_fwd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef fwd_piter_<point> self_t;
typedef bbox_fwd_piter_<point> self_t;
typedef abstract::iterator_on_points<self_t> super_t;
using super_t::p_;
public:
fwd_piter_(const bbox_<point>& bb)
: bb_(bb)
bbox_fwd_piter_(const bbox_<point>& bb)
: p_(),
bb_(bb)
{
nop_ = bb_.pmax();
++nop_[0];
}
// template <typename T>
// fwd_piter_(const abstract::topo<T>& t)
// bbox_fwd_piter_(const abstract::topo<T>& t)
// {
// mlc::assert_< mlc_is_a(T, abstract::topo_with_bbox) >::check();
// bb_ = t.exact().bbox();
......@@ -90,7 +89,7 @@ namespace oln
// }
// template <typename Data>
// fwd_piter_(const Data& data)
// bbox_fwd_piter_(const Data& data)
// : bb_(data.bbox())
// {
// nop_ = bb_.pmax();
......@@ -135,6 +134,16 @@ namespace oln
return p_ != nop_;
}
point impl_to_point() const
{
return p_;
}
const point* impl_point_adr() const
{
return &p_;
}
void print(std::ostream& ostr) const
{
ostr << "{ bb=" << bb_
......@@ -144,7 +153,7 @@ namespace oln
}
friend
std::ostream& operator<<(std::ostream& ostr, const fwd_piter_<point>& i)
std::ostream& operator<<(std::ostream& ostr, const bbox_fwd_piter_<point>& i)
{
i.print(ostr);
return ostr;
......@@ -152,13 +161,14 @@ namespace oln
protected:
point p_;
bbox_<point> bb_;
point nop_;
}; // end of class oln::fwd_piter_<point>
}; // end of class oln::bbox_fwd_piter_<point>
} // end of namespace oln
#endif // ! OLENA_CORE_GEN_FWD_PITER_HH
#endif // ! OLENA_CORE_GEN_BBOX_FWD_PITER_HH
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