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

neighb.hh

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

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