$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
p_n_faces_piter.hh
1 // Copyright (C) 2008, 2009, 2010, 2012 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_CORE_SITE_SET_P_N_FACES_PITER_HH
28 # define MLN_CORE_SITE_SET_P_N_FACES_PITER_HH
29 
33 
34 # include <mln/core/site_set/p_complex.hh>
35 # include <mln/core/internal/p_complex_piter_base.hh>
36 # include <mln/topo/n_face_iter.hh>
37 
38 /* FIXME: Maybe we could factor these iterators again, by introducing
39  an implementation class having methods n() and set_n(). */
40 
41 
42 namespace mln
43 {
44 
45  // Forward declarations.
46  template <unsigned D, typename G> class p_complex;
47 
48 
49  /*----------------------------.
50  | p_n_faces_fwd_piter<D, G>. |
51  `----------------------------*/
52 
58  template <unsigned D, typename G>
60  : public internal::p_complex_piter_base_< topo::n_face_fwd_iter<D>,
61  p_complex<D, G>,
62  mln_site(G),
63  p_n_faces_fwd_piter<D, G> >
64  {
68  mln_site(G),
69  self_ > super_;
70 
71  public:
75  p_n_faces_fwd_piter(const p_complex<D, G>& pc, unsigned n);
77 
82  unsigned n() const;
83  void set_n (unsigned n);
85  };
86 
87 
88  /*----------------------------.
89  | p_n_faces_bkd_piter<D, G>. |
90  `----------------------------*/
91 
97  template <unsigned D, typename G>
99  /* FIXME: Rename internal::p_complex_piter_base_ to something else,
100  as it is also used for p_faces piters! */
101  : public internal::p_complex_piter_base_< topo::n_face_bkd_iter<D>,
102  p_complex<D, G>,
103  mln_site(G),
104  p_n_faces_bkd_piter<D, G> >
105  {
109  mln_site(G),
110  self_ > super_;
111 
112  public:
116  p_n_faces_bkd_piter(const p_complex<D, G>& pc, unsigned n);
118 
123  unsigned n() const;
124  void set_n (unsigned n);
126  };
127 
128 
129 
130 # ifndef MLN_INCLUDE_ONLY
131 
132  /*----------------------------.
133  | p_n_faces_fwd_piter<D, G>. |
134  `----------------------------*/
135 
136  template <unsigned D, typename G>
137  inline
139  {
140  }
141 
142  template <unsigned D, typename G>
143  inline
144  p_n_faces_fwd_piter<D, G>::p_n_faces_fwd_piter(const p_complex<D, G>& pc,
145  unsigned n)
146  : super_(pc)
147  {
148  mln_precondition(n <= D);
149  set_n(n);
150  }
151 
152  template <unsigned D, typename G>
153  inline
154  unsigned
156  {
157  return this->iter_.n();
158  }
159 
160  template <unsigned D, typename G>
161  inline
162  void
164  {
165  this->iter_.set_n(n);
166  }
167 
168 
169  /*----------------------------.
170  | p_n_faces_bkd_piter<D, G>. |
171  `----------------------------*/
172 
173  template <unsigned D, typename G>
174  inline
176  {
177  }
178 
179  template <unsigned D, typename G>
180  inline
181  p_n_faces_bkd_piter<D, G>::p_n_faces_bkd_piter(const p_complex<D, G>& pc,
182  unsigned n)
183  : super_(pc)
184  {
185  mln_precondition(n <= D);
186  set_n(n);
187  }
188 
189  template <unsigned D, typename G>
190  inline
191  unsigned
193  {
194  return this->iter_.n();
195  }
196 
197  template <unsigned D, typename G>
198  inline
199  void
201  {
202  this->iter_.set_n(n);
203  }
204 
205 # endif // ! MLN_INCLUDE_ONLY
206 
207 } // end of mln
208 
209 #endif // ! MLN_CORE_SITE_SET_P_N_FACES_PITER_HH