URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix line system.
* mln/core/win/line.hh: Fix.
* mln/core/win/hline2d.hh,
* mln/core/win/vline2d.hh: Are now typedefs of line.
---
hline2d.hh | 23 +----------------------
line.hh | 45 +++++++++++++++++++++------------------------
vline2d.hh | 9 +--------
3 files changed, 23 insertions(+), 54 deletions(-)
Index: trunk/milena/mln/core/win/vline2d.hh
===================================================================
--- trunk/milena/mln/core/win/vline2d.hh (revision 1249)
+++ trunk/milena/mln/core/win/vline2d.hh (revision 1250)
@@ -54,14 +54,7 @@
* o \n
* is defined with length = 5.
*/
- struct vline2d : public line<grid::square, 0, vline2d>
- {
- // Ctor.
- vline2d(unsigned length)
- : line<grid::square, 0, vline2d>(length)
- {
- }
- };
+ typedef line<grid::square, 1, int> vline2d;
} // end of namespace mln::win
Index: trunk/milena/mln/core/win/hline2d.hh
===================================================================
--- trunk/milena/mln/core/win/hline2d.hh (revision 1249)
+++ trunk/milena/mln/core/win/hline2d.hh (revision 1250)
@@ -52,28 +52,7 @@
* o o x o o \n
* is defined with length = 5.
*/
- struct hline2d : public line<grid::square, 1, hline2d>
- {
- // Ctor.
- hline2d(unsigned length)
- : line<grid::square, 1, hline2d>(length)
- {
- }
- };
-
-
-// // FIXME for Simon
-
-// // Was:
-// struct hline2d : public Window< hline2d >,
-// public internal::dpoints_base_< dpoint2d, hline2d >
-// {};
-
-// // Will be:
-// template <typename M, unsigned i, typename C >
-// struct line : public Window< line<M,i,C> >,
-// public internal::dpoints_base_< dpoint_<M, C>, line<M,i,C> >
-// {};
+ typedef line<grid::square, 1, int> hline2d;
} // end of namespace mln::win
Index: trunk/milena/mln/core/win/line.hh
===================================================================
--- trunk/milena/mln/core/win/line.hh (revision 1249)
+++ trunk/milena/mln/core/win/line.hh (revision 1250)
@@ -45,12 +45,9 @@
namespace win
{
- template <typename M, unsigned i, typename E>
- struct line : public Window<E>,
- public internal::dpoints_base_
- <dpoint_
- <M, int>, point_
- <M, int> >
+ template <typename M, unsigned i, typename C>
+ struct line : public Window< line<M,i,C> >,
+ public internal::dpoints_base_<dpoint_<M, C>, point_<M, C> >
{
/// Point associated type.
typedef point_<M, int> point;
@@ -97,7 +94,7 @@
unsigned delta() const;
/// Apply a central symmetry to the target window.
- E& sym();
+ line<M,i,C>& sym();
protected:
unsigned length_;
@@ -114,16 +111,16 @@
*
* \relates mln::win::line
*/
- template <typename M, unsigned i, typename E>
- std::ostream& operator<<(std::ostream& ostr, const
line<M,i,E>& win);
+ template <typename M, unsigned i, typename C>
+ std::ostream& operator<<(std::ostream& ostr, const
line<M,i,C>& win);
# ifndef MLN_INCLUDE_ONLY
- template <typename M, unsigned i, typename E>
- line<M,i,E>::line(unsigned length)
+ template <typename M, unsigned i, typename C>
+ line<M,i,C>::line(unsigned length)
: length_(length)
{
mln_precondition(i < M::dim);
@@ -137,38 +134,38 @@
}
}
- template <typename M, unsigned i, typename E>
- bool line<M,i,E>::is_centered() const
+ template <typename M, unsigned i, typename C>
+ bool line<M,i,C>::is_centered() const
{
return true;
}
- template <typename M, unsigned i, typename E>
- bool line<M,i,E>::is_symmetric() const
+ template <typename M, unsigned i, typename C>
+ bool line<M,i,C>::is_symmetric() const
{
return true;
}
- template <typename M, unsigned i, typename E>
- unsigned line<M,i,E>::length() const
+ template <typename M, unsigned i, typename C>
+ unsigned line<M,i,C>::length() const
{
return length_;
}
- template <typename M, unsigned i, typename E>
- unsigned line<M,i,E>::delta() const
+ template <typename M, unsigned i, typename C>
+ unsigned line<M,i,C>::delta() const
{
return length_ / 2;
}
- template <typename M, unsigned i, typename E>
- E& line<M,i,E>::sym()
+ template <typename M, unsigned i, typename C>
+ line<M,i,C>& line<M,i,C>::sym()
{
- return exact(*this);
+ return *this;
}
- template <typename M, unsigned i, typename E>
- std::ostream& operator<<(std::ostream& ostr, const
line<M,i,E>& win)
+ template <typename M, unsigned i, typename C>
+ std::ostream& operator<<(std::ostream& ostr, const
line<M,i,C>& win)
{
ostr << "[line: length=" << win.length() <<
']';
return ostr;