$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
neighb.hh
1 // Copyright (C) 2007, 2008, 2009, 2012, 2013 EPITA Research and
2 // Development 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_NEIGHB_HH
28 # define MLN_CORE_NEIGHB_HH
29 
37 
38 # include <mln/core/internal/neighb_base.hh>
39 # include <mln/core/internal/neighb_niter_base.hh>
40 # include <mln/core/internal/site_relative_iterator_base.hh>
41 # include <mln/core/internal/neighb_niter_impl.hh>
42 
43 
44 namespace mln
45 {
46 
47  // Forward declarations.
48  template <typename W> class neighb_fwd_niter;
49  template <typename W> class neighb_bkd_niter;
50 
51 
52 
57  template <typename W>
58  class neighb
59  : public internal::neighb_base<W,neighb<W> >
60  {
62 
63  public:
64 
67 
70 
72  typedef fwd_niter niter;
73 
74 
76  neighb();
77 
79  neighb(const W& win);
80 
81  };
82 
83 
86  template <typename W>
87  void
88  from_to_(const mln::neighb<W>& from, W& to);
89 
91  template <typename W>
92  void
93  from_to_(const W& from, mln::neighb<W>& to);
95 
96 
97  // neighb_fwd_niter<W>
98 
99  template <typename W>
101  : public internal::neighb_niter_base<W,neighb<W>,
102  mln_fwd_qiter(W),neighb_fwd_niter<W> >
103  {
104  typedef
106  mln_fwd_qiter(W),neighb_fwd_niter<W> > super_;
107 
108  public:
110 
111  template <typename P>
112  neighb_fwd_niter(const neighb<W>& nbh, const P& c);
113 
114  };
115 
116 
117 
118  // neighb_bkd_niter<W,E>
119 
120  template <typename W>
122  : public internal::neighb_niter_base<W,neighb<W>,
123  mln_bkd_qiter(W),neighb_bkd_niter<W> >
124  {
125  typedef
127  mln_bkd_qiter(W),neighb_bkd_niter<W> > super_;
128 
129  public:
131 
132  template <typename P>
133  neighb_bkd_niter(const neighb<W>& nbh, const P& c);
134 
135  };
136 
137 
138 
139 # ifndef MLN_INCLUDE_ONLY
140 
141  // neighb<W>
142 
143  template <typename W>
144  inline
146  {
147  }
148 
149  template <typename W>
150  inline
151  neighb<W>::neighb(const W& win)
152  : super_(win)
153  {
154  }
155 
156 
157  // neighb_fwd_niter<W>
158 
159  template <typename W>
160  inline
162  {
163  }
164 
165  template <typename W>
166  template <typename P>
167  inline
168  neighb_fwd_niter<W>::neighb_fwd_niter(const neighb<W>& nbh, const P& c)
169  : super_(nbh, c)
170  {
171  this->i_.init_(nbh.win(), c);
172  }
173 
174 
175 
176  // neighb_bkd_niter<W>
177 
178  template <typename W>
179  inline
181  {
182  }
183 
184  template <typename W>
185  template <typename P>
186  inline
187  neighb_bkd_niter<W>::neighb_bkd_niter(const neighb<W>& nbh, const P& c)
188  : super_(nbh, c)
189  {
190  this->i_.init_(nbh.win(), c);
191  }
192 
193  template <typename W>
194  void
195  from_to_(const neighb<W>& from, W& to)
196  {
197  to = from.win();
198  }
199 
200  template <typename W>
201  void
202  from_to_(const W& from, neighb<W>& to)
203  {
204  to.change_window(from);
205  }
206 
207 
208 # endif // ! MLN_INCLUDE_ONLY
209 
210 } // end of namespace mln
211 
212 
213 #endif // ! MLN_CORE_NEIGHB_HH