Milena (Olena)  User documentation 2.0a Id
 All Classes Namespaces Functions Variables Typedefs Enumerator Groups Pages
complex_set_iterator_base.hh
1 // Copyright (C) 2008, 2009, 2010 EPITA Research and Development
2 // Laboratory (LRDE)
3 //
4 // This file is part of Olena.
5 //
6 // Olena is free software: you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation, version 2 of the License.
9 //
10 // Olena is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free
19 // software project without restriction. Specifically, if other files
20 // instantiate templates or use macros or inline functions from this
21 // file, or you compile this file and link it with other files to produce
22 // an executable, this file does not by itself cause the resulting
23 // executable to be covered by the GNU General Public License. This
24 // exception does not however invalidate any other reasons why the
25 // executable file might be covered by the GNU General Public License.
26 
27 #ifndef MLN_TOPO_INTERNAL_COMPLEX_SET_ITERATOR_BASE_HH
28 # define MLN_TOPO_INTERNAL_COMPLEX_SET_ITERATOR_BASE_HH
29 
34 
35 # include <mln/topo/internal/complex_iterator_base.hh>
36 
37 
38 namespace mln
39 {
40 
41  namespace topo
42  {
43 
44  namespace internal
45  {
46 
47  // Forward declaration.
48  template <typename F, typename E>
49  class complex_iterator_base;
50 
51 
56  template <typename F, typename E>
57  class complex_set_iterator_base : public complex_iterator_base<F, E>
58  {
59  typedef complex_set_iterator_base<F, E> self_;
60 
61  public:
63  typedef F face_type;
64  // FIXME: Maybe we could just get the dimension D of the face's
65  // complex, an define complex_type as mln::complex<D>?
66  typedef typename F::complex_type complex_type;
67 
70  complex_set_iterator_base();
71  complex_set_iterator_base(const complex_type& c);
73 
77  void set_cplx(const complex_type& c);
78 
80  bool is_valid() const;
82  void invalidate();
84  };
85 
86 
87 
88 # ifndef MLN_INCLUDE_ONLY
89 
90  template <typename F, typename E>
91  inline
92  complex_set_iterator_base<F, E>::complex_set_iterator_base()
93  {
94  invalidate();
95  }
96 
97  template <typename F, typename E>
98  inline
99  complex_set_iterator_base<F, E>::complex_set_iterator_base(const complex_type& c)
100  {
101  this->f_.set_cplx(c);
102  // Invalidate f_.
103  invalidate();
104  }
105 
106  template <typename F, typename E>
107  inline
108  void
109  complex_set_iterator_base<F, E>::set_cplx(const complex_type& c)
110  {
111  this->f_.set_cplx(c);
112  // Invalidate f_.
113  invalidate();
114  }
115 
116  template <typename F, typename E>
117  inline
118  bool
119  complex_set_iterator_base<F, E>::is_valid() const
120  {
121  return this->f_.is_valid();
122  }
123 
124  template <typename F, typename E>
125  inline
126  void
127  complex_set_iterator_base<F, E>::invalidate()
128  {
129  this->f_.invalidate();
130  }
131 
132 # endif // ! MLN_INCLUDE_ONLY
133 
134  } // end of namespace mln::topo::internal
135 
136  } // end of namespace mln::topo
137 
138 } // end of namespace mln
139 
140 #endif // ! MLN_TOPO_INTERNAL_COMPLEX_SET_ITERATOR_BASE_HH