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

mixed_neighb.hh

00001 // Copyright (C) 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_MIXED_NEIGHB_HH
00027 # define MLN_CORE_MIXED_NEIGHB_HH
00028 
00039 
00040 # include <mln/core/neighb.hh>
00041 # include <mln/core/internal/neighb_base.hh>
00042 # include <mln/core/internal/neighb_niter_base.hh>
00043 # include <mln/core/internal/site_relative_iterator_base.hh>
00044 # include <mln/core/internal/neighb_niter_impl.hh>
00045 
00046 
00047 namespace mln
00048 {
00049 
00050   // Forward declarations.
00051   template <typename W> class mixed_neighb_fwd_niter;
00052   template <typename W> class mixed_neighb_bkd_niter;
00053   template <typename W> class mixed_neighb;
00054 
00055 
00056   namespace convert
00057   {
00058 
00059     namespace over_load
00060     {
00061 
00062       template <typename W>
00063       void
00064       from_to_(const mln::mixed_neighb<W>& from, W& to);
00065 
00066       template <typename W>
00067       void
00068       from_to_(const W& from, mln::mixed_neighb<W>& to);
00069 
00070     } // end of namespace mln::convert::over_load
00071 
00072   } // end of namespace mln::convert
00073 
00074 
00075 
00077 
00078   template <typename W>
00079   class mixed_neighb
00080     : public internal::neighb_base<W,mixed_neighb<W> >,
00081       private mlc_is_a(W, Window)::check_t
00082   {
00083     typedef internal::neighb_base<W,mixed_neighb<W> > super_;
00084 
00085   public:
00086 
00088     typedef mixed_neighb_fwd_niter<W> fwd_niter;
00089 
00091     typedef mixed_neighb_bkd_niter<W> bkd_niter;
00092 
00094     typedef fwd_niter niter;
00095 
00096 
00098     mixed_neighb();
00099 
00101     mixed_neighb(const W& win);
00102 
00103   };
00104 
00105 
00106   // mixed_neighb_fwd_niter<W>
00107 
00108   template <typename W>
00109   class mixed_neighb_fwd_niter
00110     : public internal::neighb_niter_base<W,mixed_neighb<W>,
00111                                          mln_fwd_qiter(W),neighb_fwd_niter<W> >
00112   {
00113     typedef
00114       internal::neighb_niter_base<W,mixed_neighb<W>,
00115                                   mln_fwd_qiter(W),neighb_fwd_niter<W> > super_;
00116 
00117   public:
00118     mixed_neighb_fwd_niter();
00119 
00120     template <typename P>
00121     mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh,
00122                            const mln_target(W)& nbh_site_set,
00123                            const P& c);
00124 
00125   };
00126 
00127 
00128 
00129   // mixed_neighb_bkd_niter<W,E>
00130 
00131   template <typename W>
00132   class mixed_neighb_bkd_niter
00133     : public internal::neighb_niter_base<W,mixed_neighb<W>,
00134                                          mln_bkd_qiter(W),neighb_bkd_niter<W> >
00135   {
00136     typedef
00137       internal::neighb_niter_base<W,mixed_neighb<W>,
00138                                   mln_bkd_qiter(W),neighb_bkd_niter<W> > super_;
00139 
00140   public:
00141     mixed_neighb_bkd_niter();
00142 
00143     template <typename P>
00144     mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh,
00145                            const mln_target(W)& nbh_site_set,
00146                            const P& c);
00147 
00148   };
00149 
00150 
00151 
00152 # ifndef MLN_INCLUDE_ONLY
00153 
00154   // mixed_neighb<W>
00155 
00156   template <typename W>
00157   inline
00158   mixed_neighb<W>::mixed_neighb()
00159   {
00160   }
00161 
00162   template <typename W>
00163   inline
00164   mixed_neighb<W>::mixed_neighb(const W& win)
00165     : super_(win)
00166   {
00167   }
00168 
00169 
00170   // mln::convert::from_to
00171 
00172   namespace convert
00173   {
00174 
00175     namespace over_load
00176     {
00177 
00178       template <typename W>
00179       void
00180       from_to_(const mln::mixed_neighb<W>& from, W& to)
00181       {
00182         to = from.win();
00183       }
00184 
00185       template <typename W>
00186       void
00187       from_to_(const W& from, mln::mixed_neighb<W>& to)
00188       {
00189         to.change_window(from);
00190       }
00191 
00192     } // end of namespace mln::convert::over_load
00193 
00194   } // end of namespace mln::convert
00195 
00196 
00197 
00198 
00199   // mixed_neighb_fwd_niter<W>
00200 
00201   template <typename W>
00202   inline
00203   mixed_neighb_fwd_niter<W>::mixed_neighb_fwd_niter()
00204   {
00205   }
00206 
00207   template <typename W>
00208   template <typename P>
00209   inline
00210   mixed_neighb_fwd_niter<W>::mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh,
00211                                                     const mln_target(W)& nbh_site_set,
00212                                                     const P& c)
00213     : super_(nbh, c)
00214   {
00215     this->i_.init_(nbh.win(), nbh_site_set, c);
00216   }
00217 
00218 
00219 
00220   // mixed_neighb_bkd_niter<W>
00221 
00222   template <typename W>
00223   inline
00224   mixed_neighb_bkd_niter<W>::mixed_neighb_bkd_niter()
00225   {
00226   }
00227 
00228   template <typename W>
00229   template <typename P>
00230   inline
00231   mixed_neighb_bkd_niter<W>::mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh,
00232                                                     const mln_target(W)& nbh_site_set,
00233                                                     const P& c)
00234     : super_(nbh, c)
00235   {
00236     this->i_.init_(nbh.win(), nbh_site_set, c);
00237   }
00238 
00239 
00240 # endif // ! MLN_INCLUDE_ONLY
00241 
00242 } // end of namespace mln
00243 
00244 
00245 #endif // ! MLN_CORE_MIXED_NEIGHB_HH

Generated on Tue Oct 4 2011 15:24:06 for Milena (Olena) by  doxygen 1.7.1