598: Fix the inheritance of oln::point2d_ and oln::dpoint2d_.

https://svn.lrde.epita.fr/svn/oln/trunk/olena Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Fix the inheritance of oln::point2d_ and oln::dpoint2d_. * oln/core/2d/point2d.hh (oln::set_super_type< point2d_<C> >): New. (oln::point2d_): Use stc_get_supers to set the base class. (oln::point2d_::super_t): Use stc_get_super to define it. (oln::point2d_::point2d_(coord_t, coord_t)): Use xtd::mk_vec to initialize the base class. * oln/core/2d/dpoint2d.hh (oln::set_super_type< dpoint2d_<C> >): Re-enable it. (oln::dpoint2d_): Use stc_get_supers to set the base class. (oln::dpoint2d_::super_t): Use stc_get_super to define it. dpoint2d.hh | 24 +++++++++++++----------- point2d.hh | 25 ++++++++++++++++--------- 2 files changed, 29 insertions(+), 20 deletions(-) Index: oln/core/2d/point2d.hh --- oln/core/2d/point2d.hh (revision 597) +++ oln/core/2d/point2d.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2001, 2002, 2003, 2004, 2006 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2003, 2004, 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 @@ -36,13 +37,22 @@ { + /// Specializations of functions point and dpoint : + /// \f$(n, coord) \rightarrow type\f$ for \f$n = 2\f$. /// \{ - /// Specializations of functions point and dpoint : (n,coord) -> type for n = 2. template <typename C> struct point_ <2, C> { typedef point2d_<C> ret; }; template <typename C> struct dpoint_ <2, C> { typedef dpoint2d_<C> ret; }; /// \} + /// Super type. + template<typename C> + struct set_super_type< point2d_<C> > + { + typedef internal::point_nd< point2d_<C> > ret; + }; + + /// Virtual types associated to oln::point2d_<C>. template <typename C> struct vtypes< point2d_<C> > @@ -56,18 +66,16 @@ /// General 2D point class. template <typename C> - class point2d_ : public internal::point_nd< point2d_<C> > // FIXME: stc_get_super_(point2d_<C>) + class point2d_ : public stc_get_supers(point2d_<C>) { typedef point2d_<C> self_t; - typedef internal::point_nd<self_t> super_t; + typedef stc_get_super(point2d_<C>) super_t; + typedef oln_type_of(self_t, coord) coord_t; using super_t::v_; public: - // Cf. BUG! typedef oln_type_of(self_t, grid) grid_t; - typedef oln_type_of(self_t, coord) coord_t; - /// Ctor. point2d_() { @@ -75,9 +83,8 @@ /// Ctor. point2d_(coord_t row, coord_t col) + : super_t (xtd::mk_vec(row, col)) { - v_[0] = row; - v_[1] = col; } /// Ctor. Index: oln/core/2d/dpoint2d.hh --- oln/core/2d/dpoint2d.hh (revision 597) +++ oln/core/2d/dpoint2d.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2001, 2002, 2003, 2004, 2006 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2003, 2004, 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 @@ -37,12 +38,12 @@ { -// /// Super type. -// template<typename C> -// struct set_super_type< dpoint2d_<C> > -// { -// typedef abstract::dpoint< dpoint2d_<C> > ret; -// }; + /// Super type. + template<typename C> + struct set_super_type< dpoint2d_<C> > + { + typedef internal::dpoint_nd< dpoint2d_<C> > ret; + }; /// Virtual types associated to oln::dpoint2d_<C>. @@ -58,10 +59,11 @@ /// General 2D dpoint class. template <typename C> - class dpoint2d_ : public internal::dpoint_nd< dpoint2d_<C> > // FIXME: stc_get_super_(dpoint2d_<C>) + class dpoint2d_ + : public stc_get_supers(dpoint2d_<C>) { typedef dpoint2d_<C> self_t; - typedef internal::dpoint_nd<self_t> super_t; // FIXME: stc_get_super(self_t) + typedef stc_get_super(dpoint2d_<C>) super_t; typedef oln_type_of(self_t, coord) coord_t; using super_t::v_; @@ -74,8 +76,8 @@ } /// Ctor. - dpoint2d_(const xtd::vec<2,coord_t>& v) : - super_t(v) + dpoint2d_(const xtd::vec<2,coord_t>& v) + : super_t(v) { }
participants (1)
-
Roland Levillain