Commit 0a01ef5e authored by Thierry Geraud's avatar Thierry Geraud
Browse files

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

	Move some abstract classes below entries into internal.
	
	* oln/core/abstract/point_nd.hh: Update and rename as...
	* oln/core/internal/point_nd.hh: ...this.
	* oln/core/abstract/dpoint_nd.hh: Update and rename as...
	* oln/core/internal/dpoint_nd.hh: ...this.
	* oln/core/point_set_entry.hh (is_connected_type): Add in vtypes.
	* oln/core/abstract/bbox.hh: Change super class from point_set_entry
	to point_set_having_bbox.
	(vtypes): Remove.
	(set_super_type): Remove.
	* oln/core/abstract/point_set_hierarchies.hh (include): Update.
	* oln/core/abstract/point_set_having_bbox.hh (case_): Move to...
	* oln/core/abstract/bbox.hh: ...this file.
	(case_): Refine for abstract::bbox.
	* oln/core/2d/dpoint2d.hh: Update.
	* oln/core/2d/point2d.hh: Update.
	* oln/core/gen/bbox.hh: Update.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@550 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent a58172d2
2006-09-18 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Move some abstract classes below entries into internal.
* oln/core/abstract/point_nd.hh: Update and rename as...
* oln/core/internal/point_nd.hh: ...this.
* oln/core/abstract/dpoint_nd.hh: Update and rename as...
* oln/core/internal/dpoint_nd.hh: ...this.
* oln/core/point_set_entry.hh (is_connected_type): Add in vtypes.
* oln/core/abstract/bbox.hh: Change super class from point_set_entry
to point_set_having_bbox.
(vtypes): Remove.
(set_super_type): Remove.
* oln/core/abstract/point_set_hierarchies.hh (include): Update.
* oln/core/abstract/point_set_having_bbox.hh (case_): Move to...
* oln/core/abstract/bbox.hh: ...this file.
(case_): Refine for abstract::bbox.
* oln/core/2d/dpoint2d.hh: Update.
* oln/core/2d/point2d.hh: Update.
* oln/core/gen/bbox.hh: Update.
2006-09-18 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Rename point set related classes.
......
......@@ -30,7 +30,7 @@
# include <mlc/int.hh>
# include <oln/core/2d/point2d.hh>
# include <oln/core/abstract/dpoint_nd.hh>
# include <oln/core/internal/dpoint_nd.hh>
namespace oln
......@@ -45,7 +45,7 @@ namespace oln
// };
/// Virtual types associated to oln::abstract::image.
/// Virtual types associated to oln::dpoint2d_<C>.
template <typename C>
struct vtypes< dpoint2d_<C> >
{
......@@ -58,10 +58,10 @@ namespace oln
/// General 2D dpoint class.
template <typename C>
class dpoint2d_ : public abstract::dpoint_nd< dpoint2d_<C> > // FIXME: stc_get_super_(dpoint2d_<C>)
class dpoint2d_ : public internal::dpoint_nd< dpoint2d_<C> > // FIXME: stc_get_super_(dpoint2d_<C>)
{
typedef dpoint2d_<C> self_t;
typedef abstract::dpoint_nd<self_t> super_t; // FIXME: stc_get_super(self)
typedef internal::dpoint_nd<self_t> super_t; // FIXME: stc_get_super(self_t)
typedef oln_type_of(self_t, coord) coord_t;
using super_t::v_;
......
......@@ -29,7 +29,7 @@
# define OLENA_CORE_2D_POINT2D_HH
# include <mlc/int.hh>
# include <oln/core/abstract/point_nd.hh>
# include <oln/core/internal/point_nd.hh>
namespace oln
......@@ -43,7 +43,7 @@ namespace oln
/// \}
/// Virtual types associated to oln::abstract::image.
/// Virtual types associated to oln::point2d_<C>.
template <typename C>
struct vtypes< point2d_<C> >
{
......@@ -56,10 +56,10 @@ namespace oln
/// General 2D point class.
template <typename C>
class point2d_ : public abstract::point_nd< point2d_<C> > // FIXME: stc_get_super_(point2d_<C>)
class point2d_ : public internal::point_nd< point2d_<C> > // FIXME: stc_get_super_(point2d_<C>)
{
typedef point2d_<C> self_t;
typedef abstract::point_nd<self_t> super_t;
typedef internal::point_nd<self_t> super_t;
using super_t::v_;
......
......@@ -29,44 +29,20 @@
#ifndef OLENA_CORE_ABSTRACT_BBOX_HH
# define OLENA_CORE_ABSTRACT_BBOX_HH
# include <oln/core/point_set_entry.hh>
# include <oln/core/abstract/point_set_having_bbox.hh>
namespace oln
{
// Forward declaration.
namespace abstract { template <typename E> class bbox; }
// Super type declaration.
template <typename E>
struct set_super_type< abstract::bbox<E> >
{
typedef point_set_entry<E> ret;
};
/// Virtual types associated to oln::abstract::bbox<E>.
template <typename E>
struct vtypes< abstract::bbox<E> >
{
typedef mlc::true_ is_random_accessible_type;
typedef mlc::true_ has_know_size_type;
typedef mlc::true_ is_connected_type;
typedef E bbox_type;
};
namespace abstract
{
/// Abstract bbox (bounding box) class.
template <typename E>
class bbox : public point_set_entry<E>
class bbox : public point_set_having_bbox<E>
{
typedef oln_type_of(E, point) point_t;
public:
void print(std::ostream& ostr) const
......@@ -92,27 +68,27 @@ namespace oln
{
}
~bbox()
{
mlc::assert_defined_< point_t >::check();
}; // end of class oln::abstract::bbox<E>
// typedef oln_type_of(E, fwd_piter) fwd_piter_t;
// typedef oln_type_of(E, bkd_piter) bkd_piter_t;
// mlc::assert_defined_< fwd_piter_t >::check();
// mlc::assert_defined_< bkd_piter_t >::check();
} // end of namespace oln::abstract
// mlc::assert_< mlc::eq_< oln_type_of(fwd_piter_t, grid),
// oln_type_of(point_t, grid) > >::check();
// mlc::assert_< mlc::eq_< oln_type_of(bkd_piter_t, grid),
// oln_type_of(point_t, grid) > >::check();
}
}; // end of class oln::abstract::bbox<E>
template <typename E>
struct case_ < point_set_hierarchy_wrt_bbox, E, 1 >
: where_< mlc::eq_< oln_type_of(E, bbox), E > >
{
typedef abstract::bbox<E> ret;
};
} // end of namespace oln::abstract
template <typename E>
struct case_ < point_set_hierarchy_wrt_bbox, E, 2 >
: where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
{
typedef abstract::point_set_having_bbox<E> ret;
};
} // end of namespace oln
......
......@@ -55,6 +55,8 @@ namespace oln
return this->exact().impl_box();
}
// FIXME: attributes should be removed from this abstract class.
const point_t& pmin() const
{
precondition(this->is_valid());
......@@ -97,12 +99,8 @@ namespace oln
} // end of namespace oln::abstract
template <typename E>
struct case_ < point_set_hierarchy_wrt_bbox, E, 1 >
: where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
{
typedef abstract::point_set_having_bbox<E> ret;
};
// an abstract sub-class of point_set_having_bbox<E> is abstract::bbox<E>;
// the switch-case mechanism is in oln/core/abstract/bbox.hh
} // end of namespace oln
......
......@@ -45,6 +45,7 @@ namespace oln
# include <oln/core/abstract/point_set_having_known_size.hh>
# include <oln/core/abstract/point_set_being_random_accessible.hh>
# include <oln/core/abstract/point_set_having_bbox.hh>
# include <oln/core/abstract/bbox.hh>
# include <oln/core/abstract/point_set_being_connected.hh>
......
......@@ -29,7 +29,7 @@
#ifndef OLENA_CORE_GEN_BBOX_HH
# define OLENA_CORE_GEN_BBOX_HH
# include <oln/core/abstract/bbox.hh>
# include <oln/core/point_set_entry.hh>
# include <oln/core/abstract/point.hh>
......@@ -47,7 +47,7 @@ namespace oln
struct set_super_type< bbox_<point> >
{
typedef bbox_<point> self_t;
typedef abstract::bbox<self_t> ret;
typedef point_set_entry<self_t> ret;
};
......@@ -58,17 +58,23 @@ namespace oln
typedef point point_type;
typedef fwd_piter_<point> fwd_piter_type;
typedef bkd_piter_<point> bkd_piter_type;
typedef bbox_<point> bbox_type;
typedef mlc::true_ is_random_accessible_type;
typedef mlc::true_ has_know_size_type;
typedef mlc::true_ is_connected_type;
};
/// Bounding box class based on a point class.
template <typename point>
class bbox_ : public abstract::bbox< bbox_<point> >,
class bbox_ : public point_set_entry< bbox_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef point point_t;
typedef bbox_<point> self_t;
typedef abstract::bbox<self_t> super_t;
typedef point_set_entry<self_t> super_t;
typedef oln_type_of(point, coord) coord_t;
......
......@@ -26,8 +26,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLENA_CORE_ABSTRACT_DPOINT_ND_HH
# define OLENA_CORE_ABSTRACT_DPOINT_ND_HH
#ifndef OLENA_CORE_INTERNAL_DPOINT_ND_HH
# define OLENA_CORE_INTERNAL_DPOINT_ND_HH
# include <mlc/value.hh>
# include <xtd/vec.hh>
......@@ -39,18 +39,18 @@ namespace oln
{
// Forward declaration.
namespace abstract { template <typename E> class dpoint_nd; }
namespace internal { template <typename E> class dpoint_nd; }
// Super type declaration.
template <typename E>
struct set_super_type< abstract::dpoint_nd<E> >
struct set_super_type< internal::dpoint_nd<E> >
{
typedef abstract::dpoint<E> ret;
};
namespace abstract
namespace internal
{
template <typename E>
......@@ -117,15 +117,15 @@ namespace oln
xtd::vec<n,coord_t> v_;
};
} // end of namespace oln::abstract
} // end of namespace oln::internal
/// - abstract::dpoint_nd
/// - internal::dpoint_nd
template <typename D>
struct case_ < xtd::op_uminus, D,
oln::id::op_uminus_dpointnd >
: where_< mlc_is_a(D, abstract::dpoint_nd) >
: where_< mlc_is_a(D, internal::dpoint_nd) >
{
typedef stc_to_exact(D) ret;
};
......@@ -135,4 +135,4 @@ namespace oln
} // end of namespace oln
#endif // ! OLENA_CORE_ABSTRACT_DPOINT_ND_HH
#endif // ! OLENA_CORE_INTERNAL_DPOINT_ND_HH
......@@ -26,15 +26,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLENA_CORE_ABSTRACT_POINT_ND_HH
# define OLENA_CORE_ABSTRACT_POINT_ND_HH
#ifndef OLENA_CORE_INTERNAL_POINT_ND_HH
# define OLENA_CORE_INTERNAL_POINT_ND_HH
# include <xtd/vec.hh>
# include <xtd/optraits.hh>
# include <oln/core/traits_id.hh>
# include <oln/core/abstract/point.hh>
# include <oln/core/abstract/dpoint_nd.hh>
# include <oln/core/internal/dpoint_nd.hh>
namespace oln
......@@ -51,19 +51,19 @@ namespace oln
// Forward declaration.
namespace abstract { template <typename E> class point_nd; }
namespace internal { template <typename E> class point_nd; }
// Super type declaration.
template <typename E>
struct set_super_type< abstract::point_nd<E> >
struct set_super_type< internal::point_nd<E> >
{
typedef abstract::point<E> ret;
};
namespace abstract
namespace internal
{
template <typename E>
......@@ -150,11 +150,11 @@ namespace oln
vec_t v_;
};
} // end of namespace oln::abstract
} // end of namespace oln::internal
template <typename E>
std::ostream& operator<<(std::ostream& ostr, const abstract::point_nd<E>& p)
std::ostream& operator<<(std::ostream& ostr, const internal::point_nd<E>& p)
{
ostr << p.vec();
return ostr;
......@@ -162,12 +162,12 @@ namespace oln
/// abstract::point_nd + abstract::dpoint_nd
/// internal::point_nd + internal::dpoint_nd
template <typename P, typename D>
struct case_ < xtd::op_plus, mlc::pair_<P,D>,
oln::id::op_plus_pointnd_dpointnd >
: where_< mlc::and_< mlc_is_a(P, abstract::point_nd),
mlc_is_a(D, abstract::dpoint_nd) > >
: where_< mlc::and_< mlc_is_a(P, internal::point_nd),
mlc_is_a(D, internal::dpoint_nd) > >
{
typedef oln_type_of(P, coord) P_coord;
typedef oln_type_of(D, coord) D_coord;
......@@ -177,12 +177,12 @@ namespace oln
};
/// abstract::point_nd - abstract::dpoint_nd
/// internal::point_nd - internal::dpoint_nd
template <typename P, typename D>
struct case_ < xtd::op_minus, mlc::pair_<P,D>,
oln::id::op_minus_pointnd_dpointnd >
: where_< mlc::and_< mlc_is_a(P, abstract::point_nd),
mlc_is_a(D, abstract::dpoint_nd) > >
: where_< mlc::and_< mlc_is_a(P, internal::point_nd),
mlc_is_a(D, internal::dpoint_nd) > >
{
typedef oln_type_of(P, coord) P_coord;
typedef oln_type_of(D, coord) D_coord;
......@@ -192,12 +192,12 @@ namespace oln
};
/// abstract::point_nd - abstract::point_nd
/// internal::point_nd - internal::point_nd
template <typename P1, typename P2>
struct case_ < xtd::op_minus, mlc::pair_<P1,P2>,
oln::id::op_minus_pointnd_pointnd >
: where_< mlc::and_< mlc_is_a(P1, abstract::point_nd),
mlc_is_a(P2, abstract::point_nd) > >
: where_< mlc::and_< mlc_is_a(P1, internal::point_nd),
mlc_is_a(P2, internal::point_nd) > >
{
typedef oln_type_of(P1, coord) P1_coord;
typedef oln_type_of(P2, coord) P2_coord;
......@@ -210,4 +210,4 @@ namespace oln
} // end of namespace oln
#endif // ! OLENA_CORE_ABSTRACT_POINT_ND_HH
#endif // ! OLENA_CORE_INTERNAL_POINT_ND_HH
......@@ -62,6 +62,7 @@ namespace oln
typedef mlc::none bbox_type;
typedef mlc::undefined is_random_accessible_type;
typedef mlc::undefined has_known_size_type;
typedef mlc::undefined is_connected_type;
};
......
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