Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2008, 2009, 2010 EPITA Research and Development 00002 // Laboratory (LRDE) 00003 // 00004 // This file is part of Olena. 00005 // 00006 // Olena is free software: you can redistribute it and/or modify it under 00007 // the terms of the GNU General Public License as published by the Free 00008 // Software Foundation, version 2 of the License. 00009 // 00010 // Olena is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 // As a special exception, you may use this file as part of a free 00019 // software project without restriction. Specifically, if other files 00020 // instantiate templates or use macros or inline functions from this 00021 // file, or you compile this file and link it with other files to produce 00022 // an executable, this file does not by itself cause the resulting 00023 // executable to be covered by the GNU General Public License. This 00024 // exception does not however invalidate any other reasons why the 00025 // executable file might be covered by the GNU General Public License. 00026 00027 #ifndef MLN_CORE_SITE_SET_P_N_FACES_PITER_HH 00028 # define MLN_CORE_SITE_SET_P_N_FACES_PITER_HH 00029 00033 00034 # include <mln/core/site_set/p_complex.hh> 00035 # include <mln/core/internal/p_complex_piter_base.hh> 00036 # include <mln/topo/n_face_iter.hh> 00037 00038 /* FIXME: Maybe we could factor these iterators again, by introducing 00039 an implementation class having methods n() and set_n(). */ 00040 00041 00042 namespace mln 00043 { 00044 00045 // Forward declarations. 00046 template <unsigned D, typename G> class p_complex; 00047 00048 00049 /*----------------------------. 00050 | p_n_faces_fwd_piter<D, G>. | 00051 `----------------------------*/ 00052 00055 template <unsigned D, typename G> 00056 class p_n_faces_fwd_piter 00057 : public internal::p_complex_piter_base_< topo::n_face_fwd_iter<D>, 00058 p_complex<D, G>, 00059 mln_site(G), 00060 p_n_faces_fwd_piter<D, G> > 00061 { 00062 typedef p_n_faces_fwd_piter<D, G> self_; 00063 typedef internal::p_complex_piter_base_< topo::n_face_fwd_iter<D>, 00064 p_complex<D, G>, 00065 mln_site(G), 00066 self_ > super_; 00067 00068 public: 00071 p_n_faces_fwd_piter(); 00072 p_n_faces_fwd_piter(const p_complex<D, G>& pc, unsigned n); 00074 00079 unsigned n() const; 00080 void set_n (unsigned n); 00082 }; 00083 00084 00085 /*----------------------------. 00086 | p_n_faces_bkd_piter<D, G>. | 00087 `----------------------------*/ 00088 00091 template <unsigned D, typename G> 00092 class p_n_faces_bkd_piter 00093 /* FIXME: Rename internal::p_complex_piter_base_ to something else, 00094 as it is also used for p_faces piters! */ 00095 : public internal::p_complex_piter_base_< topo::n_face_bkd_iter<D>, 00096 p_complex<D, G>, 00097 mln_site(G), 00098 p_n_faces_bkd_piter<D, G> > 00099 { 00100 typedef p_n_faces_bkd_piter<D, G> self_; 00101 typedef internal::p_complex_piter_base_< topo::n_face_bkd_iter<D>, 00102 p_complex<D, G>, 00103 mln_site(G), 00104 self_ > super_; 00105 00106 public: 00109 p_n_faces_bkd_piter(); 00110 p_n_faces_bkd_piter(const p_complex<D, G>& pc, unsigned n); 00112 00117 unsigned n() const; 00118 void set_n (unsigned n); 00120 }; 00121 00122 00123 00124 # ifndef MLN_INCLUDE_ONLY 00125 00126 /*----------------------------. 00127 | p_n_faces_fwd_piter<D, G>. | 00128 `----------------------------*/ 00129 00130 template <unsigned D, typename G> 00131 inline 00132 p_n_faces_fwd_piter<D, G>::p_n_faces_fwd_piter() 00133 { 00134 } 00135 00136 template <unsigned D, typename G> 00137 inline 00138 p_n_faces_fwd_piter<D, G>::p_n_faces_fwd_piter(const p_complex<D, G>& pc, 00139 unsigned n) 00140 : super_(pc) 00141 { 00142 mln_precondition(n <= D); 00143 set_n(n); 00144 } 00145 00146 template <unsigned D, typename G> 00147 inline 00148 unsigned 00149 p_n_faces_fwd_piter<D, G>::n() const 00150 { 00151 return this->iter_.n(); 00152 } 00153 00154 template <unsigned D, typename G> 00155 inline 00156 void 00157 p_n_faces_fwd_piter<D, G>::set_n (unsigned n) 00158 { 00159 this->iter_.set_n(n); 00160 } 00161 00162 00163 /*----------------------------. 00164 | p_n_faces_bkd_piter<D, G>. | 00165 `----------------------------*/ 00166 00167 template <unsigned D, typename G> 00168 inline 00169 p_n_faces_bkd_piter<D, G>::p_n_faces_bkd_piter() 00170 { 00171 } 00172 00173 template <unsigned D, typename G> 00174 inline 00175 p_n_faces_bkd_piter<D, G>::p_n_faces_bkd_piter(const p_complex<D, G>& pc, 00176 unsigned n) 00177 : super_(pc) 00178 { 00179 mln_precondition(n <= D); 00180 set_n(n); 00181 } 00182 00183 template <unsigned D, typename G> 00184 inline 00185 unsigned 00186 p_n_faces_bkd_piter<D, G>::n() const 00187 { 00188 return this->iter_.n(); 00189 } 00190 00191 template <unsigned D, typename G> 00192 inline 00193 void 00194 p_n_faces_bkd_piter<D, G>::set_n (unsigned n) 00195 { 00196 this->iter_.set_n(n); 00197 } 00198 00199 # endif // ! MLN_INCLUDE_ONLY 00200 00201 } // end of mln 00202 00203 #endif // ! MLN_CORE_SITE_SET_P_N_FACES_PITER_HH