* mln/core/internal/p_complex_piter_base.hh
(mln::internal::p_complex_piter_base<I, P, E>): Take an additional
parameter and turn this class into...
(mln::internal::p_complex_piter_base<I, S, P, E>): ...this.
Adjust inheritance and member definitions.
(mln::internal::p_complex_piter_base<I, S, P, E>::complex_dim):
Remove constant.
* mln/core/site_set/p_complex_piter.hh: Catch up with the changes
in mln::internal::p_complex_piter_base.
---
milena/ChangeLog | 14 ++++
milena/mln/core/internal/p_complex_piter_base.hh | 82 +++++++++++-----------
milena/mln/core/site_set/p_complex_piter.hh | 23 +++++-
3 files changed, 73 insertions(+), 46 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 413bbb6..784f4a4 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,19 @@
2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+ Make internal::p_complex_piter_base generic w.r.t. the site set.
+
+ * mln/core/internal/p_complex_piter_base.hh
+ (mln::internal::p_complex_piter_base<I, P, E>): Take an additional
+ parameter and turn this class into...
+ (mln::internal::p_complex_piter_base<I, S, P, E>): ...this.
+ Adjust inheritance and member definitions.
+ (mln::internal::p_complex_piter_base<I, S, P, E>::complex_dim):
+ Remove constant.
+ * mln/core/site_set/p_complex_piter.hh: Catch up with the changes
+ in mln::internal::p_complex_piter_base.
+
+2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+
Have mln::complex_image be accessible via faces_psites.
* mln/core/image/complex_image.hh
diff --git a/milena/mln/core/internal/p_complex_piter_base.hh
b/milena/mln/core/internal/p_complex_piter_base.hh
index c9787c1..41cc29d 100644
--- a/milena/mln/core/internal/p_complex_piter_base.hh
+++ b/milena/mln/core/internal/p_complex_piter_base.hh
@@ -33,40 +33,37 @@
/// iterators on mln::p_complex.
# include <mln/core/internal/site_set_iterator_base.hh>
-# include <mln/core/site_set/p_complex.hh>
-# include <mln/core/complex_psite.hh>
-# include <mln/core/complex_iter.hh>
+/* FIXME: Rename internal::p_complex_piter_base_ to something else, as
+ it is also used for p_faces piters. Maybe
+ internal::complex_piter_base_, but it is really close to
+ internal::complex_iter_base_... */
namespace mln
{
- // Forward declarations.
- template <unsigned D, typename P> class p_complex;
- template <unsigned D, typename P> class complex_psite;
-
namespace internal
{
- /*---------------------------------.
- | p_complex_piter_base_<I, P, E>. |
- `---------------------------------*/
+ /*------------------------------------.
+ | p_complex_piter_base_<I, S, P, E>. |
+ `------------------------------------*/
+
+ // FIXME: P could probably be deduced from S.
/// \brief Factoring class for iterators on mln::p_complex.
///
/// \arg \p I The type of the underlying complex iterator.
+ /// \arg \p S The associated site set type.
/// \arg \p P The associated site type.
/// \arg \p E The type exact type of the iterator.
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
class p_complex_piter_base_
- : public internal::site_set_iterator_base< p_complex<I::complex_dim, P>,
- p_complex_piter_base_<I, P, E> >
+ : public internal::site_set_iterator_base< S,
+ p_complex_piter_base_<I, S, P, E> >
{
- static const unsigned D = I::complex_dim;
-
- typedef p_complex_piter_base_<I, P, E> self_;
- typedef internal::site_set_iterator_base< p_complex<D, P>,
- self_ > super_;
+ typedef p_complex_piter_base_<I, S, P, E> self_;
+ typedef internal::site_set_iterator_base< S, self_ > super_;
/// The type of the underlying complex iterator.
typedef I iter;
@@ -75,7 +72,7 @@ namespace mln
/// Construction and assignment.
/// \{
p_complex_piter_base_();
- p_complex_piter_base_(const p_complex<D, P>& pc);
+ p_complex_piter_base_(const S& pc);
/// \}
/// Manipulation.
@@ -106,87 +103,88 @@ namespace mln
};
- /// Print an mln::p_complex_piter_base_<I, P, E>.
- template <typename I, typename P, typename E>
+ /// Print an mln::p_complex_piter_base_<I, S, P, E>.
+ template <typename I, typename S, typename P, typename E>
inline
std::ostream&
- operator<<(std::ostream& ostr, const p_complex_piter_base_<I, P,
E>& p);
+ operator<<(std::ostream& ostr, const p_complex_piter_base_<I, S, P,
E>& p);
# ifndef MLN_INCLUDE_ONLY
- /*---------------------------------.
- | p_complex_piter_base_<I, P, E>. |
- `---------------------------------*/
+ /*------------------------------------.
+ | p_complex_piter_base_<I, S, P, E>. |
+ `------------------------------------*/
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
- p_complex_piter_base_<I, P, E>::p_complex_piter_base_()
+ p_complex_piter_base_<I, S, P, E>::p_complex_piter_base_()
{
mln_postcondition(!this->is_valid());
}
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
- p_complex_piter_base_<I, P, E>::p_complex_piter_base_(const p_complex<D,
P>& pc)
+ p_complex_piter_base_<I, S, P, E>::p_complex_piter_base_(const S& pc)
{
this->change_target(pc);
iter_.set_cplx(pc.cplx());
mln_postcondition(!this->is_valid());
}
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
bool
- p_complex_piter_base_<I, P, E>::is_valid_() const
+ p_complex_piter_base_<I, S, P, E>::is_valid_() const
{
return iter_.is_valid();
}
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
void
- p_complex_piter_base_<I, P, E>::invalidate_()
+ p_complex_piter_base_<I, S, P, E>::invalidate_()
{
iter_.invalidate();
}
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
void
- p_complex_piter_base_<I, P, E>::start_()
+ p_complex_piter_base_<I, S, P, E>::start_()
{
iter_.start();
if (this->is_valid())
update_();
}
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
void
- p_complex_piter_base_<I, P, E>::next_()
+ p_complex_piter_base_<I, S, P, E>::next_()
{
iter_.next_();
if (this->is_valid())
update_();
}
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
void
- p_complex_piter_base_<I, P, E>::update_()
+ p_complex_piter_base_<I, S, P, E>::update_()
{
mln_precondition(this->is_valid());
// Update psite_.
- p_ = complex_psite<D, P>(exact(this)->site_set(), iter_);
+ typedef mln_psite(S) psite;
+ p_ = psite(exact(this)->site_set(), iter_);
}
- template <typename I, typename P, typename E>
+ template <typename I, typename S, typename P, typename E>
inline
std::ostream&
- operator<<(std::ostream& ostr, const p_complex_piter_base_<I, P,
E>& p)
+ operator<<(std::ostream& ostr, const p_complex_piter_base_<I, S, P,
E>& p)
{
return ostr << p.unproxy_();
}
diff --git a/milena/mln/core/site_set/p_complex_piter.hh
b/milena/mln/core/site_set/p_complex_piter.hh
index 7cde5bf..41671ce 100644
--- a/milena/mln/core/site_set/p_complex_piter.hh
+++ b/milena/mln/core/site_set/p_complex_piter.hh
@@ -31,11 +31,20 @@
/// \file mln/core/site_set/p_complex_piter.hh
/// \brief Definition of point iterator on complex-based pset.
+# include <mln/core/site_set/p_complex.hh>
# include <mln/core/internal/p_complex_piter_base.hh>
+# include <mln/core/complex_iter.hh>
namespace mln
{
+ // Forward declarations.
+ template <unsigned D, typename P> class p_complex;
+
+ template <unsigned D> class complex_fwd_iter_;
+ template <unsigned D> class complex_bkd_iter_;
+
+
/*-----------------------------.
| p_complex_fwd_piter_<D, P>. |
`-----------------------------*/
@@ -44,12 +53,15 @@ namespace mln
template <unsigned D, typename P>
class p_complex_fwd_piter_
: public internal::p_complex_piter_base_< complex_fwd_iter_<D>,
+ p_complex<D, P>,
P,
p_complex_fwd_piter_<D, P> >
{
typedef p_complex_fwd_piter_<D, P> self_;
- typedef
- internal::p_complex_piter_base_< complex_fwd_iter_<D>, P, self_ >
super_;
+ typedef internal::p_complex_piter_base_< complex_fwd_iter_<D>,
+ p_complex<D, P>,
+ P,
+ self_ > super_;
public:
/// Construction and assignment.
@@ -68,12 +80,15 @@ namespace mln
template <unsigned D, typename P>
class p_complex_bkd_piter_
: public internal::p_complex_piter_base_< complex_bkd_iter_<D>,
+ p_complex<D, P>,
P,
p_complex_bkd_piter_<D, P> >
{
typedef p_complex_bkd_piter_<D, P> self_;
- typedef
- internal::p_complex_piter_base_< complex_bkd_iter_<D>, P, self_ >
super_;
+ typedef internal::p_complex_piter_base_< complex_bkd_iter_<D>,
+ p_complex<D, P>,
+ P,
+ self_ > super_;
public:
/// Construction and assignment.
--
1.6.0.1