Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes

mln::internal::site_relative_iterator_base< S, E, C > Class Template Reference

A generic iterator on points of windows and of neighborhoods. More...

#include <site_relative_iterator_base.hh>

Inheritance diagram for mln::internal::site_relative_iterator_base< S, E, C >:
Inheritance graph

List of all members.

Public Types

typedef Site_Proxy< void > category
typedef E exact_t
typedef S::site site
 The associated site type (as a Site_Proxy).
typedef S target
 The associated target type.

Public Member Functions

const C & center () const
 The psite around which this iterator moves.
template<typename P >
void center_at (const P &c)
void change_target (const S &s)
 Change the site set targeted by this iterator.
void invalidate ()
bool is_valid () const
void next ()
 Go to the next element.
void next_ ()
 Go to the next point.
const S::psite & p_hook_ () const
 Hook to the current location.
 site_relative_iterator_base ()
 Constructor witout argument.
const S & site_set () const
 Give the site set (neighborhood or window) that this iterator browses.
void start ()
void start_ ()
 Start an iteration.
const S::psite & subj_ ()
 This overriding is very useful: it adds a test to prevent getting an invalid iterator when its center has moved.
const S *& target_ ()
 Give the target address. It might be 0.
const S::site & to_site () const
 Return the site it points to (as a Site_Proxy).
E & update ()
 Warning: this method is an advanced tool provided for very special occasions; if you are a regular user, you should never use it! Calling this method forces this relative iterator to synchronize with its center when it has just moved and when the relative iterator still makes sense.

Protected Attributes

const C * c_
 A pointer to the center psite around which this iterator moves.
const S * s_
 The target.

Private Member Functions

template<typename P >
void center_at_ (const P &c)

Private Attributes

S::psite p_
 The psite designated by this iterator.

Detailed Description

template<typename S, typename E, typename C = typename S ::psite>
class mln::internal::site_relative_iterator_base< S, E, C >

A generic iterator on points of windows and of neighborhoods.

Parameter S is the targeted "site set definition" type. It can be either a Window, or a Neighborhood.

IMPORTANT: Sub-classes have to define center_at_, do_start_, do_next_, is_valid_, invalidate_ and compute_p_. They shall define NEITHER start_ NOR next_.

Definition at line 61 of file site_relative_iterator_base.hh.


Member Typedef Documentation

template<typename E>
typedef Site_Proxy<void> mln::Site_Proxy< E >::category [inherited]
template<typename E>
typedef E mln::Object< E >::exact_t [inherited]

Definition at line 173 of file object.hh.

template<typename S, typename E>
typedef S ::site mln::internal::site_iterator_base< S, E >::site [inherited]

The associated site type (as a Site_Proxy).

Definition at line 64 of file site_iterator_base.hh.

template<typename S, typename E>
typedef S mln::internal::site_iterator_base< S, E >::target [inherited]

The associated target type.

Definition at line 61 of file site_iterator_base.hh.


Constructor & Destructor Documentation

template<typename S , typename E , typename C >
mln::internal::site_relative_iterator_base< S, E, C >::site_relative_iterator_base (  )  [inline]

Constructor witout argument.

Definition at line 127 of file site_relative_iterator_base.hh.


Member Function Documentation

template<typename S , typename E , typename C >
const C & mln::internal::site_relative_iterator_base< S, E, C >::center (  )  const [inline]

The psite around which this iterator moves.

Definition at line 173 of file site_relative_iterator_base.hh.

References mln::internal::site_relative_iterator_base< S, E, C >::c_.

template<typename S , typename E , typename C >
template<typename P >
void mln::internal::site_relative_iterator_base< S, E, C >::center_at ( const P &  c  )  [inline]
template<typename S , typename E , typename C >
template<typename P >
void mln::internal::site_relative_iterator_base< S, E, C >::center_at_ ( const P &  c  )  [inline, private]

Definition at line 233 of file site_relative_iterator_base.hh.

template<typename S, typename E , typename C >
void mln::internal::site_relative_iterator_base< S, E, C >::change_target ( const S &  s  )  [inline]

