Milena (Olena)  User documentation 2.0a Id
 All Classes Namespaces Functions Variables Typedefs Enumerator Groups Pages
complex_neighborhood_base.hh
1 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2 //
3 // This file is part of Olena.
4 //
5 // Olena is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation, version 2 of the License.
8 //
9 // Olena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // As a special exception, you may use this file as part of a free
18 // software project without restriction. Specifically, if other files
19 // instantiate templates or use macros or inline functions from this
20 // file, or you compile this file and link it with other files to produce
21 // an executable, this file does not by itself cause the resulting
22 // executable to be covered by the GNU General Public License. This
23 // exception does not however invalidate any other reasons why the
24 // executable file might be covered by the GNU General Public License.
25 
26 #ifndef MLN_CORE_INTERNAL_COMPLEX_NEIGHBORHOOD_BASE_HH
27 # define MLN_CORE_INTERNAL_COMPLEX_NEIGHBORHOOD_BASE_HH
28 
33 
34 # include <mln/core/concept/neighborhood.hh>
35 # include <mln/core/site_set/complex_psite.hh>
36 # include <mln/core/image/complex_neighborhood_piter.hh>
37 
38 # include <mln/core/internal/neighb_base.hh>
39 
40 
41 namespace mln
42 {
43  // Forward declarations.
44  template <typename I, typename G, typename N>
45  class complex_neighborhood_fwd_piter;
46  template <typename I, typename G, typename N>
47  class complex_neighborhood_bkd_piter;
48 
49  namespace internal
50  {
51  template <typename W, typename E>
52  class complex_neighborhood_base;
53  }
54 
55 
56  namespace internal
57  {
63  template <typename W, typename E>
64  class complex_neighborhood_base : public Neighborhood<E>
65  {
66  public:
69  typedef typename W::complex_fwd_iter complex_fwd_iter;
70  typedef typename W::complex_bkd_iter complex_bkd_iter;
72 
73  public:
77  typedef mln_geom(W) G;
79  typedef mln_psite(W) psite;
81  typedef mln_site(W) site;
82 
85  typedef
86  complex_neighborhood_fwd_piter<complex_fwd_iter, G, E> fwd_niter;
87 
90  typedef
91  complex_neighborhood_bkd_piter<complex_bkd_iter, G, E> bkd_niter;
92 
94  typedef fwd_niter niter;
95 
97  typedef W window;
99 
100  public:
102  const W& win() const;
103 
105  bool is_valid() const;
106 
107  private:
109  W win_;
110  };
111 
112 
113 
114 # ifndef MLN_INCLUDE_ONLY
115 
116  template <typename W, typename E>
117  inline
118  const W&
119  complex_neighborhood_base<W, E>::win() const
120  {
121  return win_;
122  }
123 
124  template <typename W, typename E>
125  inline
126  bool
127  complex_neighborhood_base<W, E>::is_valid() const
128  {
129  return win().is_valid();
130  }
131 
132 # endif // ! MLN_INCLUDE_ONLY
133 
134  } // end of namespace mln::internal
135 
136 } // end of namespace mln
137 
138 #endif // ! MLN_CORE_INTERNAL_COMPLEX_NEIGHBORHOOD_BASE_HH