Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) 00002 // 00003 // This file is part of Olena. 00004 // 00005 // Olena is free software: you can redistribute it and/or modify it under 00006 // the terms of the GNU General Public License as published by the Free 00007 // Software Foundation, version 2 of the License. 00008 // 00009 // Olena is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // As a special exception, you may use this file as part of a free 00018 // software project without restriction. Specifically, if other files 00019 // instantiate templates or use macros or inline functions from this 00020 // file, or you compile this file and link it with other files to produce 00021 // an executable, this file does not by itself cause the resulting 00022 // executable to be covered by the GNU General Public License. This 00023 // exception does not however invalidate any other reasons why the 00024 // executable file might be covered by the GNU General Public License. 00025 00026 #ifndef MLN_CORE_INTERNAL_COMPLEX_WINDOW_BASE_HH 00027 # define MLN_CORE_INTERNAL_COMPLEX_WINDOW_BASE_HH 00028 00032 00033 # include <mln/core/concept/window.hh> 00034 # include <mln/core/site_set/complex_psite.hh> 00035 # include <mln/core/image/complex_window_piter.hh> 00036 00037 # include <mln/topo/centered_iter_adapter.hh> 00038 00039 // FIXME: Factor with mln::internal::complex_neighborhood_base. 00040 00041 00042 namespace mln 00043 { 00044 // Forward declarations. 00045 template <typename I, typename G, typename W> 00046 class complex_window_fwd_piter; 00047 template <typename I, typename G, typename W> 00048 class complex_window_bkd_piter; 00049 00050 namespace internal 00051 { 00052 template <unsigned D, typename G, typename F, typename B, typename E> 00053 class complex_window_base; 00054 } 00055 00056 00057 namespace trait 00058 { 00059 00060 template <unsigned D, typename G, typename F, typename B, typename E> 00061 struct window_< mln::internal::complex_window_base<D, G, F, B, E> > 00062 { 00063 typedef trait::window::size::unknown size; 00064 typedef trait::window::support::irregular support; 00065 typedef trait::window::definition::varying definition; 00066 }; 00067 00068 } // end of namespace mln::trait 00069 00070 00071 namespace internal 00072 { 00082 template <unsigned D, typename G, typename F, typename B, typename E> 00083 class complex_window_base : public Window<E> 00084 { 00085 public: 00088 typedef F complex_fwd_iter; 00089 typedef B complex_bkd_iter; 00091 00092 public: 00096 typedef G geom; 00098 typedef complex_psite<D, G> psite; 00100 typedef mln_site(psite) site; 00101 00102 // FIXME: This is a dummy value. 00103 typedef void dpsite; 00104 00105 /* FIXME: Ideally, the `is_centered' information should be 00106 fetched from the iterators, but that's not a straighforward 00107 task. */ 00108 complex_window_base(bool is_centered = false); 00109 00112 typedef 00113 complex_window_fwd_piter<complex_fwd_iter, G, E> fwd_qiter; 00114 00117 typedef 00118 complex_window_bkd_piter<complex_bkd_iter, G, E> bkd_qiter; 00119 00121 typedef fwd_qiter qiter; 00123 00124 public: 00127 /* FIXME: mln::morpho::dilation requires these method from models 00128 of concept Window, but Window does not list them in its 00129 requirements. Who's guilty: morpho::dilation or Window? */ 00131 bool is_empty() const; 00133 bool is_centered() const; 00134 00136 bool is_valid() const; 00138 00139 private: 00140 bool is_centered_; 00141 }; 00142 00143 00144 00145 # ifndef MLN_INCLUDE_ONLY 00146 00147 template <unsigned D, typename G, typename F, typename B, typename E> 00148 inline 00149 complex_window_base<D, G, F, B, E>::complex_window_base(bool is_centered) 00150 : is_centered_(is_centered) 00151 { 00152 } 00153 00154 00155 template <unsigned D, typename G, typename F, typename B, typename E> 00156 inline 00157 bool 00158 complex_window_base<D, G, F, B, E>::is_empty() const 00159 { 00160 return false; 00161 } 00162 00163 template <unsigned D, typename G, typename F, typename B, typename E> 00164 inline 00165 bool 00166 complex_window_base<D, G, F, B, E>::is_centered() const 00167 { 00168 return is_centered_; 00169 } 00170 00171 template <unsigned D, typename G, typename F, typename B, typename E> 00172 inline 00173 bool 00174 complex_window_base<D, G, F, B, E>::is_valid() const 00175 { 00176 return true; 00177 } 00178 00179 # endif // ! MLN_INCLUDE_ONLY 00180 00181 } // end of namespace mln::internal 00182 00183 } // end of namespace mln 00184 00185 #endif // ! MLN_CORE_INTERNAL_COMPLEX_WINDOW_BASE_HH