Change the site set targeted by this iterator.

Definition at line 208 of file site_relative_iterator_base.hh.

References mln::Site_Iterator< E >::invalidate(), and mln::internal::site_iterator_base< S, E >::s_.

Referenced by mln::win::multiple_qiter< W, F >::change_target().

template<typename E >
void mln::Site_Iterator< E >::invalidate (  )  [inline, inherited]
template<typename E >
bool mln::Site_Iterator< E >::is_valid (  )  const [inline, inherited]
template<typename E >
void mln::Site_Iterator< E >::next (  )  [inline, inherited]

Go to the next element.

Warning:
This is a final method; iterator classes should not re-defined this method. The actual "next" operation has to be defined through the next_ method.
Precondition:
The iterator is valid.

Definition at line 92 of file site_iterator.hh.

References mln::exact(), and mln::Site_Iterator< E >::is_valid().

template<typename S , typename E , typename C >
void mln::internal::site_relative_iterator_base< S, E, C >::next_ (  )  [inline]

Go to the next point.

Definition at line 163 of file site_relative_iterator_base.hh.

References mln::exact(), and mln::Site_Iterator< E >::is_valid().

template<typename S , typename E , typename C >
const S::psite & mln::internal::site_relative_iterator_base< S, E, C >::p_hook_ (  )  const [inline]

Hook to the current location.

Definition at line 200 of file site_relative_iterator_base.hh.

template<typename S , typename E , typename C >
const S & mln::internal::site_relative_iterator_base< S, E, C >::site_set (  )  const [inline]

Give the site set (neighborhood or window) that this iterator browses.

Definition at line 182 of file site_relative_iterator_base.hh.

References mln::internal::site_iterator_base< S, E >::s_.

template<typename E >
void mln::Site_Iterator< E >::start (  )  [inline, inherited]

Definition at line 123 of file site_iterator.hh.

References mln::exact().

template<typename S , typename E , typename C >
void mln::internal::site_relative_iterator_base< S, E, C >::start_ (  )  [inline]

Start an iteration.

Definition at line 153 of file site_relative_iterator_base.hh.

References mln::exact(), and mln::Site_Iterator< E >::is_valid().

template<typename S , typename E , typename C >
const S::psite & mln::internal::site_relative_iterator_base< S, E, C >::subj_ (  )  [inline]

This overriding is very useful: it adds a test to prevent getting an invalid iterator when its center has moved.

Some sub-classes provide an update() method for the client to say that she really want to read the iterator just after the center has changed.

Reimplemented from mln::internal::site_iterator_base< S, E >.

Definition at line 191 of file site_relative_iterator_base.hh.

References mln::exact().

template<typename S , typename E >
const S *& mln::internal::site_iterator_base< S, E >::target_ (  )  [inline, inherited]

Give the target address. It might be 0.

Definition at line 127 of file site_iterator_base.hh.

template<typename S , typename E >
const S::site & mln::internal::site_iterator_base< S, E >::to_site (  )  const [inline, inherited]
template<typename S , typename E , typename C >
E & mln::internal::site_relative_iterator_base< S, E, C >::update (  )  [inline]

Warning: this method is an advanced tool provided for very special occasions; if you are a regular user, you should never use it! Calling this method forces this relative iterator to synchronize with its center when it has just moved and when the relative iterator still makes sense.

Definition at line 221 of file site_relative_iterator_base.hh.

References mln::internal::site_relative_iterator_base< S, E, C >::c_, mln::exact(), mln::Site_Iterator< E >::is_valid(), and mln::internal::site_iterator_base< S, E >::s_.


Member Data Documentation

template<typename S, typename E, typename C = typename S ::psite>
const C* mln::internal::site_relative_iterator_base< S, E, C >::c_ [protected]
template<typename S, typename E, typename C = typename S ::psite>
S ::psite mln::internal::site_relative_iterator_base< S, E, C >::p_ [private]

The psite designated by this iterator.

Definition at line 118 of file site_relative_iterator_base.hh.

template<typename S, typename E>
const S* mln::internal::site_iterator_base< S, E >::s_ [protected, inherited]