$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
graph_iter.hh
1 // Copyright (C) 2008, 2009, 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_UTIL_INTERNAL_GRAPH_ITER_HH
28 # define MLN_UTIL_INTERNAL_GRAPH_ITER_HH
29 
33 
34 # include <mln/util/internal/graph_iter_base.hh>
35 # include <mln/util/vertex.hh>
36 # include <mln/util/edge.hh>
37 
38 
39 
40 namespace mln
41 {
42 
43  namespace internal
44  {
45 
50  template<typename G>
52  : public graph_iter_base<G, util::vertex<G>, vertex_fwd_iterator<G> >
53  {
55 
56  public:
60  vertex_fwd_iterator(const G& g);
62 
63  protected:
67 
71 
72  friend class graph_iter_base<G, util::vertex<G>, vertex_fwd_iterator<G> >;
73  };
74 
75 
80  template<typename G>
82  : public graph_iter_base<G, util::vertex<G>, vertex_bkd_iterator<G> >
83  {
85 
86  public:
90  vertex_bkd_iterator(const G& g);
92 
93  protected:
97 
100  util::vertex_id_t next_id_() const;
101 
102  friend class graph_iter_base<G, util::vertex<G>, vertex_bkd_iterator<G> >;
103  };
104 
105 
110  template <typename G>
112  : public graph_iter_base<G, util::edge<G>, edge_fwd_iterator<G> >
113  {
115 
116  public:
120  edge_fwd_iterator(const G& g);
122 
123  protected:
126  util::edge_id_t start_id_() const;
127 
130  util::edge_id_t next_id_() const;
131 
132  friend class graph_iter_base<G, util::edge<G>, edge_fwd_iterator<G> >;
133  };
134 
135 
140  template <typename G>
142  : public graph_iter_base<G, util::edge<G>, edge_bkd_iterator<G> >
143  {
145 
146  public:
150  edge_bkd_iterator(const G& g);
152 
153  protected:
156  util::edge_id_t start_id_() const;
157 
160  util::edge_id_t next_id_() const;
161 
162  friend class graph_iter_base<G, util::edge<G>, edge_bkd_iterator<G> >;
163  };
164 
165 
166 
167 
168 # ifndef MLN_INCLUDE_ONLY
169 
170 
171  /*--------------------`
172  | vertex_fwd_iterator |
173  \--------------------*/
174 
175  template <typename G>
176  inline
178  {
179  }
180 
181  template <typename G>
182  inline
184  : super_(g)
185  {
186  }
187 
188  template <typename G>
189  inline
192  {
193  return 0;
194  }
195 
196  template <typename G>
197  inline
200  {
201  return this->p_.id().value() + 1;
202  }
203 
204 
205 
206  /*--------------------`
207  | vertex_bkd_iterator |
208  \--------------------*/
209 
210  template <typename G>
211  inline
213  {
214  }
215 
216  template <typename G>
217  inline
219  : super_(g)
220  {
221  }
222 
223  template <typename G>
224  inline
227  {
228  return this->p_.graph().v_nmax() - 1;
229  }
230 
231  template <typename G>
232  inline
235  {
236  return this->p_.id().value() - 1;
237  }
238 
239 
240 
241  /*------------------`
242  | edge_fwd_iterator |
243  \------------------*/
244 
245  template <typename G>
246  inline
248  {
249  }
250 
251  template <typename G>
252  inline
254  : super_(g)
255  {
256  }
257 
258  template <typename G>
259  inline
262  {
263  return 0;
264  }
265 
266  template <typename G>
267  inline
270  {
271  return this->p_.id().value() + 1;
272  }
273 
274 
275 
276  /*------------------`
277  | edge_bkd_iterator |
278  \------------------*/
279 
280  template <typename G>
281  inline
283  {
284  }
285 
286  template <typename G>
287  inline
289  : super_(g)
290  {
291  }
292 
293  template <typename G>
294  inline
297  {
298  return this->p_.graph().e_nmax() - 1;
299  }
300 
301  template <typename G>
302  inline
305  {
306  return this->p_.id().value() - 1;
307  }
308 
309 # endif // ! MLN_INCLUDE_ONLY
310 
311  } // end of namespace mln::internal
312 
313 } // end of namespace mln
314 
315 
316 #endif // ! MLN_UTIL_INTERNAL_GRAPH_ITER_HH