• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

p_n_faces_piter.hh

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_SITE_SET_P_N_FACES_PITER_HH
00027 # define MLN_CORE_SITE_SET_P_N_FACES_PITER_HH
00028 
00032 
00033 # include <mln/core/site_set/p_complex.hh>
00034 # include <mln/core/internal/p_complex_piter_base.hh>
00035 # include <mln/topo/n_face_iter.hh>
00036 
00037 /* FIXME: Maybe we could factor these iterators again, by introducing
00038    an implementation class having methods n() and set_n().  */
00039 
00040 
00041 namespace mln
00042 {
00043 
00044   /*----------------------------.
00045   | p_n_faces_fwd_piter<D, P>.  |
00046   `----------------------------*/
00047 
00050   template <unsigned D, typename P>
00051   class p_n_faces_fwd_piter
00052     : public internal::p_complex_piter_base_< topo::n_face_fwd_iter<D>,
00053                                               p_complex<D, P>,
00054                                               P,
00055                                               p_n_faces_fwd_piter<D, P> >
00056   {
00057     typedef p_n_faces_fwd_piter<D, P> self_;
00058     typedef internal::p_complex_piter_base_< topo::n_face_fwd_iter<D>,
00059                                              p_complex<D, P>,
00060                                              P,
00061                                              self_ > super_;
00062 
00063   public:
00066     p_n_faces_fwd_piter();
00067     p_n_faces_fwd_piter(const p_complex<D, P>& pc, unsigned n);
00069 
00074     unsigned n() const;
00075     void set_n (unsigned n);
00077   };
00078 
00079 
00080   /*----------------------------.
00081   | p_n_faces_bkd_piter<D, P>.  |
00082   `----------------------------*/
00083 
00086   template <unsigned D, typename P>
00087   class p_n_faces_bkd_piter
00088   /* FIXME: Rename internal::p_complex_piter_base_ to something else,
00089      as it is also used for p_faces piters! */
00090     : public internal::p_complex_piter_base_< topo::n_face_bkd_iter<D>,
00091                                               p_complex<D, P>,
00092                                               P,
00093                                               p_n_faces_bkd_piter<D, P> >
00094   {
00095     typedef p_n_faces_bkd_piter<D, P> self_;
00096     typedef internal::p_complex_piter_base_< topo::n_face_bkd_iter<D>,
00097                                              p_complex<D, P>,
00098                                              P,
00099                                              self_ > super_;
00100 
00101   public:
00104     p_n_faces_bkd_piter();
00105     p_n_faces_bkd_piter(const p_complex<D, P>& pc, unsigned n);
00107 
00112     unsigned n() const;
00113     void set_n (unsigned n);
00115   };
00116 
00117 
00118 
00119 # ifndef MLN_INCLUDE_ONLY
00120 
00121   /*----------------------------.
00122   | p_n_faces_fwd_piter<D, P>.  |
00123   `----------------------------*/
00124 
00125   template <unsigned D, typename P>
00126   inline
00127   p_n_faces_fwd_piter<D, P>::p_n_faces_fwd_piter()
00128   {
00129   }
00130 
00131   template <unsigned D, typename P>
00132   inline
00133   p_n_faces_fwd_piter<D, P>::p_n_faces_fwd_piter(const p_complex<D, P>& pc,
00134                                                  unsigned n)
00135     : super_(pc)
00136   {
00137     mln_precondition(n <= D);
00138     set_n(n);
00139   }
00140 
00141   template <unsigned D, typename P>
00142   inline
00143   unsigned 
00144   p_n_faces_fwd_piter<D, P>::n() const
00145   {
00146     return this->iter_.n();
00147   }
00148 
00149   template <unsigned D, typename P>
00150   inline
00151   void
00152   p_n_faces_fwd_piter<D, P>::set_n (unsigned n)
00153   {
00154     this->iter_.set_n(n);
00155   }
00156     
00157 
00158   /*----------------------------.
00159   | p_n_faces_bkd_piter<D, P>.  |
00160   `----------------------------*/
00161 
00162   template <unsigned D, typename P>
00163   inline
00164   p_n_faces_bkd_piter<D, P>::p_n_faces_bkd_piter()
00165   {
00166   }
00167 
00168   template <unsigned D, typename P>
00169   inline
00170   p_n_faces_bkd_piter<D, P>::p_n_faces_bkd_piter(const p_complex<D, P>& pc,
00171                                                  unsigned n)
00172     : super_(pc)
00173   {
00174     mln_precondition(n <= D);
00175     set_n(n);
00176   }
00177 
00178   template <unsigned D, typename P>
00179   inline
00180   unsigned 
00181   p_n_faces_bkd_piter<D, P>::n() const
00182   {
00183     return this->iter_.n();
00184   }
00185 
00186   template <unsigned D, typename P>
00187   inline
00188   void
00189   p_n_faces_bkd_piter<D, P>::set_n (unsigned n)
00190   {
00191     this->iter_.set_n(n);
00192   }
00193 
00194 # endif // ! MLN_INCLUDE_ONLY
00195 
00196 } // end of mln
00197 
00198 #endif // ! MLN_CORE_SITE_SET_P_N_FACES_PITER_HH

Generated on Thu Sep 8 2011 18:32:17 for Milena (Olena) by  doxygen 1.7.1