$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
complex_window_base.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_CORE_INTERNAL_COMPLEX_WINDOW_BASE_HH
28 # define MLN_CORE_INTERNAL_COMPLEX_WINDOW_BASE_HH
29 
33 
34 # include <mln/core/concept/window.hh>
35 # include <mln/core/site_set/complex_psite.hh>
36 # include <mln/core/image/complex_window_piter.hh>
37 
38 # include <mln/topo/centered_iter_adapter.hh>
39 
40 // FIXME: Factor with mln::internal::complex_neighborhood_base.
41 
42 
43 namespace mln
44 {
45  // Forward declarations.
46  template <typename I, typename G, typename W>
47  class complex_window_fwd_piter;
48  template <typename I, typename G, typename W>
49  class complex_window_bkd_piter;
50 
51  namespace internal
52  {
53  template <unsigned D, typename G, typename F, typename B, typename E>
54  class complex_window_base;
55  }
56 
57 
58  namespace trait
59  {
60 
61  template <unsigned D, typename G, typename F, typename B, typename E>
62  struct window_< mln::internal::complex_window_base<D, G, F, B, E> >
63  {
64  typedef trait::window::size::unknown size;
65  typedef trait::window::support::irregular support;
66  typedef trait::window::definition::varying definition;
67  };
68 
69  } // end of namespace mln::trait
70 
71 
72  namespace internal
73  {
86  template <unsigned D, typename G, typename F, typename B, typename E>
87  class complex_window_base : public Window<E>
88  {
89  public:
92  typedef F complex_fwd_iter;
93  typedef B complex_bkd_iter;
95 
96  public:
100  typedef G geom;
104  typedef mln_site(psite) site;
105 
106  // FIXME: This is a dummy value.
107  typedef void dpsite;
108 
109  /* FIXME: Ideally, the `is_centered' information should be
110  fetched from the iterators, but that's not a straighforward
111  task. */
112  complex_window_base(bool is_centered = false);
113 
116  typedef
118 
121  typedef
123 
125  typedef fwd_qiter qiter;
127 
128  public:
131  /* FIXME: mln::morpho::dilation requires these method from models
132  of concept Window, but Window does not list them in its
133  requirements. Who's guilty: morpho::dilation or Window? */
135  bool is_empty() const;
137  bool is_centered() const;
138 
140  bool is_valid() const;
142 
143  private:
144  bool is_centered_;
145  };
146 
147 
148 
149 # ifndef MLN_INCLUDE_ONLY
150 
151  template <unsigned D, typename G, typename F, typename B, typename E>
152  inline
154  : is_centered_(is_centered)
155  {
156  }
157 
158 
159  template <unsigned D, typename G, typename F, typename B, typename E>
160  inline
161  bool
163  {
164  return false;
165  }
166 
167  template <unsigned D, typename G, typename F, typename B, typename E>
168  inline
169  bool
170  complex_window_base<D, G, F, B, E>::is_centered() const
171  {
172  return is_centered_;
173  }
174 
175  template <unsigned D, typename G, typename F, typename B, typename E>
176  inline
177  bool
178  complex_window_base<D, G, F, B, E>::is_valid() const
179  {
180  return true;
181  }
182 
183 # endif // ! MLN_INCLUDE_ONLY
184 
185  } // end of namespace mln::internal
186 
187 } // end of namespace mln
188 
189 #endif // ! MLN_CORE_INTERNAL_COMPLEX_WINDOW_BASE_HH